Why is this Indicator Double Plotting ATR Lines ?
Forums › ProRealTime English forum › ProBuilder support › Why is this Indicator Double Plotting ATR Lines ?
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by robertogozzi.
-
-
07/15/2018 at 6:50 PM #76052
I was trying to label the orange and blue indicator lines “Short Dev Stop” and “Long Dev Stop” so I could create a strategy with how the price interacts with either crossing a long (blue) or short (orange) SAR pattern. I have done all manner of relabelling but cannot get it to simply display orange Dev Stops labelled as Short Dev Stops and the blue Dev Stops as Long Dev Stops?
Why is this indicator double plotting?
The Original Code (which works but has no long / short labelling protocol (only Dev Stop 1.0, Dev Stop 2.2 etc) when using assisted creation)
Original Code123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108//Settingsn=30p1=1.0p2=2.2p3=3.6p4=4.5p5=6.0difference=0Hg=highest[2](high)Lw=lowest[2](low)DTR=max(max(Hg-Lw,abs(Hg-close[2])),abs(Lw-close[2]))aDTR=average[n](DTR)for i=0 to n-1 dodifference=difference+square(DTR[i]-aDTR)nextdifference=difference/nsdev=sqrt(difference)dev0=close-aDTRdev1=close-aDTR-p1*sdevdev2=close-aDTR-p2*sdevdev3=close-aDTR-p3*sdevdev4=close-aDTR-p4*sdevdev5=close-aDTR-p5*sdevif dev0<dev0[1] and close>dev5[1] thendev0=dev0[1]endifif dev1<dev1[1] and close>dev5[1] thendev1=dev1[1]endifif dev2<dev2[1] and close>dev5[1] thendev2=dev2[1]endifif dev3<dev3[1] and close>dev5[1] thendev3=dev3[1]endifif dev4<dev4[1] and close>dev5[1] thendev4=dev4[1]endifif dev5<dev5[1] and close>dev5[1] thendev5=dev5[1]endifdev6=close+aDTRdev7=close+aDTR+p1*sdevdev8=close+aDTR+p2*sdevdev9=close+aDTR+p3*sdevdev10=close+aDTR+p4*sdevdev11=close+aDTR+p5*sdevif dev6>dev6[1] and close<dev11[1] thendev6=dev6[1]endifif dev7>dev7[1] and close<dev11[1] thendev7=dev7[1]endifif dev8>dev8[1] and close<dev11[1] thendev8=dev8[1]endifif dev9>dev9[1] and close<dev11[1] thendev9=dev9[1]endifif dev10>dev10[1] and close<dev11[1] thendev10=dev10[1]endifif dev11>dev11[1] and close<dev11[1] thendev11=dev11[1]endifif close>dev11[1] thenflag=-1elseif close<dev5[1] thenflag=1endifendifif flag=-1 thenind0=dev0ind1=dev1ind2=dev2ind3=dev3ind4=dev4ind5=dev5//k=1r=0g=191b=255elseind0=dev6ind1=dev7ind2=dev8ind3=dev9ind4=dev10ind5=dev11//k=-1r=255g=128b=0endif//ORIG return ind0 COLOURED BY k,ind1 coloured by k,ind2 coloured by k,ind3 coloured by k////ORANGE AND LIGHT BLUEreturn ind0 coloured(r,g,b) style(dottedline,2) as "Warning Line", ind1 coloured(r,g,b) style(dottedline,2) as "Dev Stop 1.0", ind2 coloured(r,g,b) style(dottedline,2) as "Dev Stop 2.2", ind3 coloured(r,g,b) style(line,2) as "Dev Stop 3.6", ind4 coloured(r,g,b) style(dottedline,2) as "Dev Stop 4.5", ind5 coloured(r,g,b) style(line,2) as "Dev Stop 6.0"And one of upteen attempts to get it to work – including taking the “else” out after the code: r=0, g=191, b=255 and relabelling dev0 etc longdev0, to creating a unique set on ind0 etc to ind5 and making it in ind6 (instead of ind0) in the second set of “ind” values.
Double plotting code: Incorrect double plotting of Dev Stops (orange and blue lines labelled as both long and short )
Incorrect double plotting of Dev Stops (orange and blue lines labelled as long and short )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104//Settingsn=30p1=1.0p2=2.2p3=3.6p4=4.5p5=6.0difference=0Hg=highest[2](high)Lw=lowest[2](low)DTR=max(max(Hg-Lw,abs(Hg-close[2])),abs(Lw-close[2]))aDTR=average[n](DTR)for i=0 to n-1 dodifference=difference+square(DTR[i]-aDTR)nextdifference=difference/nsdev=sqrt(difference)dev0=close-aDTRdev1=close-aDTR-p1*sdevdev2=close-aDTR-p2*sdevdev3=close-aDTR-p3*sdevdev4=close-aDTR-p4*sdevdev5=close-aDTR-p5*sdevif dev0<dev0[1] and close>dev5[1] thendev0=dev0[1]endifif dev1<dev1[1] and close>dev5[1] thendev1=dev1[1]endifif dev2<dev2[1] and close>dev5[1] thendev2=dev2[1]endifif dev3<dev3[1] and close>dev5[1] thendev3=dev3[1]endifif dev4<dev4[1] and close>dev5[1] thendev4=dev4[1]endifif dev5<dev5[1] and close>dev5[1] thendev5=dev5[1]endifdev6=close+aDTRdev7=close+aDTR+p1*sdevdev8=close+aDTR+p2*sdevdev9=close+aDTR+p3*sdevdev10=close+aDTR+p4*sdevdev11=close+aDTR+p5*sdevif dev6>dev6[1] and close<dev11[1] thendev6=dev6[1]endifif dev7>dev7[1] and close<dev11[1] thendev7=dev7[1]endifif dev8>dev8[1] and close<dev11[1] thendev8=dev8[1]endifif dev9>dev9[1] and close<dev11[1] thendev9=dev9[1]endifif dev10>dev10[1] and close<dev11[1] thendev10=dev10[1]endifif dev11>dev11[1] and close<dev11[1] thendev11=dev11[1]endifif close>dev11[1] thenind0=dev0ind1=dev1ind2=dev2ind3=dev3ind4=dev4ind5=dev5r=0g=191b=255endifif close<dev5[1] thenind6=dev6ind7=dev7ind8=dev8ind9=dev9ind10=dev10ind11=dev11r=255g=128b=0endif//ORANGE AND LIGHT BLUEreturn ind0 coloured(r,g,b) style(dottedline,2) as "Long Warning Line", ind1 coloured(r,g,b) style(dottedline,2) as "Long Dev Stop 1.0", ind2 coloured(r,g,b) style(dottedline,2) as "Long Dev Stop 2.2", ind3 coloured(r,g,b) style(line,2) as "Long Dev Stop 3.6", ind4 coloured(r,g,b) style(dottedline,2) as "Long Dev Stop 4.5", ind5 coloured(r,g,b) style(line,2) as "Long Dev Stop 6.0" , ind6 coloured(r,g,b) style(dottedline,2) as "Short Warning Line", ind7 coloured(r,g,b) style(dottedline,2) as "Short Dev Stop 1.0", ind8 coloured(r,g,b) style(dottedline,2) as "Short Dev Stop 2.2", ind9 coloured(r,g,b) style(line,2) as "Short Dev Stop 3.6", ind10 coloured(r,g,b) style(dottedline,2) as "Short Dev Stop 4.5", ind11 coloured(r,g,b) style(line,2) as "Short Dev Stop 6.0"This is probably really, really simple for a coder…. lol…
More about the Kase ATR Dev Stop here: https://www.prorealcode.com/prorealtime-indicators/kase-dev-stop-v3/
Thanks in advance,
Cheers
Bard07/16/2018 at 9:20 AM #76072It does not duplicate lines, it’s you who DUPLICATED them at lines 91-96 and then returning all of them!
The main issue is that their value is retained between bars, so there will always be 12 statuses to be displayed!
If PRT supported alphanumeric variables it would be simple to set different TEXT to the original 6 variables (ind0-ind5) to tell SHORT from LONG data thus returning only 6 variables for 12 statuses, but this is not the case, so if you don’t want those many lines well… you have to back to the original code!
Also, it would be great if you could use different RETURNs from within an IF…ENDIF block, but this is not the case, either!
Only colours can help tell the difference with just the same label!
1 user thanked author for this post.
07/16/2018 at 11:27 AM #76077Thanks @Robertogozzi,
Duplication/Bars 91-96. Yes I know! You should’ve seen all the ways I tried to relabel those variables…
Why doesn’t PRT support alphanumerics?Also do you know how you would optimise the Kase Dev Stop when using it in a system? It’s not like I am able to optimise values eg: between -1 and +1 by increments of 0.1 on a custom indicator like the Ehlers Supersmoother Oscillator (it’s on this forum, and -0.8 cross-overs to buy and + 0.8 cross-unders to sell are good values btw), because the Dev Stops are on the price chart and are “fluid” in their ATR values? I know it can be done as a user on this forum did mention they’d optimised values and found that Dev Stop values of >4 and <5 worked best.
Thanks again for you help,
Best
Bard07/16/2018 at 11:53 AM #76079Support for alphanumeric data would make the system much more difficult to manage, since they should add text support (parsing, concatenation, contraction, deletion, replacement) which would involve “garbage collection”, i.e. manage defragmentation of memory…. a difficult and time consuming process. I think these are the main reasons, but hopefully this might change in the years to come.
As for Kase Dev Stop, sorry but I never dealt with it so I can’t be of help!
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on