Simple 3-test breakout
- This topic has 4 replies, 3 voices, and was last updated 5 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:
Forums › ProRealTime English forum › ProScreener support › Simple 3-test breakout
Hello Everyone, my coding level is terrible but I’ve manage to get my main strategy working for proscreener. I am wondering if anyone has successfully coded a 3-test of a horizontal line (support/resistance) scanner , part of my second strategy?? I can’t see anything in the library and would love some assistance.
thanks,
adam
First you have to determine the resistance (support is just the other way round).
To do this you must choose a preferred period, say 100 bars:
1 |
Resistance = highest[100](close) |
now you count the number of times price (high) has hit that resistance:
1 |
x = summation[100](high >= Resistance) >= 3 |
x will be true when Resistance has been hit at least 3 times or more.
(not tested)
Thank you, I’ll give it a try tomorrow night.
I tested it and it seems not to work correctly. This should do, instead:
1 2 3 4 5 6 7 8 9 |
p = 100 Resistance = highest[p](close) Count = 0 FOR i = (p - 1) DOWNTO 0 IF high[i] >= Resistance THEN Count = Count + 1 ENDIF NEXT SCREENER[Count >= 3](Count AS "Hits") |
and this is the indicator:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
DEFPARAM DrawOnLastBarOnly = true p = 100 Resistance = highest[p](close) Count = 0 FOR i = (p - 1) DOWNTO 0 IF high[i] >= Resistance THEN Count = Count + 1 ENDIF NEXT IF Count >= 3 THEN DRAWSEGMENT(BarIndex - (p - 1),Resistance,BarIndex,Resistance) ENDIF RETURN |
I have this indicator that I wrote a while back that might be of interest. It calculates a level mid way through the upper and lower shadow and then checks back through p bars to see how many other shadows crossed the same level. It draws extending lines at these levels if ‘tests’ quantity of shadow crosses are detected until a new level is found to have been tested.
I might submit it to the library as I’d forgotten that I’d coded it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
defparam calculateonlastbars = 1000 p = 200 tests = 3 if barindex >=tests then level = (high + max(open,close))/2 count = 1 draw = 0 for a = 1 to p if close[a] > level then break endif if high[a] >= level and max(close[a],open[a]) <= level then count = count + 1 if count = tests then startindex = barindex-a draw = 1 break endif endif next if draw = 1 then drawsegment(startindex,level,barindex,level) coloured(0,128,0) lastlevel = level else drawsegment(barindex-1,lastlevel,barindex,lastlevel) coloured(0,128,0) endif level2 = (low + min(open,close))/2 count = 1 draw2 = 0 for a = 1 to p if close[a] < level2 then break endif if low[a] <= level2 and min(close[a],open[a]) >= level2 then count = count + 1 if count = tests then startindex2 = barindex-a draw2 = 1 break endif endif next if draw2 = 1 then drawsegment(startindex2,level2,barindex,level2) coloured(128,0,0) lastlevel2 = level2 else drawsegment(barindex-1,lastlevel2,barindex,lastlevel2) coloured(128,0,0) endif endif return |
Find exclusive trading pro-tools on