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 abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un 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)