Roberto buongiorno,
scusa il disturbo, ti faccio l’ennesima richiesta di SREENER, questa volta dall’indicatore Super trend.
a = 1 //Key Vaule. ‘This changes the sensitivity’
c = 10 //ATR Period
multiplier=a
period=c
moy=averagetruerange[period](close)
iprice=totalprice
up=iprice+multiplier*moy
dn=iprice-multiplier*moy
once trend=1
if close>up[1] then
trend=1
elsif close<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=iprice+multiplier*moy
endif
if flagh=1 then
dn=iprice-multiplier*moy
endif
if trend=1 then
mysupertrend=dn
else
mysupertrend=up
endif
if mysupertrend > mysupertrend[1] then
color1=0
color2=255
color3=0
elsif mysupertrend < mysupertrend[1] then
color1=255
color2=0
color3=0
endif
if iprice crosses over mysupertrend then
drawarrowup(barindex,mysupertrend) coloured(“green”)
endif
if iprice crosses under mysupertrend then
drawarrowdown(barindex,mysupertrend) coloured(“red”)
endif
return mysupertrend coloured (color1,color2,color3) as “SuperTrend”
Grazie
ecco un codice di screening che controlla i cambiamenti di colore del supertrend:
st = supertrend[3,10]
screener[ close crosses over st or close crosses under st ]
Scusa lo devo mettere in fondo al codice?
No, questo è il codice completo per la tua query di screening. Il supertrend è un'istruzione interna, non è necessario ricodificarlo da zero come nel codice fornito.