Docs menu

Overview Pro

The five export targets of the Strategy Builder, how to export a strategy, the rules every target follows, and the validation settings written at the top of each file.

This feature is part of Pro.

The Strategy Builder turns the flow on the canvas into source code. It writes 5 kinds of file. Getting the source is part of Pro.

  • You build and compile the file yourself, in the platform’s own tool. The Builder does not compile anything for you.
  • The same strategy gives approximate results in every target, not identical ones. Each platform has its own price history, spread and fill rules.
  • This page describes how the software works. It is not investment advice, and past results do not guarantee future results.

Export targets

Each target has its own page with the steps for that platform.

TargetFileParts it can exportCannot export
MetaTrader 5.mq5119 of 119Nothing is blocked.
MetaTrader 4.mq4119 of 119a strategy that uses more than one symbol.
TradingView Pine.pine107 of 119a strategy that uses more than one symbol; deciding inside a bar (entry timing other than "Bar close", and the parts that need it); external indicators (iCustom); the measured spread; free margin; hedging and account-restriction settings; reading the forming bar (Shift 0).
cTrader.cs106 of 119a strategy that uses more than one symbol; deciding inside a bar (entry timing other than "Bar close", and the parts that need it); external indicators (iCustom); hedging and account-restriction settings; reading another timeframe; Parabolic SAR; some instruments (gold, silver, oil, stock indices).
Python.py23 of 119Everything outside the short list of parts that were checked (see the Python page). Also: a strategy that uses more than one symbol; deciding inside a bar (entry timing other than "Bar close", and the parts that need it); external indicators (iCustom); the measured spread; free margin; hedging and account-restriction settings; reading the forming bar (Shift 0); alerts.

“Parts it can export” counts the parts with their settings at the defaults. Some settings of a part can still block an export, for example a Shift of 0. Blocks that can’t be exported lists every case with the reason.

  • MetaTrader 5 is the reference target. It exports all 119 parts.
  • MetaTrader 4 exports all 119 parts, for a single symbol.
  • TradingView Pine writes a Pine Script v6 strategy.
  • cTrader writes a C# cBot.
  • Python writes a script that reads a bar CSV and writes a trade list. It never places orders.

Export a strategy

  1. Open the strategy in the Strategy Builder. To start from a Miner result, follow the Quickstart.

  2. In the toolbar, choose a target among the export buttons: MT5 (MQL5), MT4 (MQL4), TradingView (Pine), cTrader (C#) or Python. The Builder remembers your choice in this browser. On very wide screens (2440 px or more) a short note next to the download button says what to do with that kind of file; on other screens the note is hidden, so follow the steps for your target below.

    The export buttons in the Builder toolbar: MT5 (MQL5), MT4 (MQL4), TradingView (Pine), cTrader (C#) and Python, with MT5 selected
    Choose the target in the Builder toolbar. The selected button is highlighted.
  3. Click the download button. Its label shows the file extension, for example Download .mq5.

  4. The Builder saves the file as EA_Builder plus the extension, for example EA_Builder.pine. For MetaTrader 5 it also shows the steps to compile and install the file.

  5. Open the file in the platform’s tool. The target pages above give the steps.

Without a signed-in Pro account, the Builder shows a Pro prompt and saves no source.

If the strategy has a part that the chosen target cannot export, the Builder saves no file. It shows the panel These parts cannot be exported to the selected target:, lists each part with the reason and marks the part on the canvas. Nothing is left out silently. See Blocks that can’t be exported.

The same rules on every target

These rules hold for all 5 targets.

  • A strategy decides when a bar has closed. It looks at the last closed bar, and the order is filled at the open of the next bar.
  • Stop loss and take profit can hit inside a bar. Once placed, they work on the bar’s high and low, not only at the close. Limit and stop orders work the same way.
  • Parts that decide in the middle of a bar are for MetaTrader only. These are the parts that act on every tick. The entry timing options Every tick and On touch are in this group. The other targets only support Bar close.
  • The last closed bar is “Shift 1”. A part that reads the forming bar (Shift 0) is blocked on TradingView Pine and Python.
  • A blocked part is never dropped. The export is refused, with the reason.

What a platform does with spread, commission, swap, gaps and currency conversion differs by platform. Each target page lists the differences from MetaTrader 5.

The validation settings at the top of the file

Every exported file starts with a comment block headed VALIDATION SETTINGS. It says what the strategy was checked under and what the export does with each setting.

LineWhat it says
Checked under:The symbol, the timeframe and the period (or the number of years) of the check. It adds account costs: off if the check ran without account costs.
Match with the platform tester: not verifiedWhether the file’s trades were matched against the platform’s own tester. Every file says “not verified” today. See Match check.
One line per settingThe setting, a status word in brackets, the recorded value if there is one, and what the export does with it.
validation-json:The same information as one line of JSON, for tools.

A strategy opened from the Miner carries the settings it was checked under. If you change the strategy in the Builder afterwards, the Checked under: line says it was edited after validation and shows no values. If the strategy never came from the Miner, the line says the settings are not recorded. A strategy checked on your own imported CSV says so on a Bar data: line.

The status word is one of three:

  • EXPORTED means the setting is written into the code.
  • VALIDATION-ONLY means the check used it, but the code does not carry it. You have to set it on the platform, or the platform applies its own value.
  • NOT-EXPRESSIBLE means the target cannot express it at all.

The settings are the same in every file. What the export does with each one depends on the target.

SettingWhat the export does
symbol / timeframeNot written. Attach, apply or run the file on the symbol and timeframe it was checked under.
test periodNot written. The code has no date range. A Python script runs on every bar of the CSV you give it.
spreadMetaTrader and cTrader trade at the live spread. Pine cannot express it. The Python script has a SPREAD_POINTS input.
commissionNot carried by the code. MetaTrader and cTrader leave it to the account. Pine is written with 0, so set it in Strategy Properties. The Python script charges none.
swapThe platform charges it. Pine and Python do not model it.
entry sessionWritten only if the strategy has its own time filter part.
minimum stop distanceNot written. MetaTrader reads the broker’s stop level when it sends an order and moves SL and TP out if needed. The cTrader code does not adjust them. Pine and Python cannot express it.
SL slippageNot set from the checked value. The platform or the code uses its own setting.
fill at the open after a gapThe platform applies its own rule. The Python script fills a stop at its own price.
Friday closeWritten only if the strategy has a Time Exit (Friday close) part.
currency conversion at closeThe platform applies its own rate. The Python script uses one fixed rate.
order fillMetaTrader 5 uses the symbol’s fill mode. MetaTrader 4 has no such setting, so the broker’s policy applies. The other targets decide at the bar close and fill at the next bar open.

Next steps