MetaTrader 5 export
Turn your strategy into an MT5 Expert Advisor
LONA translates your Python strategy into MQL5, compiles it with MetaTrader 5's MetaEditor and gives you a ZIP with the .mq5 source and the compiled .ex5.
lona_export_strategy({ strategy_id })
{ "id": "…" }
lona_get_export({ id })
"status": "pending"
lona_get_export({ id })
"status": "completed", "download_url": "https://…"
<strategy-id>.mq5
MQL5 source of the Expert Advisor, readable and editable in MetaEditor
<strategy-id>.ex5
Compiled Expert Advisor, ready for MetaTrader 5
Copy both files into MQL5/Experts in your MetaTrader 5 data folder.
How it works
- 1
Export your strategy
Click Export on a saved strategy in the app, or ask your agent to export it. Available on Pro and above.
- 2
LONA builds the Expert Advisor
LONA turns your strategy into MQL5 code and compiles it with MetaTrader 5's own compiler, so the file is ready to run.
- 3
Install it in MetaTrader 5
Download the ZIP, copy both files into the MQL5/Experts folder of MetaTrader 5, then test it in the Strategy Tester before you trade.
What you get
Source and binary
The ZIP holds the readable .mq5 next to the .ex5, so you can review the generated code or change it in MetaEditor and compile it yourself.
Backtrader timing kept
The translation is told to decide on closed bars and act on the first tick of the next bar, as Backtrader does, to convert unit sizes to lots on the symbol's volume step and to keep pending, OCO and bracket orders.
Failures you can read
A failed export says whether translation, compilation or the worker failed. Compile failures keep the compiler log, and a new export replaces the failed one.
[ FAQ ]
Questions
More LONA features
Backtesting
Backtest Python trading strategies on 80,000+ symbols from Claude, ChatGPT, Codex or the LONA app. Trades, equity curve and every metric in one report.
Parameter optimization
Sweep one or two strategy parameters over a grid and compare every combination in a table and a 2D or 3D chart. Run 1,000 backtests in under 30 seconds.
Walk-forward analysis
Re-optimize a strategy on rolling or anchored in-sample windows, then test it on unseen out-of-sample data. Get stitched equity and walk-forward efficiency.
Day and time optimization
Find the weekdays or UTC hours that hurt your strategy. LONA backtests it with new entries blocked on one day or time slot at a time and compares the results.