BandOsMACustomSignal
This EA trades based on a mean-reversion signal generated by OsMA (Moving Average of Oscillator) crossing outside Bollinger Bands applied to the OsMA itself, with exits triggered when OsMA crosses back over a moving average of OsMA. It uses a custom signal interface supporting multi-symbol and multi-timeframe operation, with trailing stop protection and a sophisticated optimization framework using shadow parameters to enforce the fast<slow constraint on MA periods.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Conversion problem |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Conversion problem |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Conversion problem |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Conversion problem |
Why this EA never traded: it compares lines on different scales (an oscillator against a price level).
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The strategy concept is mean reversion: buy signals are generated when OsMA crosses below the Bollinger Band lower band, and sell signals when it crosses above the upper band, assuming price will revert to the mean. Entry conditions require OsMA to cross the Bollinger Band boundary on two consecutive bars — below the lower band for longs, above the upper band for shorts. Exit conditions trigger when OsMA crosses back over its own moving average, or when the current signal no longer matches the open position direction. Position sizing uses fixed lots with no scaling mechanism. Money management includes a stop loss and trailing stop (with a step of stopLoss/50), but no take-profit is set, relying entirely on signal reversal or trailing stop to protect gains. The optimization framework cleverly converts the two-dimensional fast/slow period optimization into a one-dimensional combination index using shadow parameters, eliminating invalid combinations where fast >= slow.
Strengths
- Clean architecture with TradingStrategy/TradingSignal interfaces for decoupling and extensibility
- Clever shadow parameter optimization framework eliminates invalid fast>=slow period combinations
- Multi-symbol and multi-timeframe signal support via BandOsMaSignal constructor parameters
- Trailing stop mechanism protects floating profits with configurable step size
- AutoPtr smart pointers manage dynamic resources, preventing memory leaks
- R-squared criterion for optimization is more scientifically sound than raw profit
Weaknesses
- No take-profit mechanism, fully relying on signal reversal or trailing stop which may miss optimal exits
- Fixed lot sizing without proportional money management cannot adapt to account size changes
- When multiple positions exist only an alert is issued without closing excess positions
- No spread filter or slippage protection when trading on a different symbol than the signal symbol
- Applying Bollinger Bands and MA on top of OsMA creates double-smoothing which may cause significant signal lag
Possible improvements
- Add take-profit parameter or ATR-based dynamic take-profit to avoid over-reliance on signal reversal for exits
- Implement proportional money management module that adjusts lot size based on account balance percentage or risk ratio
- Add automatic handling logic for excess positions instead of just alerting when multiple positions are detected
Risk assessment
Overall risk: Low
- Multiple positions only trigger an alert without auto-handling, potentially leading to unintended risk exposure
- No spread filter, trading on small timeframe signal symbols may suffer from slippage
- Fixed lot sizing cannot adapt to varying account sizes
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Magic | 1234567890 | Magic number to identify this EA's positions |
Lots | 0.01 | Lot size per trade |
StopLoss | 1000 | Stop loss in points |
SignalSymbol | Signal symbol; empty uses current symbol | |
SignalTimeframe | PERIOD_M1 | signaltime period |
FastOsMA | 12 | OsMAfastEMA period |
SlowOsMA | 26 | OsMAslowEMA period |
SignalOsMA | 9 | OsMAsignal line period |
PriceOsMA | PRICE_TYPICAL | OsMAapplied price type |
BandsMA | 26 | Bollinger Bands MA period |
BandsShift | 0 | Bollinger Bands offset |
BandsDeviation | 2.0 | Bollinger Bands standard deviation multiplier |
PeriodMA | 10 | MA period for OsMA indicator |
ShiftMA | 0 | MAMA offset |
MethodMA | MODE_SMA | MAMAcalculation method |
FastSlowCombo4Optimization | 0 | Shadow param for optimization: fast-slow combo index |
FastShadow4Optimization | 0 | Shadow param for optimization: fast period range |
SlowShadow4Optimization | 0 | Shadow param for optimization: slow period range |
StepsShadow4Optimization | 0 | Shadow param for optimization: step range |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.