Every Fractal indicator minor bug fix
Forums › ProRealTime English forum › ProBuilder support › Every Fractal indicator minor bug fix
- This topic has 27 replies, 6 voices, and was last updated 4 years ago by parthapersonal.
-
-
03/31/2020 at 7:43 PM #124162
I have a minor bug fix for the indicator that can be found in the library here:
https://www.prorealcode.com/prorealtime-indicators/every-fractal-trend-lines/
The ITF file attached here corrects an issue whereby the indicator crashes if you enter a value for ‘Qty’ that is greater than the number of fractals detected.
Here is the updated code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576//Every Fractal//PRT v11//By Vonasi//Date: 20200331//Qty = 1//StartBack = 0//Past = 1//Future = 1//Points = 1//Fade = 0//BarsBefore = 1//BarsAfter = 1BarsBefore = max(BarsBefore,1)BarsAfter = max(BarsAfter,1)StartBack = max(0,startback)BarLookBack = BarsAfter + 1if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THENif low[BarsAfter] = lowest[BarLookBack](low) THENa = a + 1$supportbar[a] = barindex[barsafter]$supportvalue[a] = low[barsafter]endifendifif high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THENif high[BarsAfter] = highest[BarLookBack](high) THENb = b + 1$resistancebar[b] = barindex[barsafter]$resistancevalue[b] = high[barsafter]endifendifif islastbarupdate thenmyqty = min(min(b,a),qty)for z = 0 to myqty-1e = (myqty)-zif fade thenc = (255/myqty)*eelsec = 255endifif support thenif a >= 2 thenif future thendrawray($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],$supportbar[a-z-startback],$supportvalue[a-z-startback])coloured(128,0,0,c)endifif past thendrawray($supportbar[a-z-startback],$supportvalue[a-z-startback],$supportbar[a-z-1-startback],$supportvalue[a-z-1-startback])coloured(128,0,0,c)endifif points thendrawpoint($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],2)coloured(128,0,0,c)drawpoint($supportbar[a-z-startback],$supportvalue[a-z-startback],2)coloured(128,0,0,c)endifendifendifif resistance thenif b >= 2 thenif future thendrawray($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],$resistancebar[b-z-startback],$resistancevalue[b-z-startback])coloured(0,128,0,c)endifif past thendrawray($resistancebar[b-z-startback],$resistancevalue[b-z-startback],$resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback])coloured(0,128,0,c)endifif points thendrawpoint($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],2)coloured(0,128,0,c)drawpoint($resistancebar[b-z-startback],$resistancevalue[b-z-startback],2)coloured(0,128,0,c)endifendifendifnextendifreturn03/31/2020 at 9:28 PM #12417103/31/2020 at 11:42 PM #12418804/01/2020 at 8:10 AM #12419704/01/2020 at 9:21 AM #12420604/01/2020 at 10:45 AM #124222Hi Nicolas
Nope only on indicators I downloaded recently from PRCode on a daily timeframe.
Here’s the code that does not work (line 23): $supportbar[a] = barindex[barsafter] which is why I thought it’s an array issue.
All other indicators’re working fine (I run them under Windows BTW).
Thanks04/01/2020 at 10:57 AM #124226At that point in the code even on the first run through a = 1 and barsafter can never be less than 1 so their should never be any error.
It is quite difficult to bug fix this when I cannot reproduce the error.
I’ll add something to the code so that it does not start looking for fractals until there are definitely enough bars to have one and post the code here for you to try.
I know it sounds stupid but have you tried TIOATIBOA. (Turning it off and turning it back on a gain!) I have found that sometimes in the past shutting down the platform and reopening it and some odd errors suddenly disappear.
04/01/2020 at 11:43 AM #124230Here is the modified code whereby it only looks for fractals if there are enough bars on the chart to have one. I don’t think it will fix your issue though. Let us know.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778//Every Fractal v1.4//PRT v11//By Vonasi//Date: 20200331//Qty = 1//StartBack = 0//Past = 1//Future = 1//Points = 1//Fade = 0//BarsBefore = 1//BarsAfter = 1BarsBefore = max(BarsBefore,1)BarsAfter = max(BarsAfter,1)StartBack = max(0,startback)if barindex >= barsbefore + barsafter thenBarLookBack = BarsAfter + 1if low[BarsAfter] < lowest[BarsBefore](low)[BarLookBack] THENif low[BarsAfter] = lowest[BarLookBack](low) THENa = a + 1$supportbar[a] = barindex[barsafter]$supportvalue[a] = low[barsafter]endifendifif high[BarsAfter] > highest[BarsBefore](high)[BarLookBack] THENif high[BarsAfter] = highest[BarLookBack](high) THENb = b + 1$resistancebar[b] = barindex[barsafter]$resistancevalue[b] = high[barsafter]endifendifif islastbarupdate thenmyqty = min(min(b,a),qty)for z = 0 to myqty-1e = (myqty)-zif fade thenc = (255/myqty)*eelsec = 255endifif support thenif a >= 2 thenif future thendrawray($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],$supportbar[a-z-startback],$supportvalue[a-z-startback])coloured(128,0,0,c)endifif past thendrawray($supportbar[a-z-startback],$supportvalue[a-z-startback],$supportbar[a-z-1-startback],$supportvalue[a-z-1-startback])coloured(128,0,0,c)endifif points thendrawpoint($supportbar[a-z-1-startback],$supportvalue[a-z-1-startback],2)coloured(128,0,0,c)drawpoint($supportbar[a-z-startback],$supportvalue[a-z-startback],2)coloured(128,0,0,c)endifendifendifif resistance thenif b >= 2 thenif future thendrawray($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],$resistancebar[b-z-startback],$resistancevalue[b-z-startback])coloured(0,128,0,c)endifif past thendrawray($resistancebar[b-z-startback],$resistancevalue[b-z-startback],$resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback])coloured(0,128,0,c)endifif points thendrawpoint($resistancebar[b-z-1-startback],$resistancevalue[b-z-1-startback],2)coloured(0,128,0,c)drawpoint($resistancebar[b-z-startback],$resistancevalue[b-z-startback],2)coloured(0,128,0,c)endifendifendifnextendifendifreturn04/01/2020 at 2:01 PM #12424204/02/2020 at 2:02 PM #12436204/04/2020 at 7:26 AM #12457404/04/2020 at 8:08 AM #12457504/04/2020 at 9:59 AM #124591I’m glad to hear that it was a platform version issue and not an issue with my code. It’s so much easier when someone else fixes the problem 🙂
I’m actually from the UK by the way but my location is Greece.My Greek is just about up to understanding ‘ευχαριστώ’ so I won’t tell you off for posting in the wrong language!
04/04/2020 at 11:28 AM #12459804/04/2020 at 12:43 PM #124605I’m actually from the UK
Until you explained (a while back) where Vonasi comes from, I had thought you must be of German origin! 🙂
But having thought above, I couldn’t understand how you had a UK sense of humour and had even watched ‘Minder’ ! 🙂
-
AuthorPosts
Find exclusive trading pro-tools on