Advertisement
Guest User

SND Helper

a guest
Jun 1st, 2025
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.35 KB | Source Code | 0 0
  1. //@version=6
  2. indicator("SND Helper", overlay=true)
  3.  
  4. // ————— User Inputs for Custom Colors —————
  5. bullishColor = input.color(color.green, title="Bullish Engulfing Color")
  6. bearishColor = input.color(color.red, title="Bearish Engulfing Color")
  7. basingLabelColor = input.color(color.orange, title="Basing Candle Label Color")
  8. basingLabelText = input.string("•", title="Basing Candle Label Text")
  9.  
  10. // ————— Engulfing Detection —————
  11. isBullishEngulfing = close[1] < open[1] and close > open and close > open[1]
  12. isBearishEngulfing = close[1] > open[1] and close < open and close < open[1]
  13.  
  14. barcolor(isBullishEngulfing ? bullishColor : na, title = "Show Bullish Engulfing")
  15. barcolor(isBearishEngulfing ? bearishColor : na, title = "Show Bearish Engulfing")
  16.  
  17. // ————— Detect Basing Candle (Body < 50% of Range) and Draw Label —————
  18. isBasingCandle = (high - low) > 0 and math.abs(close - open) < (high - low) * 0.5
  19. bodyMid = (open + close) / 2
  20.  
  21. var label[] dots = array.new<label>()
  22.  
  23. if isBasingCandle
  24.     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)
  25.     array.push(dots, lbl)
  26.     if array.size(dots) > 50
  27.         label.delete(array.shift(dots))
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement