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提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?