
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.