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)
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?