//@version=5
strategy("Multi-Indicator Strategy By Arvind Dodke [EMA+MACD+RSI+ADX]", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
emaLength = input.int(100, title="EMA Length")
rsiLength = input.int(14, title="RSI Length")
macdFast = input.int(12, title="MACD Fast Length")
macdSlow = input.int(26, title="MACD Slow Length")
macdSignal = input.int(9, title="MACD Signal Length")
adxLength = input.int(14, title="ADX Length")
adxThreshold = input.float(20.0, title="ADX Threshold")
tpPerc = input.float(3.0, title="Take Profit (%)") / 100
slPerc = input.float(1.5, title="Stop Loss (%)") / 100
useTrailing = input.bool(true, title="Use Trailing Stop?")
trailPerc = input.float(1.8, title="Trailing Stop (%)") / 100
// === INDICATORS ===
ema = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)
[plusDI, minusDI, adxValue] = ta.dmi(adxLength, 14)
// === CONDITIONS ===
// Buy Conditions
bullTrend = close > ema
macdBull = ta.crossover(macdLine, signalLine)
rsiBull = rsi > 50
adxStrong = adxValue > adxThreshold
longCondition = bullTrend and macdBull and rsiBull and adxStrong
// Sell Conditions
bearTrend = close < ema
macdBear = ta.crossunder(macdLine, signalLine)
rsiBear = rsi < 50
shortCondition = bearTrend and macdBear and rsiBear and adxStrong
// === STRATEGY EXECUTION ===
if (longCondition)
strategy.entry("Long", strategy.long)
if useTrailing
strategy.exit("Exit Long Trail", from_entry="Long", trail_points=trailPerc * close / syminfo.mintick, trail_offset=trailPerc * close / syminfo.mintick)
else
strategy.exit("Exit Long TP/SL", from_entry="Long", profit=tpPerc * close / syminfo.mintick, loss=slPerc * close / syminfo.mintick)
if (shortCondition)
strategy.entry("Short", strategy.short)
if useTrailing
strategy.exit("Exit Short Trail", from_entry="Short", trail_points=trailPerc * close / syminfo.mintick, trail_offset=trailPerc * close / syminfo.mintick)
else
strategy.exit("Exit Short TP/SL", from_entry="Short", profit=tpPerc * close / syminfo.mintick, loss=slPerc * close / syminfo.mintick)
// === PLOT ===
plot(ema, color=color.orange, title="100 EMA")
07-11
07-11