OPEN-SOURCE SCRIPT

Breakout Point Highlighting

//version=6
indicator("Breakout Point Highlighting", overlay=true)

// Input: Lookback period for finding breakout points
lookbackPeriod = input.int(20, title="Lookback Period", minval=1)

// Calculate the highest high and lowest low over the lookback period
highestHigh = ta.highest(high, lookbackPeriod)
lowestLow = ta.lowest(low, lookbackPeriod)

// Breakout conditions: price breaks above the highest high or below the lowest low
breakoutUp = close > highestHigh
breakoutDown = close < lowestLow

// Plot the breakout points
plotshape(breakoutUp, color=color.green, style=shape.triangleup, location=location.belowbar, title="Breakout Up", size=size.small)
plotshape(breakoutDown, color=color.red, style=shape.triangledown, location=location.abovebar, title="Breakout Down", size=size.small)

// Highlight the breakout zones
bgcolor(breakoutUp ? color.new(color.green, 90) : na, title="Breakout Up Highlight")
bgcolor(breakoutDown ? color.new(color.red, 90) : na, title="Breakout Down Highlight")

// Alert conditions
alertcondition(breakoutUp, title="Breakout Up Alert", message="Price has broken above the highest high.")
alertcondition(breakoutDown, title="Breakout Down Alert", message="Price has broken below the lowest low.")
sentiment

开源脚本

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

想在图表上使用此脚本?

免责声明