Python Pro
Run the exported Python script on a bar CSV to get a trade list, what it needs, its inputs, and why only a short list of parts is exported.
This feature is part of Pro.
Python exports one script (.py) that needs only pandas and numpy. It backtests the strategy on a bar CSV you give it and writes a trade list. It never places orders and has no live trading. It can export 23 of 119 parts. Getting the source is part of Pro.
Run the script
-
In the Builder toolbar, choose Python.

Python selected in the Builder toolbar. -
Click Download .py. The file is saved as
EA_Builder.py. -
Install Python 3 and the two packages:
pip install pandas numpy. -
Prepare a bar CSV with the columns
time,open,high,low,close.timeis epoch seconds or a date-time text. Other columns are ignored. -
Run
python EA_Builder.py bars.csv. To name the output file, add it:python EA_Builder.py bars.csv trades.csv. The default istrades.csv. -
The script prints one line, for example
trades=120 wins=64 net=312.50 -> trades.csv.
The trade list has the columns entryTime, exitTime, symbol, side, lots, entryPrice, exitPrice, profit and comment. A position still open on the last bar is not reported.
Use bars of the symbol and timeframe named on the Checked under: line at the top of the file. Another timeframe silently changes the strategy.
How the script decides
It looks at each bar once, at the bar close. An entry is filled at the next bar open: a buy at the open plus the spread, a sell at the open. Stop loss and take profit are checked inside every bar from its high and low. If one bar reaches both, a bullish bar is read as low first and a bearish bar as high first. If the bar closes at its open, the stop loss wins.
Inputs
These are constants at the top of the script. Edit them before you run it.
| Setting | What it does | Values |
|---|---|---|
SYMBOL | Only written to the trade list. | Text |
DIGITS | The price digits of the symbol. One point is 10 to the power of minus DIGITS. | Integer, for example 5 or 3 (4 or 2 for quotes in whole pips) |
SPREAD_POINTS | The spread the script charges, in points. Your bar CSV has no spread. | Number, default 10 for currency pairs. Gold, silver and indices have their own defaults. |
CONTRACT_SIZE | Units per lot, used to turn a price move into profit. | Number, default 100000 for currency pairs. Gold, silver and indices have their own values. |
QUOTE_TO_ACCOUNT | One fixed rate from the quote currency to the account currency. | Number, default 1.0 |
SERVER_UTC_OFFSET_HOURS | Only needed if a part uses UTC time. | Number |
What the script does not model
- No commission, no swap and no slippage.
- No gap fill. A stop is filled at its own price even when a bar opens beyond it.
- Profit uses one fixed rate, not the rate at the close date.
- Indicator values are rounded to 6 decimals before every comparison.
Results are an approximation of past data. They do not predict future results.
Why only a short list of parts
Python exports only the parts whose trades were compared against the in-house backtest. A part that has not been compared is not exported, and the export says so. This is why the list is short.
The Python exporter does not cover this part yet (only parts whose trades were checked against the in-house validator are exported)
Python also refuses what other targets refuse for the same reasons: more than one symbol, deciding in the middle of a bar, the measured spread, free margin, hedging and account settings, and a part that reads the forming bar (shift 0). The rows marked Python on Blocks that can’t be exported give each reason.
The parts the Python export takes today:
| Category | Parts |
|---|---|
| Utility | Start |
| Indicators | Moving Average, RSI, Bollinger Bands, MACD, Donchian Channel, Stochastic |
| Price / Info | Current Price, OHLC, Constant |
| Conditions | Compare, Cross, AND Gate, NOT Gate |
| Filters | Time Filter, Position Filter, Session Filter, New Bar Filter |
| Actions | Open Buy, Open Sell |
| Money Mgmt | Fixed Lot |
| Exit Strategy | Take Profit, Stop Loss |
Match status
The header of the .py file reads Match with the platform tester: not verified. A comparison against the in-house backtest exists, and it is described in Match check.
Next steps
- Read Blocks that can’t be exported for the full list.
- Read Match check for the comparison.
- Go back to the Export overview.