
EMA-RSI Risk Pro
A robust trend-following cBot that combines EMA crossover entries with an RSI strength filter and risk-based position sizing. Includes trailing stop, breakeven, spread/time filters, and a hard cap on maximum lots to prevent oversizing. Works on liquid FX, indices, metals, and crypto.
Key Advantages
- Risk under control: Position size derives from Equity Γ risk% and SL (in pips). A Max Lots cap prevents oversized trades on unusual symbols.
- Clean entries: EMA crossover captures trend shifts; RSI removes weak setups.
- Active trade management: Trailing stop and breakeven run on ticks to protect gains.
- Quality filters: Max spread and trading hours avoid thin-liquidity periods.
- Execution discipline: One trade per bar eliminates repetitive entries on the same candle and keeps backtests clean.
- Straightforward setup: All parameters are transparent and well-documented.
How it works
- On candle close, detect EMA bull/bear cross.
- Validate with RSI (β₯ Buy threshold for longs, β€ Sell threshold for shorts).
- Compute size from Risk % of Equity and SL (pips) β convert to units, clamp by Max Lots.
- Place market order with SL/TP (pips).
- On ticks, apply trailing stop and move SL to breakeven once profit threshold is reached.
Parameters
Strategy
- Fast EMA (default 12) β Faster trend component. Lower = more responsive, noisier.
- Slow EMA (default 26) β Slower trend component; must be > Fast EMA.
- RSI Period (default 14) β Standard balance of noise vs. lag.
- RSI Buy β₯ (default 55) β Minimum RSI for long after bull cross; raise (60β65) for stricter trends.
- RSI Sell β€ (default 45) β Maximum RSI for short after bear cross; lower (35β40) for stricter shorts.
Risk
- Risk % of Equity (default 1.0%) β Fraction of equity risked per trade.
Example: Equity 10,000; Risk 1%; SL 30 pips β risk β 100 in account currency. - SL (pips) (default 30) β Stop-loss distance used for sizing and order placement.
- TP (pips) (default 60) β Take-profit distance; set 0 to disable.
- Trailing (pips, 0=off) (default 20) β Trailing distance once in profit.
- Breakeven at Profit (pips, 0=off) (default 15) β Move SL to entry after this profit.
- Max Lots per Trade (default 0.50) β Hard ceiling on order size (safety net).
- Debug sizing (default true) β Prints sizing math (Equity, risk, pip value, lots, units) to the log.
Filters
- Max Spread (points) (default 30) β Blocks entries if spread exceeds this (points = (AskβBid)/TickSize).
- Trade Long / Trade Short (default true/true) β Enable/disable each direction.
- Start Hour / End Hour (server) (default 1β23) β Trading window; supports overnight ranges (e.g., 22β6).
- One Trade Per Bar (default true) β At most one entry per candle; signals evaluated on closed bars.
Misc
- Label (default EMA_RSI_Risk_cBot) β Position label for easy filtering/multi-run.
Quick presets
FX majors (H1/H4):
EMA 12/26 β’ RSI 14 β’ Buy/Sell 55/45 β’ SL 30β40 pips β’ TP 60β80 β’ Trail 20β30 β’ BE 15β20 β’
Risk 0.5β1.0% β’ MaxLots 0.10β0.50 β’ MaxSpread 25β35 points β’ Hours 01β23.
Metals (XAUUSD, M30/H1):
Increase SL/TP ~1.5β2Γ; relax MaxSpread by 20β30%.
Crypto (BTC/ETH, M15/H1):
Shift RSI to 60/40; use wider SL/TP; Risk β€ 0.5%; keep One trade per bar = true.
Notes
- Backtest across multiple timeframes and instruments; tune SL/TP to volatility.
- Start with conservative Risk % (0.25β0.5%) and Max Lots (0.10β0.25); enable Debug sizing to verify volumes.
- Algorithmic trading involves risk; demo/backtest thoroughly before live deployment.