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が提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?