How to export an AlphaPrime strategy to TradeStation, step by step
Open the strategy's source code in the Performance report, export it for TradeStation, import it, set the items the code's header lists, then compare trade lists on the same data before going live.
By Soren Huang · Published · updated · Editorial policy
Contents
To run a strategy from AlphaPrime (Valynox) in TradeStation, export its EasyLanguage source code from the Performance report, import it into TradeStation, set the chart and strategy the way the code's header describes, and compare both trade lists on the same data before you trade it live.
What do you need before you start?
You need a strategy in the AlphaPrime strategy databank, TradeStation installed, and the same market and history you tested on. The trial version can also view and export source code, so you can follow every step before buying.
How do you export the strategy from AlphaPrime?
Export happens in the Performance report, on the strategy's source code tab. The file is saved as
- In the strategy databank, double-click the strategy to open it in the Performance report.
- Open the Strategy source code tab. The left column lists the conditions and parameters; the right column shows the source code.
- Choose TradeStation, then click Export file to save it, or Copy code.
- TradeStation strategies don't need the AlphaPrime library, so there is no extra step.
How do you import it into TradeStation?
Import the strategy, make sure it compiles, then add it to a chart.
- For each function listed, from top to bottom: File → New → Function, use the name exactly as written, choose Template: None, set the Return type and Storage: Auto-detect, paste the code and Verify (F3).
- Then File → New → Strategy, paste the strategy code and Verify (F3). Indicators are optional.
- Insert the strategy into a chart and set MaxBarsBack to an exact number, not Auto-detect.
Which settings must match the backtest?
The header of the exported code lists what the backtest used. Set the same in TradeStation:
- Instrument, bar period and date range
- Initial capital and number of contracts
- Commission per contract per side, and slippage in ticks per side
- Big point value, tick size and an exact MaxBarsBack
- Time zone: Format Symbol → Settings → Time Zone: Exchange; and the trading session
- Any additional data series
- Look-Inside-Bar Back-testing: keep it off
A different time zone or session moves every bar, and missing costs make the platform's results look better than the backtest. Compare against the Strategy Performance Report.
How do you check TradeStation against AlphaPrime before going live?
Run the strategy in TradeStation on the same data and period, then compare its trade list with AlphaPrime's trade list, trade by trade.
- Use the same instrument, bar size and date range as the backtest.
- Compare entry and exit times first: a shift of one bar usually means a time zone or session difference.
- Then compare prices and costs: different fills or missing commission show up here.
- Where they differ, check the data source next: two data feeds can build slightly different bars.
The guide to trading costs in backtests: commission, slippage and the average trade explains why costs matter, and walk-forward analysis covers how a strategy is checked on data it didn't see.
What this means if you use AlphaPrime (Valynox): the exported code is plain text you can read and edit, and the platform export page lists every supported platform.
Frequently asked questions
Do I need to export the library every time?
No. TradeStation strategies don't use the AlphaPrime library at all.
Can I edit the exported code?
Yes. It is plain-text EasyLanguage you can read and change. After an edit, compare the trade list again, because the strategy is no longer the one AlphaPrime tested.
Can the trial version export strategies?
Yes. The trial can view and export source code, so you can try the whole process before buying.
What AlphaPrime does here
AlphaPrime exports strategy source code to MultiCharts, TradingView, TradeStation and NinjaTrader; the platform export page has the list. TradeStation: https://www.tradestation.com/

