Supertrend indicator mod with 52 weeks average volatility

Category: Indicators By: dominike Created: March 14, 2016, 10:01 AM
March 14, 2016, 10:01 AM
Indicators
1 Comment

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"

Download
Filename: DailySuperTrend.itf
Downloads: 297
dominike Average
Developer by day, aspiring writer by night. Still compiling my bio... Error 404: presentation not found.
Author’s Profile

Comments

Logo Logo
Loading...