比特币
教学

ReversalBreakout Alert

//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[1] : na, style=line, linewidth=1, color=green)

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

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


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

inLongPosition = na
inLongPosition := goLong[1] ? true : goShort[1] ? false : inLongPosition[1]
inShortPosition = na
inShortPosition:= goShort[1] ? true : goLong[1] ? false : inShortPosition[1]

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="[LONG]", transp=0,offset=Offset)
plotshape(goShort and (inLongPosition or flat),title='Short',location=location.belowbar, style=shape.labelup, textcolor=white, color=red, text="[SHORT]", transp=0,offset=Offset)
Technical IndicatorsLONGreversalshortTrend Analysis

免责声明