Olivier Sedan’ Supertrend modification where the price is replaced by the average of last 52 weeks high/low.
(code from the Kevin Britains archive).
Interesting curve to find start of new trend.
rem ****** from Kevin archive *****
rem 2 variables
rem aa=5
rem p=260
H1 = highest[p](high)
L1 = lowest[p](low)
Mid1 = ((H1 - L1)/2) + L1
atr=AverageTrueRange[p](close)
/////////////////////////////////////////////
up=Mid1+aa*atr
dn=Mid1-aa*atr
once trend=1
if high > up[1] then
trend=1
elsif low < dn[1] then
trend=-1
endif
if trend<0 and trend[1]>0 then
flag=1
else
flag=0
endif
if trend>0 and trend[1]<0 then
flagh=1
else
flagh=0
endif
if trend>0 and dn<dn[1] then
dn=dn[1]
endif
if trend<0 and up>up[1] then
up=up[1]
endif
if flag=1 then
up=Mid1+aa*atr
endif
if flagh=1 then
dn=Mid1-aa*atr
endif
if trend=1 then
super=dn
else
super=up
endif
return super as "Daily-260-Average Supertrend"