AlgoPuzzle Open the Builder

Import a strategy

Bring an Expert Advisor or cBot you already have into AlgoPuzzle as normal blocks, so you can read it, change it, backtest it and export it again.

Last updated

In short

Import in the builder header reads a strategy built elsewhere and puts it on the canvas as AlgoPuzzle blocks. It accepts MetaTrader 5 (.mq5) and MetaTrader 4 (.mq4) source files, cTrader code (.cs) or pasted code, up to 512 KB, and needs a free account. An import report then marks every part of the original as Imported exactly, Imported with a difference, Not imported or Not needed. Strategies that could not be read exactly are marked Read by AI - check the blocks. Always check the blocks and run a backtest before you export.

What can be imported

SourceHow
MetaTrader 5 Expert AdvisorThe .mq5 source file
MetaTrader 4 Expert AdvisorThe .mq4 source file
cTrader cBotThe .cs source file, or the code pasted in
Any of the above as textPasted into Or paste the code

Typical sources are strategies made with other builders that export MQL code, such as fxDreema, EA Builder, StrategyQuant (code export) or the MQL5 Wizard, and hand-written MQL4, MQL5 or cTrader code. Simple strategies exported from fxDreema can usually be imported exactly; other code is read by AI, which takes up to a minute per file and is limited to a few files per account per day.

  • Size: files up to 512 KB. A larger file gets the message "The file is larger than 512 KB - export just the strategy's source code."
  • Compiled files (.ex4, .ex5, .algo) cannot be read. Export the source code from your builder or platform instead.
  • Account: importing needs a free AlgoPuzzle account (email and password, no card).
  • Privacy: the file is read once to build the blocks and is not stored. Only import strategies you have the right to use.

How to import

  1. Click Import in the builder header. If you are not logged in, the log-in window opens first; after you log in the import continues.
  2. In Import a strategy, click Choose a file or drop it here and pick your file, or drag it onto that area. To paste code instead, open Or paste the code and paste the strategy's source.
  3. Click Read strategy. You see Reading your strategy... while it works; files read by AI take up to a minute.
  4. Read the import report (see below). If the original traded the chart it was attached to, choose the Symbol and Timeframe it should use.
  5. Click Put on canvas. If the canvas holds unsaved work, the builder asks before replacing it, so save it first if you want to keep it. Back returns to the file step.
  6. The strategy appears as blocks, with the message Check the blocks, then run a backtest.
The AlgoPuzzle Log in window with email and password fields and the links Need an account? Sign up and Forgot password?
Import needs a free account. If you are logged out, this window opens first.

Picking the symbol and timeframe

Many Expert Advisors, including those from fxDreema, trade whichever chart they are attached to. An AlgoPuzzle rule always names its own asset and timeframe, so in that case the report shows "The original traded the chart it was attached to. Which market and timeframe should it use?". Type the Symbol (for example EURUSD, or the exact name your broker uses) and pick a Timeframe from M1 to W1. You can change both later on the Strategy rule.

The import report

Before anything goes on the canvas, the report shows the strategy's name, how it was read, the number of rules, and every part of the original with a status:

StatusMeaningWhat to do
Imported exactlyRebuilt with blocks that do the same thing.Nothing, but a quick look does not hurt.
Imported with a differenceMapped as closely as possible; a note says what differs.Read the note and decide whether the difference matters for your strategy.
Not importedIt affected trading in the original but has no AlgoPuzzle equivalent, so it was left out. Results will differ.Decide whether the strategy still makes sense without it, or rebuild that part with other blocks.
Not neededNo effect on trading, such as drawing on the chart, comments or alerts.Nothing.

When anything is Not imported, the report also shows "Imported with differences.": backtests and live trading will not match the original exactly. The Imported exactly and Not needed groups are folded; click them to see their items.

Exact import or Read by AI

At the top of the report a label tells you how the strategy was read:

  • Exact import: the strategy was rebuilt directly from its definition.
  • Read by AI - check the blocks: the code was interpreted automatically. The result is usually close, but details such as a period, a comparison direction or which candle is read can be wrong. Compare every block with the original before you rely on it.

After the import

The imported strategy is an ordinary AlgoPuzzle strategy: every block can be edited, and nothing links it to the original file any more.

  1. Check the blocks. Go through each rule: asset, timeframe, the IF condition, the trade and its lot, stop loss and take profit, and CLOSE IF. See Strategy rules, Conditions and Trades, stops and lot size.
  2. Save it with Save, so you can find it later in My Strategies.
  3. Backtest it. Switch to Backtest and test it on a period you know the original's results for. See Running a backtest.
  4. Export it to MetaTrader 5, MetaTrader 4 or cTrader and compare it with the original in the Strategy Tester. See Export to MT5, MT4 and cTrader.

Tip.Exporting an imported strategy produces AlgoPuzzle's own code, not the original file. That is useful when you want to move a MetaTrader 4 strategy to MetaTrader 5 or cTrader, but compare the two in the Strategy Tester and on a demo account before switching.

If the import fails

  • "Compiled files cannot be read": you picked an .ex4, .ex5 or similar file. Export the source code instead.
  • "Can't reach AlgoPuzzle": check your internet connection and try again.
  • Another message: the dialog says why the file could not be imported. Try pasting only the strategy's own code, or email the file's source and the message to support.
  • The builder cannot draw the strategy: the canvas stays unchanged and a message explains why.

Risk notice.An imported strategy can behave differently from the original. Backtest results are hypothetical; test on a demo account before trading real money. See the risk disclosure.

Frequently asked questions

Which files can I import?

Expert Advisor source code for MetaTrader 5 (.mq5) or MetaTrader 4 (.mq4), cTrader cBot code (.cs), or code pasted into the dialog. Files can be up to 512 KB. Compiled files (.ex4, .ex5, .algo) cannot be read; export the source code from your builder instead.

Do I need an account to import?

Yes, a free AlgoPuzzle account (email and password, no card). If you are not logged in, Import opens the log-in window first and continues after you log in.

What does Read by AI - check the blocks mean?

The file could not be read exactly, so its logic was interpreted automatically. The result is usually close, but it can be wrong in details. Compare every block with the original strategy before you trust a backtest of it.

What does Not imported mean in the report?

That part of the original affects trading but has no AlgoPuzzle block yet, so it was left out. Backtests and live trading of the imported strategy will not match the original. The report lists what is missing so you can decide whether that is acceptable.

Why am I asked to pick a symbol and timeframe?

Some strategies trade whatever chart they are attached to. An AlgoPuzzle rule always names its asset and timeframe, so you choose them during the import. You can change them later on the rule.

Is my file stored?

No. The file is read once to build the blocks and is not stored. Only import strategies you have the right to use.

Can't find what you need? Email support@algopuzzle.com.