Discussione: Supertrend
Visualizzazione Ibrida
-
16-02-22, 12:32 #1
- Data Registrazione
- Feb 2020
- Messaggi
- 143
Dovrebbe essere questo
multiplier=3
period=10
moy=averagetruerange[period](close)
price=medianprice
up=price+multiplier*moy
dn=price-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=price+multiplier*moy
endif
if flagh=1 then
dn=price-multiplier*moy
endif
if trend=1 then
mysupertrend=dn
else
mysupertrend=up
endif
return mysupertrend coloured by (trend) as "SuperTrend"
-
16-02-22, 14:27 #2
- Data Registrazione
- Feb 2020
- Messaggi
- 143
avola=averagetruerange[bb](close)
avg=medianprice
up=avg+aa*avola
dn=avg-aa*avola
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=avg+aa*avola
endif
if flagh=1 then
dn=avg-aa*avola
endif
if trend=1 then
super=dn
else
super=up
endif
return super
l'altra variabile aa =3
-
17-02-22, 10:38 #3
-
01-03-22, 12:36 #4
- Data Registrazione
- Oct 2018
- Messaggi
- 3
Ciao a tutti,
tempo fa avevo appofondito l'indicatore ATR, non mi spiegavo il motivo per cui Beetrader e T3 avessero valori diversi di questo indicatore.
La differenza è la media applicata al true range:-> versione T3 (quindi prorealtime) viene utilizzata la media di Wilder (sarà mica perchè l'inventore dell'atr è proprio Wilder?.............)-> versione Beetrader è proposta di default la media semplice
Visto che su Beetrader il tipo di media è sotto parametro, impostando "WILDER" (oppure 8) al posto di "SIMPLE" si ottiene lo stesso indicatore ART che è sulla T3.
...
Il supertrend ha al suo interno l'ATR, dal codice postato da Max mi pare venga presa la media semplice, credo sia solo questa la differenza tra Beetrader e T3
Saluti
Gil
-
01-03-22, 14:18 #5