Futures Bot | EMA + RSI + ATR — Strategy by Ericvalmond
By version
Performance Metrics
- Author: version
- Symbol: CME_MINI:MNQ1!
- Timeframe: 5 minutes
- Net P&L: −243.99 USD (−0.02%)
- Win Rate: 44.4%
- Profit Factor: 0.658
- Max Drawdown: 387.38 USD (0.04%)
- Total Trades: 9
Description
//version=5strategy("Futures Bot | EMA + RSI + ATR", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=5, commission_type=strategy.commission.percent, commission_value=0.05, slippage=2, pyramiding=0)// ─────────────────────────────────────────────// INPUTS// ─────────────────────────────────────────────ema_fast = input.int(21, "Fast EMA", minval=5, maxval=200)ema_slow = input.int(55, "Slow EMA", minval=10, maxval=500)ema_trend = input.int(200, "Trend EMA", minval=50, maxval=500)rsi_len = input.int(14, "RSI Length", minval=5, maxval=50)rsi_ob = input.int(70, "RSI Overbought", minval=60, maxval=90)rsi_os = input.int(30, "RSI Oversold", minval=10, maxval=40)atr_len = input.int(14, "ATR Length", minval=5, maxval=50)sl_mult = input.float(1.5, "Stop Loss ATR x", minval=0.5, maxval=5.0, step=0.1)tp_mult = input.float(3.0, "Take Profit ATR x",minval=1.0, maxval=10.0, step=0.1)use_trail = input.bool(true, "Use Trailing Stop")trail_mult = input.float(1.0, "Trailing ATR x", minval=0.5, maxval=3.0, step=0.1)use_vol = input.bool(true, "Volume Filter")vol_len = input.int(20, "Volume MA Length", minval=5, maxval=100)// ─────────────────────────────────────────────// INDICATORS// ─────────────────────────────────────────────ema21 = ta.ema(close, ema_fast)ema55 = ta.ema(close, ema_slow)ema200 = ta.ema(close, ema_trend)rsi = ta.rsi(close, rsi_len)atr = ta.atr(atr_len)vol_ma = ta.sma(volume, vol_len)// ─────────────────────────────────────────────// CONDITIONS// ─────────────────────────────────────────────bull_trend = ema21 > ema55 and ema55 > ema200bear_trend = ema21 vol_ma : truelong_signal = cross_up and bull_trend and rsi > 40 and rsi openshort_signal = cross_dn and bear_trend and rsi rsi_os and vol_ok and close 0 if use_trail strategy.exit("Long Exit", "Long", trail_offset=atr * trail_mult / syminfo.mintick, limit=tp, stop=sl) else strategy.exit("Long Exit", "Long", stop=sl, limit=tp) if ta.crossunder(ema21, ema55) strategy.close("Long", comment="EMA Cross")if strategy.position_size ema55 ? color.new(color.green, 85) : color.new(color.red, 85))plotshape(long_signal, title="Long", style=shape.triangleup, location=location.belowbar, color=color.new(#00E676, 0), size=size.normal, text="LONG")plotshape(short_signal, title="Short", style=shape.triangledown, location=location.abovebar, color=color.new(#FF1744, 0), size=size.normal, text="SHORT")plot(strategy.position_size != 0 ? sl : na, "Stop Loss", color=color.red, style=plot.style_linebr, linewidth=1)plot(strategy.position_size != 0 ? tp : na, "Take Profit", color=color.green, style=plot.style_linebr, linewidth=1)// ─────────────────────────────────────────────// ALERTS// ─────────────────────────────────────────────alertcondition(long_signal, title="Long Entry", message="FuturesBot LONG on {{ticker}} @ {{close}}")alertcondition(short_signal, title="Short Entry", message="FuturesBot SHORT on {{ticker}} @ {{close}}")