OPEN-SOURCE SCRIPT

Empty Candle

55
//version=5
indicator("5–6 signals per day (Stable)", overlay=true)

// ─────── Inputs ───────
emaLen = input.int(50, "EMA Length", minval=10)
rsiLen = input.int(14, "RSI Length", minval=5)
volMult = input.float(1.3, "Volume multiplier", minval=1.0, step=0.1)
rsiOverb = input.int(65, "RSI Overbought", minval=50, maxval=90)
rsiOvers = input.int(35, "RSI Oversold", minval=10, maxval=50)

// ─────── Calculations ───────
ema = ta.ema(close, emaLen)
rsi = ta.rsi(close, rsiLen)
volMA = ta.sma(volume, 20)

// ─────── Trend ───────
bullTrend = close > ema
bearTrend = close < ema
volSpike = volume > volMA * volMult

// ─────── Base conditions ───────
baseBuy = bullTrend and rsi < rsiOvers and volSpike and close > open
baseSell = bearTrend and rsi > rsiOverb and volSpike and close < open

// ─────── EMA press logic ───────
emaPressBuy = close > open and open < ema and close > ema
emaPressSell = close < open and open > ema and close < ema

// ─────── Final signals ───────
buyCond = baseBuy or emaPressBuy
sellCond = baseSell or emaPressSell

// ─────── Signals (STRICTLY BAR-ANCHORED) ───────
plotshape(
buyCond,
title="BUY",
style=shape.triangleup,
location=location.belowbar,
color=color.lime,
size=size.small
)

plotshape(
sellCond,
title="SELL",
style=shape.triangledown,
location=location.abovebar,
color=color.red,
size=size.small
)

// ─────── EMA ───────
plot(ema, title="EMA", color=color.new(color.blue, 30), linewidth=2)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.