A moving average crossover robot is an automated trading program that watches two moving averages and opens or closes positions when they cross. The version covered here, built by Petko Aleksandrov, founder of Algo Trading Space, pairs a 12-period and a 26-period average with DeMarker and Stochastic confirmation, a Momentum exit, and fixed protective orders.
Below you will find its exact rule set, a winning and a losing trade from its backtest, the reasons a plain cross tends to fail, and how to test the EA yourself on MT4 or MT5 before risking capital.
What Is a Moving Average Crossover Robot?
It is an Expert Advisor that can automatically execute trades whenever a faster average crosses a slower one, without anyone watching the chart. When the quick line rises through the lagging one, the program treats it as a buy signal; when it drops beneath, it treats it as a sell signal or an exit.

People call these programs by several names, including moving average trading bot, crossover bot and MA crossover EA. The label matters less than the rules.
The difference from trading the same signals by hand is consistency. A person may hesitate after three losses, skip a signal at 2 a.m., or move a stop on instinct; an automated program applies the identical logic every time, so live results can be compared fairly with the backtest. The flip side is that it will also keep trading through conditions its rules were never designed for. Fidelity describes the crossover method as trading when a shorter average moves across a longer one, noting that the shorter line is called “fast” because it changes direction sooner (Fidelity Viewpoints, June 2026).
For a broader explanation of crossover logic, common period pairs and how to generate your own variants, see our guide to building a moving average crossover EA. This page focuses on one finished robot and its specific filters.
Why a Plain Crossover Is Not Enough
Moving averages are calculated from past closing prices, so they follow price rather than forecast it. A program that trades every cross therefore enters after a move has begun and keeps entering during choppy spells when nothing follows.

In a video reviewing popular MA strategies, Aleksandrov tested several of them in EA Studio’s backtester:
- “Trade close to the 50 EMA” on Brent crude, H4: the idea could not be coded as described, because “close to” is not a precise rule. The nearest testable version, a bar opening above a rising 50-period EMA after the previous one opened beneath it, produced a losing balance curve.
- That idea with a $10 stop, $30 target and a one-bar exit: it showed 15 profitable trades over a recent two-to-three-month window, yet across 852 trades from 2013 to 1 September 2022 it lost money.
- A 20/50 crossover on GBP/CHF, permanently in the market: reversing on every cross pushed the account towards a margin call.
His conclusion was that averages can form part of a workable system but should not carry it alone. Pairing them with other technical indicators and firm exit conditions is what separates a testable EA from a chart that only looks convincing in hand-picked examples.

Strategy Settings at a Glance
This robot was the best performer among 97 crossover strategies built and tested for the original research. Its settings, as published when the page first went live in January 2023, are summarised below.
| Component | Setting |
| Strategy type | Crossover with indicator confirmation |
| Fast MA | 12 |
| Slow MA | 26 |
| Long trigger | 12 crosses above 26 |
| Short trigger | 12 drops below 26 |
| First filter | DeMarker: period 30, threshold 45 |
| Second filter | Stochastic: %K 14, main vs signal |
| Exit indicator | Momentum: period 49, level 100.69 |
| Protective orders | Fixed SL and TP |
| Platform | MT4 in the first release |
Several details were never published: the symbol, timeframe, average type, exact SL/TP distances, and the test period. Read each of them from the EA’s inputs and confirm them in a backtest of your own before drawing conclusions.
Long Entry Rules
A buy opens only when three conditions coincide on the same bar:
- the 12-period MA crosses above the 26-period MA;
- DeMarker is below its threshold;
- Stochastic %K is above %D.
A stop below entry and a target above it are attached to the order.
Short Entry Rules
Sells mirror the buy logic. The 12 drops through the 26, DeMarker sits above its threshold, and %K is beneath %D. The stop goes above entry and the target below.
DeMarker Confirmation
DeMarker compares recent highs and lows to gauge whether buying or selling pressure is stretched. Requiring it below the threshold for a buy filters out crosses that arrive after price has already run up.
The first version of this page described the condition as “lower than the level line of 30 level of 45”, which blends two numbers. Thirty is the indicator period and 45 the threshold. MetaTrader plots DeMarker on a 0 to 1 scale, so the threshold probably appears as 0.45 in the inputs; check before reproducing it.
Stochastic Confirmation
For a buy, the oscillator’s %K must sit above its signal line (%D); for a sell, beneath it. That checks that short-term momentum agrees with the crossover’s direction. Only the %K period of 14 was given, so take the %D and slowing values from the EA.
Momentum Exit Rule
If neither protective order is reached, a buy closes when the 49-period Momentum indicator climbs above 100.69. MetaTrader’s Momentum compares the latest closing price with the one a set number of bars back, so readings near 100 mean price is roughly unchanged across that span. The sell-side exit level was not given; by symmetry it is likely just under 100, but verify it.
Stop Loss and Take Profit
Each position carries a preset stop and profit target, sent with the entry and held on the broker’s server. They cap the damage from a wrong signal. Because the original distances were not disclosed, set them from your own testing in pips or points suited to the instrument.
Basic Crossover vs This Robot
The filters are what distinguish this EA from a textbook cross.
| Feature | Basic crossover | This robot |
| Entry on the cross | Yes | Yes |
| DeMarker filter | No | Yes |
| Stochastic confirmation | No | Yes |
| Momentum exit | No | Yes |
| Stop loss | Optional | Built in |
| Take profit | Optional | Included |
| Permanently in the market | Often | No |
Every extra condition removes trades. That lowers whipsaw exposure but also means fewer signals, so the robot needs a longer test to build a meaningful sample.
Trade Examples From the Historical Test
The earlier write-up showed two sells from the backtest, one winner and one loser.
A Profitable Sell
The 12 dipped under the 26, DeMarker was on the high side of its level, and the Stochastic pointed down, so every entry condition was satisfied. Price then dropped far enough to hit the target before the Momentum exit came into play.
A Losing Sell
Here, too, all confirmations were present at entry, yet price turned against the position and it closed at a loss. That outcome does not mean the EA malfunctioned. Even when every condition holds, markets can reverse; the robot should follow its predefined stop, exit indicator or opposite-signal logic rather than a trader intervening on impulse.
Why Crossover Robots Struggle in Sideways Markets
Averages are trend-following tools. When price ranges, the fast and slow lines weave around each other, producing repeated crosses that reverse quickly, commonly called whipsaws.
That is why many crossover strategies add filters such as:
- ADX to require a minimum trend strength;
- ATR to skip very quiet periods or size stops to volatility;
- RSI or Stochastic to avoid entering at stretched levels;
- a higher-timeframe trend check so trades follow the broader direction;
- completed-candle confirmation before acting;
- a spread ceiling to skip entries when costs widen.
This robot’s two oscillator filters play that role. No filter removes whipsaws entirely, and each addition is another parameter that can be fitted to history, so it should earn its place in out-of-sample testing.
When This Kind of Robot Tends to Work
Moving average crossovers earn most of their profits during sustained directional phases, when a trend runs long enough for the lagging averages to catch it and stay aligned. They give back money in between, during the ranges that separate those phases. Expect results to arrive in bursts rather than smoothly, and judge the robot over a period long enough to include both kinds of market.
How the Robot Handles News and Volatility
The EA has no awareness of economic releases. It reads only price, so an interest rate decision or employment report affects it through sudden bars, wider spreads and slippage rather than through any rule. A stop placed with the order still protects the position, but in a fast market it can fill beyond its level. Traders who want to avoid that exposure often pause automated trading around major scheduled announcements or add a spread filter that holds off trading while costs jump.
Risk Controls Beyond the Built-In Stops
The EA’s own exits protect each position, but account-level limits matter just as much when an EA trades unattended. Before any live use, decide on:
- Position sizing from a small percentage of equity per trade rather than a constant lot.
- A maximum spread above which new entries are skipped.
- A daily or weekly loss limit that pauses the robot after a set decline.
- A cap on open positions if you run it on several symbols.
Leverage limits apply as well. Retail clients of EU-regulated brokers are capped at 30:1 on major currency pairs (CNMV summary of ESMA measures, June 2018), and higher gearing offered elsewhere magnifies losing streaks as quickly as winning ones.
SMA vs EMA for Crossover Robots
An exponential moving average reacts faster than a simple one because it weights recent prices more heavily. MetaQuotes explains that the simple type gives every price in the period equal weight, while exponential and linear weighted types favour the latest data (MetaQuotes indicator reference).
For a crossover robot, the consequence is direct: EMA trading produces earlier signals and more noise, whereas a simple moving pair signals later with fewer false crosses. Neither is universally better, and the MA method this EA uses was never stated, so check it in the settings.
Should the Robot Wait for Candle Close?
Usually, yes. A cross visible partway through a bar can vanish before that bar ends. Confirming on completed bars removes those phantom entries, at the cost of entering slightly later.
MetaQuotes notes that its “Open prices only” testing mode uses only each bar’s opening price (MetaQuotes testing documentation). That mode suits EAs that act only at a new bar but misrepresents ones that trade intrabar, so match the modelling mode to how the program actually evaluates signals.
Moving Average Crossover Robot for MT4 vs MT5
The robot originally shipped as an MT4 file, and it will not run on MT5 without a dedicated version. MT4 EAs are written in MQL4 and compile to .ex4 inside that platform’s Experts folder; MT5 programs use the newer language and produce .ex5 files stored in MQL5/Experts (MetaTrader 5 Help, Algorithmic Trading).
MT5’s tester adds multi-threaded optimisation and real-tick modelling, making it the stronger environment for a multi-indicator robot. Rebuilding the rules in EA Studio lets you export them to both platforms instead of maintaining two hand-coded files.
How to Backtest This EA
Even though the developer tested it, run your own backtest on the broker, symbol, spread assumptions and timeframe you intend to trade. Results on another feed can differ materially.
- Attach the robot to the chart and timeframe it was designed for.
- Open the Strategy Tester and pick a period with trending and ranging phases.
- Enter realistic spread and commission.
- Run the test and review the report.
- Repeat on a later stretch of history the settings never saw.
Our step-by-step MT4 testing guide and MetaTrader 5 backtesting walkthrough cover the settings in detail.
What to Check in the Report
This robot’s original write-up reported a profit factor of 1.45, again without naming the market, chart period or dates behind it. Profit factor is gross winnings divided by gross losses; a value above 1 means the winners outweighed the losers in money terms during the test. It says nothing about the share of trades that won, and a past figure does not ensure future profitability.
Review these backtesting results alongside it:
- trade count and the length of the test;
- net profit and maximum drawdown;
- average win versus average loss, and expected payoff;
- longest run of consecutive losses;
- the cost assumptions used;
- performance on out-of-sample data and across different years.
A method such as walk-forward analysis gives a more systematic view of whether the settings hold up beyond the data used to choose them.
Getting the EA and Demo Testing It
The free download link on the previous version of this page no longer works. In September 2025, Algo Trading Space retired the free EAs shared in older videos because they needed re-optimisation, and now offers three monthly-refreshed EAs in the Freebies tab of a free platform account. You can also recreate the 12/26 logic with the same builder and test it on your own broker’s data.
Whichever route you take, trial the robot on demo accounts before going live. That confirms it executes as intended on current spreads and sessions; it does not prove future results. If you plan to run it continuously, a virtual private server keeps the terminal online, and our guide on how to choose a forex VPS provider explains what to compare.
Crossover Robot FAQ
Is 12/26 a good moving average crossover?
It is a reasonable medium-speed pair, but no combination is universally good. The 12 and 26 periods match the lengths MACD uses by default, so many traders recognise them. On their own they still whipsaw in ranging conditions, which is why this robot adds DeMarker, Stochastic and Momentum rules. Whether 12/26 suits your instrument and timeframe can only be judged by testing it on your own data and comparing nearby settings such as 10/30 or 15/30.
Can this robot trade crypto?
It can be attached to a symbol such as BTCUSD, but its settings were not published as crypto-specific and should not be assumed to transfer. Cryptocurrencies swing far more than most currency pairs, so protective-order distances, indicator thresholds and the exit indicator would all need retesting. Broker crypto CFDs also carry broader spreads and different session times. Treat a crypto version of this EMA or SMA crossover system as a new strategy with its own backtest and forward period.
Can I use alerts instead of automatic trading?
Yes. The signals can be recreated as an alert that notifies you when all conditions line up, leaving the order decision with you. MetaTrader supports pop-up, sound, email and push notifications from indicators and EAs. The trade-off is consistency: manual execution adds delay and the temptation to skip signals, which pulls live results away from the backtest. Many traders use alerts while they learn the rules and switch to full automation once they trust them.
Why was this robot chosen from 97 strategies?
It was the strongest of the 97 crossover EAs built for the study. Picking the best of many is a normal step, but it carries selection bias: with enough candidates, one will look good partly by chance. That is why the winner should be retested on data it was never selected on and run on demo before live use. A result that survives both checks means far more than a top ranking in the original comparison alone.
Which markets and timeframes suit this robot?
Neither was specified when the robot was released, so treat both as open questions for testing. Crossover systems generally work best on instruments with sustained trends and on timeframes where spread is small relative to the typical move, often M30 to H4 on the most liquid forex pairs. Lower charts raise the number of trades and cost sensitivity. Run the EA on a few candidate instruments and chart periods, and keep only the combinations that stay acceptable out of sample.
Can I run it alongside other trading bots?
Yes, provided each EA uses a unique magic number so MetaTrader can tell which positions belong to which program. Running several trading bots can smooth overall results when their logic differs, but crossover systems on related markets often signal together, which concentrates risk instead of spreading it. Check combined drawdown and total open exposure in a portfolio backtest before adding this robot to an account that already runs other automated strategies on similar instruments.
Get Help Testing Your Crossover Robot With Algo Trading Space
If you want help verifying this robot’s settings, rebuilding it for MT5, or setting up a fair backtest on your broker’s data, get in touch with the Algo Trading Space team. We can help you test it properly in a demo account first, before any capital is at risk.
Risk warning: Trading forex and CFDs carries a high risk of loss, and leverage can magnify losses beyond your initial deposit. This article is for educational purposes only and is not financial advice. Backtest results are hypothetical and do not guarantee future performance.




Comments
No comments yet. Be the first to comment!
Leave a Comment
Your email address will not be published. Required fields are marked with *