RicardoSantos

[RS]Multiple ATR Analysis V1

UPDATE:
• added a mean version of atr using fractional lengths (requested by IvanLabrie):
• uses slow length property for setup.
• added Average Dayly Range (ADR) (requested by IvanLabrie)
• uses fast length property for setup.
• added Average Weekly Range (AWR)
• uses fast length property for setup.
• added Average Monthly Range (AMR)
• uses fast length property for setup.
• added Average Yearly Range (AYR)
• uses fast length property for setup.
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
study(title="[RS]Multiple ATR Analysis V1")
fast_length = input(title='Fast ATR Length:', defval=14)
slow_length = input(title='Slow ATR Length:', defval=100)
SHOW_CATR = input(title='Show Cumulative ATR?:', defval=true)
SHOW_MATR = input(title='Show Mean ATR(fractional slow length)?:', defval=true)
SHOW_ADR = input(title='Show Average Dayly Range(fast length)?:', defval=true)
SHOW_WDR = input(title='Show Average Weekly Range(fast length)?:', defval=false)
SHOW_MDR = input(title='Show Average Monthly Range(fast length)?:', defval=false)
SHOW_YDR = input(title='Show Average Yearly Range(fast length)?:', defval=false)

catr = not SHOW_CATR ? na : cum(high-low)/(n+1)
matr = not SHOW_MATR ? na : (atr(round(slow_length*0.05))+atr(round(slow_length*0.25))+atr(round(slow_length*0.5))+atr(slow_length))/4
adr = not SHOW_ADR ? na : security(tickerid, 'D', atr(fast_length))
wdr = not SHOW_WDR ? na : security(tickerid, 'W', atr(fast_length))
mdr = not SHOW_MDR ? na : security(tickerid, 'M', atr(fast_length))
ydr = not SHOW_YDR ? na : security(tickerid, '12M', atr(fast_length))

plot(atr(fast_length), title='Fast ATR', color=red, trackprice=true)
plot(atr(slow_length), title='slow ATR', color=maroon, trackprice=true)
plot(catr, color=blue, title='CATR', trackprice=true)
plot(matr, color=navy, title='MATR', trackprice=true)
plot(adr, color=black, title='ADR', trackprice=true)
plot(wdr, color=gray, title='AWR', trackprice=true)
plot(mdr, color=silver, title='AMR', trackprice=true)
plot(ydr, color=aqua, title='AYR', trackprice=true)
hline(0, color=black)