Compare highest high between two points
Forums › ProRealTime English forum › ProBuilder support › Compare highest high between two points
- This topic has 22 replies, 4 voices, and was last updated 7 years ago by ck1066.
-
-
06/21/2016 at 10:17 AM #9636
Hi,
I’m hoping someone will be able to help.
How do I compare the highest high between the last 6 bars and last 30 bars in ProBuilder? I’ve tried the following syntax in my indicator without any success.
highest[6](high[1]) > highest[30](high[1])
Any help would be appreciated.
Thanks
06/21/2016 at 11:42 AM #964006/21/2016 at 7:52 PM #964506/23/2016 at 12:22 AM #9701Hi,
tried the suggestion but didn’t work, and still need help.
If I remove the code in bold it works, but without testing to see if it has made a higher high, in addition to a higher low. This is simply to test we are in an up trend using price action.
12345678910111213///////LONG POSITIONma1=ExponentialAverage[20](close)stochk=Stochastic[8,3](close)c1=close crosses over ma1c2=close>ma1lh1=lowest[6](low)lh2=lowest[40](low)<strong>hh1=highest[6](high)hh2=highest[40](high)</strong>c3=lh1[1]>lh2[1]c4=stochk>stochk[1]<strong>c5=hh1[1]>hh2[1]</strong>up=c1 and c2 and c3 and c4 and <strong>c5</strong>06/23/2016 at 6:51 AM #970506/23/2016 at 8:18 AM #9711As you can see in the picture below, the 6 periods highest high/lowest low channel is always included into the 40 periods. So to test a breakout of the 40 periods channel, you should test if the 6 periods one is inferior or superior with a candlestick offset more longer:
1c3=lh1[1]>lh2[10]Sorry, if I put you on the wrong track in my previous reply.
06/23/2016 at 8:51 AM #9720Thanks again for your prompt reply.
Please see the attached image for what I’m trying to achieve within the code as I think we may have our wires crossed.
Curent position is true if:
Uptrend
HH1>HH2 and
HL1>HL2
Downtrend
LH1<LH2 and
LL1<LL2
the following code is my attempt. Lines 12,13 and 16 have been REM’d out as it’s currently not working
1234567891011121314151617181920212223242526272829303132333435363738res = 0ma1=ExponentialAverage[20](close)//stochd = Average[3](Stochastic[8,3](close))stochk=Stochastic[8,3](close)//rs=RSI[14]///////LONG POITIONc1=close crosses over ma1c2=close>ma1lh1=lowest[6](low)lh2=lowest[40](low)//hh1=highest[12](high)//hh2=highest[40](high)c3=lh1[1]>lh2[1]c4=stochk>stochk[1]//c5=hh1[1]>=hh2up=c1 and c2 and c3 and c4//////SHORT POSITIONd1=close crosses under ma1d2=close<ma1hl1=highest[6](high)hl2=highest[40](high)d3=hl1[1]<hl2[1]d4=stochk<stochk[1]down=d1 and d2 and d3 and d4if up thenres=1elsif down thenres=-1endifreturn res as "x"06/23/2016 at 9:11 AM #9725Hmm that’s working for me if you use my previous solution …. ->
12345678910111213141516171819202122232425262728293031323334res = 0ma1=ExponentialAverage[20](close)//stochd = Average[3](Stochastic[8,3](close))stochk=Stochastic[8,3](close)//rs=RSI[14]///////LONG POITIONc1=close crosses over ma1c2=close>ma1lh1=lowest[6](low)lh2=lowest[40](low)c3=lh1[1]>lh2[10]c4=stochk>stochk[1]up=c1 and c2 and c3 and c4//////SHORT POSITIONd1=close crosses under ma1d2=close<ma1hl1=highest[6](high)hl2=highest[40](high)d3=hl1[1]<hl2[10]d4=stochk<stochk[1]down=d1 and d2 and d3 and d4if up thenres=1elsif down thenres=-1endifreturn res as "x"06/23/2016 at 10:20 AM #9733Oops I pasted the wrong version of the code.
Below is the code, which at the moment was testing the long position section. The offending lines have been rem’d out (lines 12,13 and 16). Also condition c5 is not currently tested as it doesn’t work as expected.
12345678910111213141516171819202122232425262728293031323334353637383940res = 0ma1=ExponentialAverage[20](close)//stochd = Average[3](Stochastic[8,3](close))stochk=Stochastic[8,3](close)//rs=RSI[14]///////LONG POITIONc1=close crosses over ma1c2=close>ma1lh1=lowest[6](low)lh2=lowest[40](low)//hh1=highest[12](high)//hh2=highest[40](high)c3=lh1[1]>lh2[1]c4=stochk>stochk[1]//c5=hh1[1]>=hh2up=c1 and c2 and c3 and c4//////SHORT POSITIONd1=close crosses under ma1d2=close<ma1hl1=highest[6](high)hl2=highest[40](high)d3=hl1[1]<hl2[1]d4=stochk<stochk[1]down=d1 and d2 and d3 and d4if up thenres=1elsif down thenres=-1endifreturn res as "x"06/23/2016 at 12:10 PM #9738Did you test my code?
http://www.prorealcode.com/topic/compare-highest-high-between-two-points/#post-9725
06/23/2016 at 2:24 PM #9751Yes I tested your code but the result is still the same.
both indicators tests the last two lowest low but not the last two highest highs in and uptrend successfully, vice versa in a downtrend.
I have attached a screen capture showing your indicator as (prt) at the bottom and my indicator (7) just above. Both missed the corresponding alert highlighted on the chart.
I think it might be the way HH2 is being selected within the code. I guess ideally I need to somehow pick the highest high between 7 and 40. Is this possible?
06/23/2016 at 4:44 PM #975806/23/2016 at 5:10 PM #976206/23/2016 at 7:17 PM #9774Donchian channels is exactly what you use in your code, it is a channel made of the highest high and lowest low over n periods :
123456//Donchian channel - 6 periods lookbackhh=highest[6](high)ll=lowest[6](low)RETURN hh,ll06/24/2016 at 10:39 AM #9787Following some debugging it appears the problem lies in how highest[40](high) and lowest[40](low) are evaluated.
What I really need to express somehow is to excluding the first 6 bars i.e.
highest[7 to 40](high)
and also
lowest[7 to 40](low)
Any ideas how this can be achieved using the correct syntax?
-
AuthorPosts
Find exclusive trading pro-tools on