Simple 3-test breakout
Forums › ProRealTime English forum › ProScreener support › Simple 3-test breakout
- This topic has 4 replies, 3 voices, and was last updated 4 years ago by Vonasi.
-
-
02/20/2020 at 10:11 AM #120006
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
02/20/2020 at 10:55 AM #120019First 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:
1Resistance = highest[100](close)now you count the number of times price (high) has hit that resistance:
1x = summation[100](high >= Resistance) >= 3x will be true when Resistance has been hit at least 3 times or more.
(not tested)
02/20/2020 at 11:26 AM #120022Thank you, I’ll give it a try tomorrow night.
02/20/2020 at 2:13 PM #120063I tested it and it seems not to work correctly. This should do, instead:
123456789p = 100Resistance = highest[p](close)Count = 0FOR i = (p - 1) DOWNTO 0IF high[i] >= Resistance THENCount = Count + 1ENDIFNEXTSCREENER[Count >= 3](Count AS "Hits")and this is the indicator:
12345678910111213DEFPARAM DrawOnLastBarOnly = truep = 100Resistance = highest[p](close)Count = 0FOR i = (p - 1) DOWNTO 0IF high[i] >= Resistance THENCount = Count + 1ENDIFNEXTIF Count >= 3 THENDRAWSEGMENT(BarIndex - (p - 1),Resistance,BarIndex,Resistance)ENDIFRETURN02/20/2020 at 3:06 PM #120071I 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!
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859defparam calculateonlastbars = 1000p = 200tests = 3if barindex >=tests thenlevel = (high + max(open,close))/2count = 1draw = 0for a = 1 to pif close[a] > level thenbreakendifif high[a] >= level and max(close[a],open[a]) <= level thencount = count + 1if count = tests thenstartindex = barindex-adraw = 1breakendifendifnextif draw = 1 thendrawsegment(startindex,level,barindex,level) coloured(0,128,0)lastlevel = levelelsedrawsegment(barindex-1,lastlevel,barindex,lastlevel) coloured(0,128,0)endiflevel2 = (low + min(open,close))/2count = 1draw2 = 0for a = 1 to pif close[a] < level2 thenbreakendifif low[a] <= level2 and min(close[a],open[a]) >= level2 thencount = count + 1if count = tests thenstartindex2 = barindex-adraw2 = 1breakendifendifnextif draw2 = 1 thendrawsegment(startindex2,level2,barindex,level2) coloured(128,0,0)lastlevel2 = level2elsedrawsegment(barindex-1,lastlevel2,barindex,lastlevel2) coloured(128,0,0)endifendifreturn -
AuthorPosts