Export to TradeStation
Use your GSB systems on the TradeStation platform: export, check, simulate, go live and monitor
Prefer to watch? This page has video lessons
Module 6: Going Live · Training Hub · free with a GSB Pro account
- A system in GSB that you've chosen and walked forward (see Selecting Systems and Walk-Forward Optimization)
- The GSB functions loaded into TradeStation (see Loading GSB Functions)
- TradeStation with the Development Environment, and data for the market you built on
- A simulated (paper) trading account in TradeStation for the testing period
Everything here is general education, not trading advice.
The deployment path
This page follows the same steps as Module 6 of the course (lessons 23 and 24):
- Load GSB's functions into TradeStation
- Copy the system's script from GSB
- Paste and verify it, and set up a chart that matches the data you built on
- Reconcile: make sure TradeStation's backtest matches GSB
- Trade it in simulation first, then go live small, then monitor it
Step 0: Choose a system worth deploying
Be selective before you export anything. Trademaid's advice, as in lesson 23:
- First find the setup (session time, entry mode and secondary filter) with the best out-of-sample statistics.
- Then look at the top system of the first few families. Trademaid's help typically uses the family with the most members and the highest average fitness.
- Walk each candidate forward. The brown out-of-sample curve must hold up against the other curves.
- If your build had no slippage or commission, remember a flat-looking curve only gets flatter once you add them.
Step 1: Load the GSB functions (once)
In GSB click File → Supplementary Scripts (TS & MC), then load the newest .ELD file into TradeStation: double-click it, or use File → Import in the TradeStation Development Environment. Every click, with screenshots, is on Loading GSB Functions. If you've already done this and haven't updated GSB since, skip to Step 2.
Current function files are named GSB_ALL_FUNCTIONS_YYYY_MM_DD.ELD (sometimes with _2 and so on at the end). The file must be at least as new as your GSB build, so load the new one after every GSB update. From build 76.35 (August 2026) GSB can also export the .ELD file itself, which removes the need to import the supplied one.
Step 2: Copy the system's script from GSB
- Select the system in the results grid, for example on the Walk-Forward tab in the lower window.
- Click the Scripts tab in the upper window. (Older builds call it Script (TS & MC) or TradeStation Script.)
- Open the drop-down at the top and choose the TradeStation entry for your system, for example
@ESD30 TradeStation. - If you've walked the system forward, choose the entry ending in
/ WF, for example@ESD30 TradeStation / WF. It holds the walk-forward settings, which Trademaid says should be better than the original optimisation settings. - Right-click in the script and choose Copy to Clipboard. The code is now ready to paste.

1 select the system, 2 click Scripts, 3 choose the TradeStation entry (/ WF after a walk-forward), 4 right-click → Copy to Clipboard (GSB 1.0.54)
In Trademaid's newer worked example (2020) the drop-down entry reads CL15.30 (TradeStation - LiveTrading), and the right-click menu offers Copy for match check (Ctrl+M), Copy for live trading (Ctrl+L) and Copy Selected. Trademaid uses Copy for live trading. The header then includes // Script Mode: LiveTrading.
The two copy options do different jobs:
- Copy for match check is for reconciling (Step 7). Put it on the same TradeStation chart and its trades should match GSB's at least 99%. If they don't, the cause is usually the set-up, different data, or an indicator that doesn't match.
- Copy for live trading is the code you trade. Its trades won't exactly equal GSB's report, because the live code can add trades the backtest doesn't take. Don't use the match-check code for live trading.
- After a GSB walk-forward, Peter Zwag (GSB's developer) always trades the
/ WFentry, with Use WF Current Params, so the code carries the latest walk-forward parameters.
Read the script header before you paste
The comment lines at the top of the code (starting //) record the system's settings. Several of them tell you exactly what to set in TradeStation:
| Header line | What it means | Where it goes in TradeStation |
|---|---|---|
// ID: | The system's ID in GSB | Note it down. It tells you which GSB system this strategy is when you compare results later |
// Price Data: | The data file(s) and bar sizes the system was built on, e.g. Data1 15-minute and Data2 30-minute, and the session | Your chart: same symbol, bar intervals, session and time zone (Step 5) |
// MaxBarsBack: 500 | How many bars the code needs before it can trade | Strategy Properties: Maximum number of bars study will reference = 500 (Step 6) |
// Quantity: 1 | Contracts or shares per trade in the build | Trade size in Strategy Properties. Trademaid's screenshot shows Fixed Shares/Contracts/Units = 1 |
// Trading Dates: | The date range the build used | Use the same dates when you compare TradeStation's report with GSB (Step 7) |
// Commission:, // Slippage: | The costs used in the build | Commission and Position Slippage in Strategy Properties (Step 6) |
Step 3: Create a strategy and paste the code
- Open the TradeStation Development Environment.
- Create a new Strategy (not an indicator or function). Give it a name you'll recognise. Trademaid's example is
GSB_CL1_May_Demo. - If the new strategy already contains any text, delete it. Then paste the GSB code (Ctrl+V).
- The title bar and tab now show your strategy name followed by : Strategy.
Always paste into a new strategy. Don't paste new code over a strategy that's already on a chart: TradeStation keeps the old input values, so the chart quietly runs a mix of old and new settings. GSB writes its settings as vars: rather than inputs: to stop this happening. Change vars: to inputs: only if you want to optimise the system in TradeStation.
Optional: add string StrategyName("GSB_ES3") as the first input (using your own name). TradeManager then shows which system each order or position belongs to.

The GSB code pasted into a TradeStation Strategy. The header shows the ID, price data and MaxBarsBack: 500
Step 4: Verify the strategy
- Click the Verify icon (the tick, or check, icon on the Development Environment toolbar).
- Wait for it to finish. It must verify with no errors.
- If it complains about a
GSB_function, the GSB functions aren't loaded or are out of date. Go back to Loading GSB Functions, import the newest ELD and verify again.
Step 5: Set up a chart that matches your GSB data
The chart must use the same data as your GSB build, or the results won't reconcile. Open a new chart, then open the symbol settings (Trademaid's screenshots show the Customize Symbol window; the chart's right-click Data menu has Edit Symbol... and Add Symbol...). Use the script header's // Price Data: line as your guide. Trademaid's crude oil example:
| Setting | Set it to | Trademaid's example |
|---|---|---|
| Symbol | The same market you built on | @CL |
| Interval | The same bar size as Data1 in the script header | 15 Minute Bar |
| Second data series (if the header lists Data2) | Add it with the same symbol or index and its own bar size | @CL, 30 Minute Bar |
| Range: First Date / Last Date | Cover at least the dates GSB used, plus more than 500 bars before the first trade you compare. Nothing is calculated until 500 bars have loaded | First Date 01/01/2000, Last Date 05/25/2020 |
| Apply time-based Range setting to all data series | Ticked, so Data1 and Data2 cover the same dates | Ticked |
| For volume | Tick Count (up plus down volume) when you export data and on the chart. Either way, the chart must match the export | The old crude oil screenshots show Trade Vol, which gives up-volume only. Peter now recommends Tick Count (see note below) |
| Session (Properties → Session → Use custom session(s)) | A session template matching the session in the script header | Template 0900_1430 for a session ending 14:30 |
| Time Zone | The same time zone as the time stamps in your GSB data | Exchange, because the example data was exported on exchange time (..._ExchangeTime_...txt) |
Time zone, in plain English. Trademaid's general advice is to keep TradeStation charts on local time, because data exported from TradeStation is always in your computer's local time, and GSB's session times (such as the market-on-close time) are in the time of your data. Some of Trademaid's later examples use exchange time instead, so the data matches for users who aren't on Central US time. Either way, the rule is the same: the chart's time zone must match the time stamps in the data you built on.
Session times. TradeStation session times are always in exchange time, even if the chart is on local time. In Trademaid's example the session ends at 3:00 pm Central US time, not 3:15 pm.
Custom sessions aren't saved in a workspace. A TradeStation workspace remembers which session template a chart uses, but not the template itself. Before you open a workspace someone else has given you (or one from another PC), create the custom session it needs, with the same name (for example 0900_1430), then check every data stream on the chart uses it. Peter has given this advice to buyers since 2018.
GSB's code doesn't adjust for time zones. The code GSB generates assumes the chart's times match your build data; it doesn't detect the time zone itself (Peter, 2022). Two consequences:
- Never enter on the last bar of the session, and always be out by the end of it. Peter's own approach (2022) leans on the
SessionEndTime(0, 1)exit shown in Step 8 rather than fixed clock times. If you change the code this way, backtest it before and after to check the results are the same. - Trading from Australia or Asia. A US trading day can span two local dates, which causes hard-to-find errors. Peter's fix is to run the chart on exchange time, or set the trading PC's clock to US Central time.
Volume: use Tick Count. TradeStation and GSB both default to plain volume, which is up-volume only. Peter Zwag (GSB's developer) recommends exporting the data, and setting the chart, to Tick Count (up plus down volume). Older guides, including the crude oil screenshots here, show Trade Vol. If the export and the chart differ, indicators that use volume (such as AccumDist, common in Nasdaq systems) won't match between GSB and TradeStation. Whatever you choose, the chart must use the same setting as the data you built on.
One chart for all data streams. If the system uses Data2 (or more), put every stream on the same chart as the strategy.
Step 6: Insert the strategy and set its properties
- Right-click the chart and choose
Studies → Add Strategy... - In the Add Strategies window, click your strategy (e.g.
GSB_CL1_May_Demo) and click OK. - In the Customize Studies & Strategies window, on Strategies, check your strategy's Status is On, then click Properties for All... (To come back here later: right-click the chart →
Studies → Edit Strategies...) - On the General tab of Strategy Properties for All Strategies on this Chart, set:
| Setting | Use this | Why |
|---|---|---|
| Maximum number of bars study will reference | Exactly 500 | It must equal the MaxBarsBack line in the script header (500 unless you changed it in GSB). GSB's code stops with an error if it's any other number, even 501 |
| Commission | $ per Trade, the same amount as GSB for the reconcile check | Trademaid's example uses $2.40 per trade. Afterwards, also check the report with your real broker costs |
| Position Slippage | The same slippage as GSB | If GSB had none, TradeStation should have none for the reconcile check. Real slippage will still cost you |
| Trade size | The same quantity as the script header | Trademaid's screenshot: Fixed Shares/Contracts/Units = 1 |
| Initial capital | Leave, or set your own | TradeStation notes Initial Capital and Interest Rate are only used in the Strategy Performance Report |
| Use Look-Inside-Bar Back-testing | Leave unticked | Unticked in Trademaid's screenshot |
- Click OK, then OK again. The backtest trades now appear on the chart.
- Leave the Automation boxes at the bottom of Customize Studies & Strategies unticked for now (Generate strategy orders for display in TradeManager's Strategy Orders tab and Automate execution using ... account). You'll come back to them in Step 8.
1. The strategy setting: exactly 500. Maximum number of bars study will reference (Properties for All → General) must equal the MaxBarsBack: 500 line in the script header. GSB's code checks it on the first bar and stops if it's anything else, even 501. TradeStation's default is 50. It's set per chart, so check it every time (TradeStation help).
2. The chart's data: more than 500 bars. The chart has to load more bars than the strategy references. Nothing is calculated until 500 bars have loaded, so the first trade can't come earlier than that. For backtests and reconciling, load the GSB dates plus a few months extra. For live charts, Trademaid's TradeStation best-practice page suggests setting the data range by number of bars rather than by date, a little over 500 (its screenshot uses 550), or 1 to 2 years. Too few bars can change the trades, so check the trades still match after you shorten it.
Custom indicators: the bars back in GSB's settings and in your custom indicator must be the same. The old default was 501; since GSB 32.4 (August 2017) it's 500. If they differ, the indicator won't work.
The error messages and their fixes are in the Troubleshooting Centre.
Step 7: Reconcile: does TradeStation match GSB?
- Right-click the chart and choose
Data → Strategy Performance Report(Shift+Alt+P). - Over exactly the same dates as GSB, compare net profit, drawdown and the number of trades with GSB's Performance tab.
- For a closer look, compare trade by trade with GSB's Trades and Graphs tabs.
- Small differences are normal. Big ones mean something in the set-up is different, so don't go further until you've found it.
How close is close enough? Using the Copy for match check code, Peter Zwag expects about 98–99% or more of trades to match. Below that, look for a set-up difference before you go further.
Matching someone else's chart. When you compare your TradeStation results with a system supplied to you, or with another PC, expect a little more drift: Peter (2020) put about 1–5% of trades, often a couple of recent ones, down to the data cache, different TradeStation data servers and back-adjusted rollovers. Use the yearly breakdown in the performance report to see where the results part ways. Hundreds of missing or extra trades almost always mean the session or time zone is wrong.
MatchCheck (2026 builds). Newer GSB builds have a Match-Check button in Tester Settings. It compares GSB's own backtest with the code it generates for TradeStation and lists the worst mismatches first, with the likely cause. Tiny rounding differences are ignored. If your build has it, run it before you reconcile by hand.
- Market-on-close exits not happening? The time zone of the data doesn't match the chart. Recheck the time zone and session (Step 5).
- Refreshing the strategy: don't use the chart's Reload to refresh a GSB strategy. Turn its Status off and back on in
Studies → Edit Strategies...instead.
- Bars back (Maximum number of bars study will reference) is exactly 500, and the chart loads more than 500 bars before the first trade
- The price data: build GSB systems on data from the platform you'll trade, because prices differ between platforms, even for the same market and timeframe
- The bar interval(s), session times and time zone match your GSB data
- The volume setting matches the one you exported with
- Slippage and commission match your GSB settings
- You've loaded the latest GSB functions (ELD)
- You pasted the right script (the right system ID, and the / WF version if you walked it forward)
Step 8: Trade it in simulation first
Only when the backtest reconciles should you think about going live, and even then, paper trade in simulation first. Simulate for at least two weeks (our guideline, lesson 23). Longer is fine.
- Apply the strategy to a chart that's connected to TradeStation's simulated trading account, not your live account.
- In Customize Studies & Strategies, tick the Automation options and check the account number shown in Automate execution using ... account is the simulated one.
- Each day, check the simulated orders and fills match the trades the strategy shows on the chart.
- If your system exits at the session close, watch those exits closely. Trademaid notes that
SetExitOnClose, which EasyLanguage uses for end-of-day exits, may not work when live trading a TradeStation or MultiCharts brokerage account.
The fix for end-of-day exits. On TradeStation 10, SetExitOnClose fails live unless the session uses the market's standard close. A custom session (for example DAX closing at 15:00 Central) won't trigger it. Use an explicit time exit instead:
vars: eod(0);
once eod = SessionEndTime(0, 1);
if Time = eod and CurrentContracts > 0 then begin
Sell ("LX_EOD") this bar at close;
Buy to Cover ("SX_EOD") this bar at close;
end;Peter also suggests a limit exit that stays open for up to 60 seconds, rather than a market order at exactly 15:00:00. You don't need any of this if you trade through Trademaid's Automation for TradeStation. Holidays, half days, rollovers and keeping TradeStation stable are covered in Live Trading Operations.
Step 9: Go live, small
- Switch the automation account to your live account only after the simulation period has gone as expected.
- Start small and don't over-leverage. Peter Zwag's observation is that traders who over-leverage do not survive. In one of Trademaid's portfolio examples, no system is allowed more than one contract.
- Never exceed the margin your broker gives you, and never trade money you can't afford to lose.
- Write down your review rules before you go live (see Monitoring below).
- Watch the first live trades closely and check they match the chart.
- Trading more than one contract? Scale the dollar stop in the code to suit (GSB code supports per-contract stops such as
SetStopShare). A stop sized for one contract but applied to the whole position can triple your drawdown. - To trade micros, build on the mini contract and divide the stop and profit target by 10.
- Don't add tighter broker-side stops or targets on top of the system's own exits. Peter once saw a $1,000 broker stop knock him out of what became a $5,800 winner.
- Run one system per chart.
Risk warning. Live trading carries real risk of loss. GSB and TradeStation backtests are hypothetical, and past or hypothetical results don't guarantee future performance. This page is general education, not trading advice.
Deployment checklist
Don't move to the next row until the one above passes.
| Step | What to check | Pass when |
|---|---|---|
| 1. System chosen | Top system of one of the first few families, walked forward, with slippage and commission allowed for | The brown WF out-of-sample curve holds up against the other curves |
| 2. GSB functions loaded | Newest .ELD from File → Supplementary Scripts (TS & MC) | GSB_ functions are listed in the Development Environment |
| 3. Right script copied | TradeStation version, the / WF (walk-forward) version if you walked it forward | The ID in the script header matches the system in GSB |
| 4. Strategy verified | Pasted into a new Strategy and verified with the check icon | No errors |
| 5. Chart matches GSB data | Symbol, interval(s), Data2, session template, time zone, date range, volume setting | Every row matches the script header's Price Data line |
| 6. Strategy properties set | Max bars 500, commission, slippage, trade size | All match the script header |
| 7. Backtest reconciled | Strategy Performance Report vs GSB over exactly the same dates | Net profit, drawdown and number of trades are close. Small differences only |
| 8. Simulated | The strategy runs in simulation for at least two weeks | Simulated trades match the trades the strategy shows on the chart, with no errors |
| 9. Live, small | Right account, automation on, smallest sensible size, review rules written down | You've watched the first live trades and they match the chart |
| 10. Monitoring | A daily check and a regular reconcile with GSB | Done on schedule (see Monitoring below) |
Monitoring and maintaining a live system
This follows lesson 24.
Expect the brown line, not the best line
On GSB's walk-forward chart, red is the training result, yellow is WF Current and brown is the walk-forward out-of-sample curve. In Trademaid's words, we expect real-time trading to deliver results more like the brown line than the original curve. Judge your live results against the brown line.
What can go wrong once you're live
- Systems can and do fail out of sample. Peter Zwag calls this the biggest risk in trading.
- Real slippage may be more than the tick per side you allowed for.
- On systems that hold overnight, after-hours gaps can push trades past stops and profit targets.
- Simple slips: a strategy that's been turned off, the wrong account, or a lost data connection.
Daily check: is it on, and is it live?
- Right-click the chart →
Studies → Edit Strategies...and check the strategy's Status is On. - Check the Automation options are ticked and the account shown is the one you mean (live or simulated).
- Check TradeStation is connected and the chart is updating.
- Check the day's orders and fills match the trades the strategy shows on the chart.
Keep reconciling with GSB
- Every so often, re-run the Strategy Performance Report and compare it with GSB over the same dates.
- Compare trade by trade with GSB's Trades and Graphs tabs.
- Keep a note of the slippage and commission you actually pay, and compare them with what you assumed in GSB.
- If something doesn't match, find out why before it costs you.
Track systems together in Portfolio Analyst Pro
In GSB, right-click a system and save it; in the Save Systems dialog set Export To Portfolio Analyst to True. If you trade through TradeStation, Trademaid's PortfolioAnalyst strategy writes a system's trade list each time you open its chart, which is the faster way to keep results up to date. In the report, Market Performance lists every system, with columns for the last 3, 6 and 12 months, so you can see recent results system by system. See Portfolio Analyst Pro.
Changing or retiring a system
- Write your review rules down before you go live, so you're not making them up during a drawdown.
- Judge live drawdowns against what the walk-forward history showed.
- Trademaid normally wouldn't trade several systems from the same family live.
- Avoid survival bias: review every system you've run, not just the ones that are going well.
- Sizing: the Portfolio Analyst Pro guide's rule of thumb is to allocate four times the cumulative maximum drawdown for each system (use open-trade drawdown for overnight systems).
How often to re-optimise. Rarely. Peter Zwag's view is that GSB systems don't need frequent re-optimisation, and that an anchored walk-forward suits them.
Older video walkthroughs
These older videos show the same process in an earlier GSB build. Menu names may differ slightly from the steps above.
How to import the GSB scripts into TradeStation so you can use GSB-generated trading systems there.
How to set up a GSB-generated system in TradeStation: import the supplementary scripts, then copy the system code from GSB and paste it into TradeStation.
Additional Resources
Next Steps
Trading on MultiCharts or NinjaTrader instead? The same path applies, with platform-specific clicks:
GSB's main tools are its genetic algorithm search, its walk-forward and robustness tests and its export to TradeStation, MultiCharts and NinjaTrader. New to it? See what Genetic System Builder does and how GSB compares with StrategyQuant and Build Alpha.