Skip to main content
Cart Log in Sign up
Expert advisor

Adjustable MA: test bench for two-MA crossovers

A simple MT4 and MT5 expert advisor that trades the crossover of two moving averages with every part adjustable; a tool for backtesting and learning, not for profit.

Platform

License

Price

≈

Version

You own this product. Go to My products
Get the demo

  • Automatic, instant delivery once payment confirms
  • Free updates for every future version
  • 12 months of technical support
  • Refunds under a transparent policy
  • Pay with USDT, BTC, ETH and more
  • Free: no payment, download it right now

Risk warning: Trading financial markets carries a risk of losing capital, and past performance does not guarantee future results. Terms & conditions

Product type
Expert advisor
Platforms
MT4 · MT5
Market / symbol
Gold, FX majors, FX minors
Experience level
Beginner
Delivery
File download from your dashboard
Last update
November 30, 2026
Broker
Any broker

Overview

The two moving average crossover is usually the first strategy a trader learns. Adjustable MA runs exactly that, with no extra filters, so you can change the periods, MA type, stop and trading hours and see in the tester what happens.

The original author states plainly that this EA is not profitable and should be used on a demo account only. We publish it in the same spirit: a free, open strategy to study and test. A good result over one backtest period guarantees nothing about the future, and running it on a live account carries a real risk of losing money.

  • Trades the cross of two MAs with your choice of period, method and applied price
  • Minimum-gap filter between the MAs to cut down false crosses
  • Optional stop-loss, take-profit and trailing stop
  • Trading limited to chosen hours and weekdays
  • Direction choice: long only, short only or both
  • On-chart status text with DisplayStatusComment

It is a good starting point if you are new to the MetaTrader Strategy Tester, or want to see how a plain trend system behaves in a ranging market.

Source and licence

This tool is the open-source project Adjustable MA by EarnForex.com, released under the Apache 2.0 licence. The source code is included in the download unchanged, with the licence text next to it. TradeKit provides the description, install guide and support. Original repository: github.com/EarnForex/Adjustable-MA

Strategy logic

Detecting a cross

  • The EA decides only when a new candle opens and reads both MAs on the last closed candle.
  • Of Period_1 and Period_2, the smaller is the fast MA and the larger the slow MA.
  • The state is bullish when the fast MA is at least MinDiff points above the slow MA, and bearish in the opposite case.
  • A cross is recorded when the state flips from bullish to bearish or back.

Entry and exit

  • On a bullish cross the existing sell is closed and a buy is opened; on a bearish cross the reverse.
  • With default settings stop-loss and take-profit are zero, so a trade closes only on the opposite cross and the EA is in the market almost all the time.
  • If you set StopLoss, TakeProfit or TrailingStop, they apply to every trade.
  • Trailing begins once profit reaches TrailingStopTriggerProfit; if that is zero, once profit equals the TrailingStop distance itself.

Time filter

No new trade is opened outside the allowed hours and weekdays. CloseTradesOutsideTradingTime decides whether an opposite cross still closes the open trade in those hours, and DoTrailingOutsideTradingTime whether trailing continues.

Position size

By default the size is the fixed Lots. With UseMM it is derived from free margin and has nothing to do with the stop distance.

Specifications

Requirements

  • MetaTrader 4 or MetaTrader 5
  • Runs on any symbol and timeframe; the two periods must differ
  • Recommended for backtesting and demo accounts only
  • MinDiff and Slippage defaults differ between MT4 and MT5; align them before comparing results
Platforms
MT4MT5
Delivery
Use case
Trend following
Market
Gold، FX majors، FX minors
Experience level
Beginner

Compatible brokers

Which brokers this product works with, and which it works best with.

Works with every broker

No broker restriction: it works with any broker that offers the product's platform.

The broker choice is yours; TradeKit is not a broker. Check account terms before depositing. All brokers

Input parameters

Input parameters
ParameterDefaultDescription
Period_1Period of the first moving average 20 Period of the first moving average
Period_2Period of the second moving average; the smaller of the two is the fast MA, the larger the slow MA 22 Period of the second moving average; the smaller of the two is the fast MA, the larger the slow MA
MA_Method_FastType of the fast MA (SMA, EMA, SMMA or LWMA); the slow one is set with MA_Method_Slow MODE_EMA Type of the fast MA (SMA, EMA, SMMA or LWMA); the slow one is set with MA_Method_Slow
MinDiffMinimum gap between the two MAs, in points, for a cross to count (default 3 in MT5, 30 in MT4) 3 Minimum gap between the two MAs, in points, for a cross to count (default 3 in MT5, 30 in MT4)
StopLossStop-loss in points; 0 means no stop-loss 0 Stop-loss in points; 0 means no stop-loss
TakeProfitTake-profit in points; 0 means no take-profit 0 Take-profit in points; 0 means no take-profit
TrailingStopTrailing stop distance in points; 0 turns it off 0 Trailing stop distance in points; 0 turns it off
TradeDirectionAllowed direction: long only, short only, both, or none (closing and trailing only) TRADE_DIRECTION_BOTH Allowed direction: long only, short only, both, or none (closing and trailing only)
StartHourStart hour of the trading window in server time; used with StartMinute, EndHour and EndMinute 0 Start hour of the trading window in server time; used with StartMinute, EndHour and EndMinute
CloseTradesOutsideTradingTimeClose the open trade on an opposite cross even outside the trading window true Close the open trade on an opposite cross even outside the trading window
LotsFixed lot size when UseMM is off 0.1 Fixed lot size when UseMM is off
UseMMSize from free margin: LotsPer10000 lots for every 10,000 of free margin false Size from free margin: LotsPer10000 lots for every 10,000 of free margin

Install guide

  1. Unzip the download. It contains an MQL4 or MQL5 folder.
  2. In MetaTrader choose File › Open Data Folder and copy the folder’s contents into the folder of the same name.
  3. Restart the terminal, or right-click in Navigator and choose Refresh. The source compiles on its own.
  4. To backtest, open the Strategy Tester and pick Adjustable_MA from the expert list.
  5. To run it on a demo chart, turn on Algo Trading (AutoTrading in MT4) and drag the EA from Expert Advisors onto the chart.

Changelog

  1. v1.08 MT4 New November 30, 2026
    • Published on TradeKit
  2. v1.08 MT5 November 30, 2026
    • Published on TradeKit

Buyer reviews

No reviews yet.

Only verified buyers can review. Reviews are moderated before publishing.

Only verified buyers can review. Reviews are moderated before publishing.

Sign in to write a review

FAQ

Is this EA profitable?
Its author says no, and we make no claim either. A plain MA crossover does well in trends and poorly in ranges. This tool lets you see that for yourself in the tester.
Why is there no stop-loss by default?
StopLoss defaults to zero and a trade closes only on the opposite cross. If you run it on demo, set a stop so each trade has a capped loss.
Why does the same setup give different results in MT4 and MT5?
MinDiff defaults to 30 points in MT4 and 3 in MT5, and Slippage differs the same way. The two platforms also use different price data.
Does UseMM size trades by risk?
No. It divides free margin by 10,000 and multiplies by LotsPer10000. The stop distance plays no part, so the percentage risked per trade is not constant.
Can I use it only to manage open trades?
With TradeDirection set to None the EA opens nothing new and only closes on an opposite cross and trails its own trades (same Magic number).

Related products

More Expert advisors and tools from the same family

Compare Compare now