Hi all,
I would like to create a screener that selects stocks between the most recent support and resistance levels, such that the price is still somewhat away from the point at which the price changes direction. So the share price is between the most recent top and bottom in the chart. The attachment shows what I mean. No use is made of MAs or the like. The screener should work in both a bull and a bear market, although this can also be split into two Screeners. Furthermore, the Screener(s) must work with both a daily and an hourly time frame. Problem is that I don’t know how to program that in Proscreener. Can anyone give me some good ideas?
This is the indicator showing Support and Resistance levels:
DEFPARAM CalculateOnLastBars = 1000
PivotBAR = 2 //2 bars AFTER pivot
LookBack = 4 //4 bars BEFORE pivot
BarLookBack = PivotBAR + 1
IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
IF low[PivotBAR] = lowest[BarLookBack](low) THEN
MySupport = BarIndex - PivotBAR
SupportPrice = low[PivotBAR]
ENDIF
ENDIF
IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
IF high[PivotBAR] = highest[BarLookBack](high) THEN
MyResistance = BarIndex - PivotBAR
ResistancePrice = high[PivotBAR]
ENDIF
ENDIF
DRAWSEGMENT(MyResistance,ResistancePrice,BarIndex,ResistancePrice) COLOURED(255,0,0,255)
DRAWSEGMENT(MySupport,SupportPrice,BarIndex,SupportPrice) COLOURED(0,128,0,255)
RETURN
and this is the screener to scan the market:
PivotBAR = 2 //2 bars AFTER pivot
LookBack = 4 //4 bars BEFORE pivot
BarLookBack = PivotBAR + 1
IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
IF low[PivotBAR] = lowest[BarLookBack](low) THEN
MySupport = BarIndex - PivotBAR
ENDIF
ENDIF
IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
IF high[PivotBAR] = highest[BarLookBack](high) THEN
MyResistance = BarIndex - PivotBAR
ENDIF
ENDIF
Cond = (low >= MySupport) AND (high <= MyResistance)
SCREENER[Cond AND (high <> low)]
you can use it on any timeframe of your choice. You can make duplicates of it and run it simulaneously (provided this is supported by your platform) on different TFs.