Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=6
- indicator("SND Helper", overlay=true)
- // ————— User Inputs for Custom Colors —————
- bullishColor = input.color(color.green, title="Bullish Engulfing Color")
- bearishColor = input.color(color.red, title="Bearish Engulfing Color")
- basingLabelColor = input.color(color.orange, title="Basing Candle Label Color")
- basingLabelText = input.string("•", title="Basing Candle Label Text")
- // ————— Engulfing Detection —————
- isBullishEngulfing = close[1] < open[1] and close > open and close > open[1]
- isBearishEngulfing = close[1] > open[1] and close < open and close < open[1]
- barcolor(isBullishEngulfing ? bullishColor : na, title = "Show Bullish Engulfing")
- barcolor(isBearishEngulfing ? bearishColor : na, title = "Show Bearish Engulfing")
- // ————— Detect Basing Candle (Body < 50% of Range) and Draw Label —————
- isBasingCandle = (high - low) > 0 and math.abs(close - open) < (high - low) * 0.5
- bodyMid = (open + close) / 2
- var label[] dots = array.new<label>()
- if isBasingCandle
- lbl = label.new(bar_index, bodyMid, basingLabelText, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_center, color=color.new(basingLabelColor, 100), textcolor=basingLabelColor, size=size.small)
- array.push(dots, lbl)
- if array.size(dots) > 50
- label.delete(array.shift(dots))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement