Convert · MQL4 and MQL5

Bring your MQL4 and MQL5 scripts. Keep your work.

You have spent years on your MQL4 and MQL5 scripts. You should not have to start again. Paste one in, and AlgoBarsX rewrites it and tells you what it did to every line.

  • $0 a month
  • No card needed
  • Not a trial

A real example.

This is a real run of the importer. The result compiles. It read 11 lines: 6 carried over exactly, 6 were adapted, and 2 came back as choices for you.

You paste this · MQL4
1#property strict
2input int Fast = 20;
3input int Slow = 50;
4input double Lots = 0.10;
5void OnTick()
6{
7double f = iMA(NULL, 0, Fast, 0, MODE_EMA, PRICE_CLOSE, 0);
8double s = iMA(NULL, 0, Slow, 0, MODE_EMA, PRICE_CLOSE, 0);
9if (f > s && OrdersTotal() == 0)
10OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - 250 * Point, Ask + 500 * Point);
11}
You get this · AlgoBarsX
1strategy "Imported expert advisor"
2market: EURUSD
3bars: 1h
4
5input Fast = 20
6input Slow = 50
7input Lots = 0.1 lots
8
9f = ema(close, Fast)
10s = ema(close, Slow)
11
12when f > s and trades.open().len == 0:
13buy size: Lots, stop: close - 250 * market.point_size, target: close + 500 * market.point_size
StatusYour lineWhat happened
Exactinput int Fast = 20 ;an input carried over
Exactinput int Slow = 50 ;an input carried over
Exactinput double Lots = 0.10 ;an input carried over
Adaptedvoid OnTick ( )OnTick became the script body, which runs once per bar; add evaluate: tick to run on every tick
Exactdouble f = iMA ( NULL , 0 , Fast , 0 , MODE_EMAa variable carried over
Exactdouble s = iMA ( NULL , 0 , Slow , 0 , MODE_EMAa variable carried over
Adaptedf > s && OrdersTotal ( ) == 0OrdersTotal() became the number of open trades
Your callSymbol ( )Symbol() has no equivalent yet
AdaptedAskAsk became the close: a backtest here has one price per bar, and live trading uses the right side of the spread
AdaptedAsk - 250 * PointAsk became the close: a backtest here has one price per bar, and live trading uses the right side of the spread
AdaptedAsk + 500 * PointAsk became the close: a backtest here has one price per bar, and live trading uses the right side of the spread
ExactOrderSend ( Symbol ( ) , OP_BUY , Lots , Ask , 3 ,the order carried over with its stop and target
Adaptedif ( f > s && OrdersTotal ( ) == 0 ) OrderSend (a condition that places orders became a rule
Your callthe script headeran expert advisor runs on whatever chart it is attached to, so EURUSD on 1h was filled in: set the ones you want

How the ideas translate.

In MQL4 and MQL5In AlgoBarsX
input int Fast = 20;input Fast = 20
input double Lots = 0.10;input Lots = 0.1 lots
iMA(NULL, 0, Fast, 0, MODE_EMA, PRICE_CLOSE, 0)ema(close, Fast)
OrdersTotal() == 0trades.open().len == 0
OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, sl, tp)buy size: Lots, stop: …, target: …
Pointmarket.point_size
PERIOD_H1, PERIOD_D11h, 1d
void OnTick()the body of the script. Add evaluate: tick to the header if it must run inside the bar.

Stops written as Ask - 250 * Point carry over literally. They read better, and survive gaps better, as distances: stop: 250 points.

How to move a script.

  1. Paste or upload

    Open the Terminal, choose Import, and paste your code or pick the file.

  2. Read every note

    Each line is marked exact, adapted, or your call. Settle every “your call” before you go on.

  3. Read it back, then test

    Check the plain-English description against what your old script did. Then run a test.

What you gain.

It reads itself back

The compiler writes out what the script does in plain English.

Units are real

Percent, pips, R and money are types. Mix-ups are caught before anything runs.

One script everywhere

The same file draws, tests, alerts and trades.

Always read an import before you run it. No converter is perfect, and some shapes of code import better than others. Other platforms leave things unsaid that AlgoBarsX makes you state, such as the market, the bar size and the trade size. Compare the plain-English description with what your old script did, and test before you deploy.

Good questions.

Will every script convert cleanly?

No. Simple, common shapes convert best. An import that does not compile says so, and every changed line carries a note. Always read the result.

Do I lose my original?

No. Your old script is untouched. Lines that needed a choice keep the original as a comment.

Is it free?

AlgoBars is $0 a month with no card. Credits pay for AI, tests and auto trades.

Try it with one script.

Pick a small one. Paste it in. Read what comes back.

Create my free account

$0 a month · No card needed · Not a trial

Trading is risky. You can lose money. It is not right for everyone.