RicardoSantos

[RS]Open Range Breakout V0

Request for DCC
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?
//@version=2
study(title='[RS]Open Range Breakout V0', shorttitle='ORB', overlay=true)
//  Request for DCC
tf = input(title='Timeframe for open range:', type=string, defval='60', confirm=false)
f_is_new_day() => change(time('D'))!=0

ND_open = f_is_new_day() ? security(tickerid, tf, open) : ND_open[1]
ND_high = f_is_new_day() ? security(tickerid, tf, high) : ND_high[1]
ND_low = f_is_new_day() ? security(tickerid, tf, low) : ND_low[1]

ND_stretch = na(ND_stretch[1]) ? 0 : f_is_new_day() ? (ND_stretch[1]*9 + security(tickerid, tf, (high-open)>=(open-low)?high-open:open-low)) / 10 : ND_stretch[1]

filter_high = f_is_new_day() ? na : ND_high
filter_low = f_is_new_day() ? na : ND_low

filter_high_stretch = f_is_new_day() ? na : ND_high+ND_stretch
filter_low_stretch = f_is_new_day() ? na : ND_low-ND_stretch

fh = plot(title='TR', series=filter_high, style=linebr, color=black)
fl = plot(title='BR', series=filter_low, style=linebr, color=black)
fhs = plot(title='TS', series=filter_high_stretch, style=linebr, color=green)
fls = plot(title='BS', series=filter_low_stretch, style=linebr, color=maroon)
fill(title='Positive Stretch', plot1=fh, plot2=fhs, color=green, transp=50)
fill(title='Negative Stretch', plot1=fl, plot2=fls, color=maroon, transp=50)