OPEN-SOURCE SCRIPT

Breakout Point Highlighting

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

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.