passaro.mail

ReversalBreakout Alert v.1

//Copyright © pas.mail
//@version=3
study("ReversalBreakout Alert",shorttitle="ReversalBreakout Alert",overlay=true)

lenp = input(20,minval=1, title = "Periodo")
ShFL = input(true, type=bool, title = "Show Fractal lines?")

lowline = lowest(close, lenp)
plot(ShFL ? lowline : na, style=line, linewidth=1, color=green)

highline=highest(close, lenp)
plot(ShFL ? highline : na, style=line, linewidth=1, color=red)

MidLine = (highline+lowline)/2
plot(ShFL ? MidLine : na, style=line, linewidth=1)


//----------------------------------------------------------------------------------
// === VARIABILI LOGICHE ===
Offset = input(1,minval=0, title = "Offset Alert")
goLong = close>highline
goShort = close<lowline

inLongPosition = na
inLongPosition := goLong ? true : goShort ? false : inLongPosition
inShortPosition = na
inShortPosition:= goShort ? true : goLong ? false : inShortPosition

flat = na
flat := not inLongPosition and not inShortPosition


alertcondition(goLong and (inShortPosition or flat),title='Alert Long', message='Long')
alertcondition(goShort and (inLongPosition or flat),title='Alert Short', message='Short!')

plotshape(goLong and (inShortPosition or flat), title='Long', location=location.abovebar, style=shape.labelup,textcolor=white, color=green, text="", transp=0,offset=Offset)
plotshape(goShort and (inLongPosition or flat),title='Short',location=location.belowbar, style=shape.labelup, textcolor=white, color=red, text="", transp=0,offset=Offset)
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?