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)
//Settings
n=30
p1=1.0
p2=2.2
p3=3.6
p4=4.5
p5=6.0
difference=0
Hg=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 do
difference=difference+square(DTR[i]-aDTR)
next
difference=difference/n
sdev=sqrt(difference)
dev0=close-aDTR
dev1=close-aDTR-p1*sdev
dev2=close-aDTR-p2*sdev
dev3=close-aDTR-p3*sdev
dev4=close-aDTR-p4*sdev
dev5=close-aDTR-p5*sdev
if dev0<dev0[1] and close>dev5[1] then
dev0=dev0[1]
endif
if dev1<dev1[1] and close>dev5[1] then
dev1=dev1[1]
endif
if dev2<dev2[1] and close>dev5[1] then
dev2=dev2[1]
endif
if dev3<dev3[1] and close>dev5[1] then
dev3=dev3[1]
endif
if dev4<dev4[1] and close>dev5[1] then
dev4=dev4[1]
endif
if dev5<dev5[1] and close>dev5[1] then
dev5=dev5[1]
endif
dev6=close+aDTR
dev7=close+aDTR+p1*sdev
dev8=close+aDTR+p2*sdev
dev9=close+aDTR+p3*sdev
dev10=close+aDTR+p4*sdev
dev11=close+aDTR+p5*sdev
if dev6>dev6[1] and close<dev11[1] then
dev6=dev6[1]
endif
if dev7>dev7[1] and close<dev11[1] then
dev7=dev7[1]
endif
if dev8>dev8[1] and close<dev11[1] then
dev8=dev8[1]
endif
if dev9>dev9[1] and close<dev11[1] then
dev9=dev9[1]
endif
if dev10>dev10[1] and close<dev11[1] then
dev10=dev10[1]
endif
if dev11>dev11[1] and close<dev11[1] then
dev11=dev11[1]
endif
if close>dev11[1] then
flag=-1
else
if close<dev5[1] then
flag=1
endif
endif
if flag=-1 then
ind0=dev0
ind1=dev1
ind2=dev2
ind3=dev3
ind4=dev4
ind5=dev5
//k=1
r=0
g=191
b=255
else
ind0=dev6
ind1=dev7
ind2=dev8
ind3=dev9
ind4=dev10
ind5=dev11
//k=-1
r=255
g=128
b=0
endif
//ORIG return ind0 COLOURED BY k,ind1 coloured by k,ind2 coloured by k,ind3 coloured by k//
//ORANGE AND LIGHT BLUE
return 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 )
//Settings
n=30
p1=1.0
p2=2.2
p3=3.6
p4=4.5
p5=6.0
difference=0
Hg=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 do
difference=difference+square(DTR[i]-aDTR)
next
difference=difference/n
sdev=sqrt(difference)
dev0=close-aDTR
dev1=close-aDTR-p1*sdev
dev2=close-aDTR-p2*sdev
dev3=close-aDTR-p3*sdev
dev4=close-aDTR-p4*sdev
dev5=close-aDTR-p5*sdev
if dev0<dev0[1] and close>dev5[1] then
dev0=dev0[1]
endif
if dev1<dev1[1] and close>dev5[1] then
dev1=dev1[1]
endif
if dev2<dev2[1] and close>dev5[1] then
dev2=dev2[1]
endif
if dev3<dev3[1] and close>dev5[1] then
dev3=dev3[1]
endif
if dev4<dev4[1] and close>dev5[1] then
dev4=dev4[1]
endif
if dev5<dev5[1] and close>dev5[1] then
dev5=dev5[1]
endif
dev6=close+aDTR
dev7=close+aDTR+p1*sdev
dev8=close+aDTR+p2*sdev
dev9=close+aDTR+p3*sdev
dev10=close+aDTR+p4*sdev
dev11=close+aDTR+p5*sdev
if dev6>dev6[1] and close<dev11[1] then
dev6=dev6[1]
endif
if dev7>dev7[1] and close<dev11[1] then
dev7=dev7[1]
endif
if dev8>dev8[1] and close<dev11[1] then
dev8=dev8[1]
endif
if dev9>dev9[1] and close<dev11[1] then
dev9=dev9[1]
endif
if dev10>dev10[1] and close<dev11[1] then
dev10=dev10[1]
endif
if dev11>dev11[1] and close<dev11[1] then
dev11=dev11[1]
endif
if close>dev11[1] then
ind0=dev0
ind1=dev1
ind2=dev2
ind3=dev3
ind4=dev4
ind5=dev5
r=0
g=191
b=255
endif
if close<dev5[1] then
ind6=dev6
ind7=dev7
ind8=dev8
ind9=dev9
ind10=dev10
ind11=dev11
r=255
g=128
b=0
endif
//ORANGE AND LIGHT BLUE
return 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
Bard