OPEN-SOURCE SCRIPT

Breakout Point Highlighting

417
//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.")

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.