PP Fractals // Error message
Forums › ProRealTime English forum › ProOrder support › PP Fractals // Error message
- This topic has 28 replies, 4 voices, and was last updated 3 years ago by
PeterSt.
-
-
02/28/2022 at 12:28 PM #18902302/28/2022 at 12:29 PM #189024
what @Nicolas is saying. So to me it now seems that he (from his own code ever back ?) tells that the arrays were only there for graphing, while you don’t graph anything. So just eliminate the code concerned (?).
Which is exactly what he has done for you (I checked and understand it now). So the challenge is : why is the result not the same.
Probably because the approach with the array failed ? or the arrays themselves fail ? (it really is too easy to make mistakes, the way PRT set them up).02/28/2022 at 12:36 PM #189029I’m not putting in doubt what Nicolas has done. However, I see (as you see it in your backtest) there is a big difference between with and without.
Do you mean that there might be something wrong in the calculation of the Arrays that generates “fake” Profits? It’s very likely. May be the solution/answer is with Vonasi the author of the original code 🙂
02/28/2022 at 12:39 PM #189030May be the solution/answer is with Vonasi the author of the original code
For info … we’ve not seen Vonasi hereabouts for 9 months or so!
1 user thanked author for this post.
02/28/2022 at 12:44 PM #189032I think the problem lies in this part :
12LongConso = long=1 and close > $resistancevalue[z]ShortConso = short=-1 and close < $supportvalue[z]My “coder hunch” tells me that z is eliminated from the new code, while z is (was) necessary for this part. So it is not about a and b, but this z. I can’t see quickly how to change that – hopefully @Nicolas can.
And maybe I am wrong. But both codes really are 100% the same, except for the part which is commented out (and the new usage of resistancevalue ans supportvalue).1 user thanked author for this post.
02/28/2022 at 12:45 PM #189033For info … we’ve not seen Vonasi hereabouts for 9 months or so!
umd followed him. If you know what I mean … (and if not then too bad).
02/28/2022 at 12:47 PM #18903402/28/2022 at 12:58 PM #189038Something else (not), we should not forget that something *is* wrong somewhere with the arrays approach. And avoiding their purpose (the graphing) is not really the very best idea.
Without the arrays, this error still occurs for the 1M backtest. I will report it, then together with nontheless’s report (elsewhere) they may see commonalities.
02/28/2022 at 1:10 PM #189042Problem is that the array can increment 12 times per hour, so the 1 million column of the array could be reach pretty fast, please try the new version below:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278DEFPARAM CUMULATEORDERS = FALSETIMEFRAME(60 minutes,updateonclose)a=a+1b=b+1TIMEFRAME(60 minutes)LongConso=0ShortConso= 0Long=0Short=0//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PRC_SwingLine Ron Black | indicator by Nicolasif upsw=1 thenif high>hH thenhH=highendifif low>hL thenhL=lowendifif high<hL thenupsw=0lL=lowlH=highendifendifif upsw=0 thenif low<lL thenlL=lowendifif high<lH thenlH=highendifif low>lH thenupsw=1hH=highhL=lowendifendifif upsw=1 thenswingline=hLelseswingline=lHendifif close>open theniRange = abs(close-open)elsif close<open theniRange = abs(open-close)endifif close>open thenUpWick = high - closeLoWick = open-lowelsif close<open thenUpWick = high-openLoWick = close-lowendif// LONGif close>open thenif close[1]>open[1] thenif close>close[1] thenlong1=1endifendifendifif close>open thenif close[1]<open[1] thenif close>open[1] thenlong2=1endifendifendifif iRange>UpWick or LoWick>UpWick thenlong3 = 1endif//if close>close[1] and close[2]>close[1] then//long4 = 1//endifif high>high[1] or low>low[1] thenlong5=1endifif (long1 or long2) and long3 and long5 and close>swingline thenLong=1endif// SHORTif close<open thenif close[1]>open[1] thenif close<open[1] thenshort1=1endifendifendifif close<open thenif close[1]<open[1] thenif close<close[1] thenshort2=1endifendifendifif iRange>LoWick or LoWick<UpWick thenshort3 = 1endif//if close<close[1] and close[2]<close[1] then//short4 = 1//endifif high<high[1] or low<low[1] thenshort5=1endifif (Short1 or short2) and short3 and short5 and close<swingline thenShort=-1endif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SR PP Fractal Lines by Vonasi//BarsBefore = 1//BarsAfter = 1Support = 1Resistance = 1Points = 1//Make sure all settings are valid onesBarsBefore = max(BarsBefore,1)BarsAfter = max(BarsAfter,1)StartBack = max(0,startback)if barindex >= barsbefore + barsafter then//Look for a low fractalBarLookBack = BarsAfter + 1if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THENif low[BarsAfter] = lowest[BarLookBack](low) THEN//if barindex[barsafter]<>$supportbar[a] then//a<99999 then//a = a + 1//endif$supportbar[a] = barindex[barsafter]$supportvalue[a] = low[barsafter]endifendif//Look for a high fractalif high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THENif high[BarsAfter] = highest[BarLookBack](high) THEN//if barindex[barsafter]<>$resistancebar[b] then//b = b + 1//endif$resistancebar[b] = barindex[barsafter]$resistancevalue[b] = high[barsafter]endifendifif islastbarupdate then//support lineif a >= 2 thenif support thenflag = 0zz = 0for z = a-zz downto 1for xx = 1 to aif z-xx < 1 thenbreakendifif $supportvalue[z] > $supportvalue[z-xx] thenif points thenendifflag = 1breakendifif zz<99999 thenzz = zz + 1endifnextif flag = 1 thenbreakendifzz = 0nextendifendif//resistance lineif b >= 2 thenif resistance thenflag = 0zz = 0for z = b-zz downto 1for xx = 1 to bif z-xx < 1 thenbreakendifif $resistancevalue[z] < $resistancevalue[z-xx] thenif points thenendifflag = 1breakendifif zz<99999 thenzz = zz + 1endifnextif flag = 1 thenbreakendifzz = 0nextendifendifendifendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////LongConso = long=1 and close > $resistancevalue[z]ShortConso = short=-1 and close < $supportvalue[z]////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////TIMEFRAME(5 minutes, UPDATEONCLOSE)nLots = min(10,round((2000+STRATEGYPROFIT)/(close*.5*.1),1))IF NOT LongOnMarket AND LongConso THENBUY nLots CONTRACTS AT MARKETENDIFIF NOT ShortOnMarket AND ShortConso THENSELLSHORT nLots CONTRACTS AT MARKETENDIF////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////If LongOnMarket AND ShortConso THENSELL AT MARKETSELLSHORT nLots CONTRACTS AT MARKETENDIFIF ShortOnMarket AND LongConso THENEXITSHORT AT MARKETBUY nLots CONTRACTS AT MARKETENDIF////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////TIMEFRAME(1 minute)SET STOP %LOSS .3 //SLSET TARGET %PROFIT 1.6 //TP02/28/2022 at 1:47 PM #189046Thank you very much Nicolas!!! I left home, so I’ve no access to my PRT now. I’ll test it later today and let you know.
Basically, what I’m trying to acheive is a Strategy that works without any time-based indicator for Entry Signals (no MA, no RSI, etc.), only price, price and price. I found the Swing Line that you shared in another post quite effective with (UPDATEONCLOSE) and TF>H1, but I need to add more filters like Breakout of Trendlines.
May be we can do that without Arrays?
02/28/2022 at 3:23 PM #189051Thank you for your help, @Nicolas.
The result is unchanged, but more importantly, this is not workable because of slowness and *that* tells me that something with the array-accesses is not correct (asking for an undefined element will trigger the error-trap under the hood and this is ultimately slow). The 100K takes 20 minutes to calculate. This was not so at all with the earlier version from Khaled (using arrays).I am only the messenger. 😐
1 user thanked author for this post.
02/28/2022 at 3:48 PM #189054Dear Trading Companions 🙂
First, please let me thank you for all the help and time you have spent trying to help. Obviously, this is more about the learning journey than the immediate end result in itself.
Second, the 2nd code reworked by Nicolas didn’t work LIVE. I had again and again the same error of 1,000,000 rows.
Third and happily, I managed to replace the PP Fractals code by another code from Vonasi called Fractals Average https://www.prorealcode.com/prorealtime-indicators/fractals-average/, where I replaced the two trigger variables with “MidAvg”. I got results not far away and it is live now as we speak. Let’s how it behaves over the afternoon.
I’ll keep you posted.
If anyone thinks of a piece of code somewhere on this forum which uses only price for Trend, Breakout, etc., please let me know. I defenitly want to build a system without any time-based indicators (MA, RSI, etc.).
Again, thank you for your support. I feel blessed.
02/28/2022 at 4:46 PM #189064New try (I did not compare tjhe result with initial version)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282DEFPARAM CUMULATEORDERS = FALSETIMEFRAME(60 minutes)LongConso=0ShortConso= 0Long=0Short=0once $lastbarindexa[0]=barindexonce $lastbarindexb[0]=barindex//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PRC_SwingLine Ron Black | indicator by Nicolasif upsw=1 thenif high>hH thenhH=highendifif low>hL thenhL=lowendifif high<hL thenupsw=0lL=lowlH=highendifendifif upsw=0 thenif low<lL thenlL=lowendifif high<lH thenlH=highendifif low>lH thenupsw=1hH=highhL=lowendifendifif upsw=1 thenswingline=hLelseswingline=lHendifif close>open theniRange = abs(close-open)elsif close<open theniRange = abs(open-close)endifif close>open thenUpWick = high - closeLoWick = open-lowelsif close<open thenUpWick = high-openLoWick = close-lowendif// LONGif close>open thenif close[1]>open[1] thenif close>close[1] thenlong1=1endifendifendifif close>open thenif close[1]<open[1] thenif close>open[1] thenlong2=1endifendifendifif iRange>UpWick or LoWick>UpWick thenlong3 = 1endif//if close>close[1] and close[2]>close[1] then//long4 = 1//endifif high>high[1] or low>low[1] thenlong5=1endifif (long1 or long2) and long3 and long5 and close>swingline thenLong=1endif// SHORTif close<open thenif close[1]>open[1] thenif close<open[1] thenshort1=1endifendifendifif close<open thenif close[1]<open[1] thenif close<close[1] thenshort2=1endifendifendifif iRange>LoWick or LoWick<UpWick thenshort3 = 1endif//if close<close[1] and close[2]<close[1] then//short4 = 1//endifif high<high[1] or low<low[1] thenshort5=1endifif (Short1 or short2) and short3 and short5 and close<swingline thenShort=-1endif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SR PP Fractal Lines by Vonasi//BarsBefore = 1//BarsAfter = 1Support = 1Resistance = 1Points = 1//Make sure all settings are valid onesBarsBefore = max(BarsBefore,1)BarsAfter = max(BarsAfter,1)StartBack = max(0,startback)if barindex >= barsbefore + barsafter then//Look for a low fractalBarLookBack = BarsAfter + 1if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THENif low[BarsAfter] = lowest[BarLookBack](low) THEN//if barindex[barsafter]<>$supportbar[a] then//a<99999 then//a = a + 1//endifif barindex>$lastbarindexa[0] thena=a+1$lastbarindexa[0]=barindexendif$supportbar[a] = barindex[barsafter]$supportvalue[a] = low[barsafter]endifendif//Look for a high fractalif high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THENif high[BarsAfter] = highest[BarLookBack](high) THEN//if barindex[barsafter]<>$resistancebar[b] then//b = b + 1//endifif barindex>$lastbarindexb[0] thenb=b+1$lastbarindexb[0]=barindexendif$resistancebar[b] = barindex[barsafter]$resistancevalue[b] = high[barsafter]endifendifif islastbarupdate then//support lineif a >= 2 thenif support thenflag = 0zz = 0for z = a-zz downto 1for xx = 1 to aif z-xx < 1 thenbreakendifif $supportvalue[z] > $supportvalue[z-xx] thenif points thenendifflag = 1breakendifif zz<99999 thenzz = zz + 1endifnextif flag = 1 thenbreakendifzz = 0nextendifendif//resistance lineif b >= 2 thenif resistance thenflag = 0zz = 0for z = b-zz downto 1for xx = 1 to bif z-xx < 1 thenbreakendifif $resistancevalue[z] < $resistancevalue[z-xx] thenif points thenendifflag = 1breakendifif zz<99999 thenzz = zz + 1endifnextif flag = 1 thenbreakendifzz = 0nextendifendifendifendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////LongConso = long=1 and close > $resistancevalue[z]ShortConso = short=-1 and close < $supportvalue[z]////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////TIMEFRAME(5 minutes, UPDATEONCLOSE)nLots = min(10,round((2000+STRATEGYPROFIT)/(close*.5*.1),1))IF NOT LongOnMarket AND LongConso THENBUY nLots CONTRACTS AT MARKETENDIFIF NOT ShortOnMarket AND ShortConso THENSELLSHORT nLots CONTRACTS AT MARKETENDIF////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////If LongOnMarket AND ShortConso THENSELL AT MARKETSELLSHORT nLots CONTRACTS AT MARKETENDIFIF ShortOnMarket AND LongConso THENEXITSHORT AT MARKETBUY nLots CONTRACTS AT MARKETENDIF////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////TIMEFRAME(1 minute)SET STOP %LOSS .3 //SLSET TARGET %PROFIT 1.6 //TP1 user thanked author for this post.
02/28/2022 at 5:20 PM #189075 -
AuthorPosts
Find exclusive trading pro-tools on