Building Trading Strategies

    Your first genetic build in GSB, one setting and one click at a time

    What this page covers

    This page is Module 2, lessons 2.1 to 2.4 of the Training Hub, written down. You'll follow the same steps in the same order:

    1. Learn what GSB's genetic algorithm does (lesson 2.1).
    2. Load your copy of the natural gas settings file and check each setting, as loaded (lessons 2.2 and 2.3).
    3. Press Start and let the build run to 2,500 systems (lesson 2.4).

    Reading the results comes next, in Selecting Trading Systems (lesson 2.5). For the full detail on any setting, see the Interface Reference.

    1. How GSB builds systems

    A trading system can be built from dozens of indicators, each with its own settings and weight. There are far too many combinations to test one by one. So GSB searches smartly, with a genetic algorithm:

    1. It starts with a population of random trading systems.
    2. It backtests each one and gives it a score, called its fitness.
    3. It breeds the better systems together, and the weaker ones drop out.
    4. It repeats this, generation after generation.
    5. A restart throws the population away and starts a fresh search. This helps GSB find different kinds of systems.

    A system's "genes" are on its Parameters tab: each indicator's name, the data stream it uses, its parameter values and its weight. The genetic algorithm mixes and tweaks these pieces.

    Fitness is one number that ranks every system. By default it's Net Profit × Average Trade. GSB works it out on the training part of your data only. The rest is kept back as test data.

    When does a build stop?

    • When it has built Max. Uniq. Sys. systems (2,500 in your file), or
    • when Max. Run Time is reached (24 hours in your file), or
    • when you click the red Stop button.

    As a rough guide, Trademaid's natural gas build of 2,500 systems took about 24 minutes in GSB Standalone on a fast desktop (an i9 13900). Your time will differ.

    Same settings, different results

    Every search starts from random systems, so two runs with identical settings won't give identical results. Trademaid says this is a good thing: it gives more varied systems. It does mean two habits matter:

    • When you change a setting, change only one thing at a time.
    • If a result surprises you, run the same test again before you trust it.

    How big is the difference? In one of Peter Zwag's tests (Peter is GSB's developer), 20 identical YM runs put anywhere from 25 to 103 systems in Favorites B, about 50 on average. So Peter runs every comparison four times. Splitting a build doesn't help either: four 50,000-system builds aren't the same as one 200,000-system build, because each run settles on its own indicators.

    One big caution

    A genetic algorithm is very good at finding systems that fit past data, including some that only fit by luck. That's called over-fitting. That's why GSB keeps back test data the search never used, and why Module 3 adds walk-forward testing.

    Everything on this page is hypothetical backtest results. Past results, real or hypothetical, don't guarantee future performance.

    2. Load your settings file

    Before you start you need the copy of Trademaid's natural gas settings file, NG_20250717_40%InSample, that you saved in lesson 1.3 (see Getting Started), with Preferred Target Platform set to your platform.

    Please don't reset anything to defaults. Trademaid recommends starting from the settings files that come with GSB, because the factory defaults may not be as correct or as up to date as those files. For your first build you won't change a single value. Your job is to understand what each one does. If your GSB is newer, the date in the file name may be different.

    1. Click File → Load Optimization Settings. In the Open window, click your copy (the one with your own name on the end) and click Open. GSB fills in the whole left panel. If GSB already opened with your copy loaded, skip this step.
    2. Scroll to the bottom of the left panel and open Info. The Opt. Settings row shows the file that's loaded. It should show the name of your own copy. If it shows something else, go back to step 1.
    3. Now work down the sections in the tables below, from Strategy at the top. Check each value. Leave it.

    3. Every setting for your first build

    These are the values in NG_20250717_40%InSample, as Trademaid's 2025 screenshots show them and as lessons 2.2 to 2.4 read them out. For your first build, the value to use is the value in the file. "Default" is GSB's factory default, shown only where Trademaid's help states it. You don't need it, because you're loading the file, not the defaults.

    The search space (lesson 2.2)

    Every system GSB builds is put together from inside these limits: up to three indicators, joined the ways the Strategy section allows, on natural gas data, inside these dates and times, with these costs and exits.

    Strategy

    SettingValue for your first buildDefaultWhat it does
    Preferred Target PlatformYour platform (set in lesson 1.3)Not statedThe platform GSB writes code for: TradeStation, MultiCharts or NinjaTrader. It also shapes the build. From build 65.22 GSB won't let you build with indicators or features your platform can't run, and from build 75.94 the settings editors only list items that work on it. So set it before you build. The one row you change.
    # of Indicators3Not statedThe most indicators one system's entry rules can use. Trademaid recommends 3, with a maximum of 5.
    Primary FiltersTrueNot statedLeave as loaded.
    Entry ModesCrossNot statedThe style of entry signal. Peter Zwag (GSB's developer) recommends one entry mode per build, tested separately. The Cross, CrossSingleLevel and CrossDualLevels family is the exception. He has never seen Compare1 work well, and CrossSingle and CrossDual make walk-forwards much slower and less stable. AnyIndicatorCrossed (AIC) and NoConflictsCross have their weights fixed at zero (build 62.46+). Trademaid's 2025 NG and GC SysBuild files use Compare2 only.
    Weights ModeSignedPowerNot statedHow the indicators' weights are combined.
    Entry Level Mode / Entry Level ValuePower / 4Not statedTogether they set how strong a signal must be before an order is placed.
    Entry OrderAs loadedNot statedThe type of entry order.
    SF Mode / SF IndicatorEnabled / GeneticAlgorithmNot statedThe SF rows. Older GSB screens call this the secondary filter. At least one SF must be enabled, or workers error and nothing builds. Peter's July 2025 rule: for stock indices, choose CloseLessPrevCloseDBpv directly (not normalised, so not GeneticAlgorithm); for energies, use the normalised version through GeneticAlgorithm. Pick the SF yourself and test one at a time. Only switch the SF off for tick or daily data.
    SF Entry Modes / SF Data NCompare1 and Compare2 on / AllNot statedLeave as loaded. (What the SF rows do: check Trademaid's current help.)
    # of Filters0Not statedZero in this file. Leave it and the Filters rows below it as loaded.
    Order ActionThis Bar On CloseNot statedOrders are placed at the close of the current bar.
    Stops / Targets0 of 6 / 0 of 3 switched onNot statedGSB doesn't search over stop or target types in this build.
    Params.As loaded (for example 0 to 100 in steps of 0.5)Not statedThe range of values GSB may try for each indicator and weight.
    AI Params. / Built-In IndicatorsAs loadedNot statedFor later. AI Params. is an advanced feature.
    Settings Peter says to leave alone
    • Operator: multiply (*) only. Older guides (2019) suggested +; Peter now recommends * (2021 to 2022). + needs very different weights and is never better. + and - together ask for bullish and bearish indicators at once, which is worse and slower. With *, an indicator that returns zero cancels the whole product, so a dead indicator can't hide in a system.
    • Weights: never allow a weight of 0. Any number to the power of 0 is 1, so that indicator would do nothing. Don't switch to the Log weight or entry level modes either. As Peter puts it, you want power.
    • Normalization: one mode at a time. See the Interface Reference.
    • Don't switch every option on. In Peter's test, 200,000 systems built with nearly everything enabled put zero systems in Favorites B. Honed tests of 2,500 systems put over 200 there.

    Data

    SettingValue for your first buildDefaultWhat it does
    Public Data DirectoryDataTrademaid: data is stored in C:\GSB\Data by defaultThe folder GSB looks in for price files.
    Opt. Price DataNatural gas 1-minute data, 2007 to June 2025Not statedThe file GSB builds systems on. Lesson 1.4 shows how to load your own.
    Enforce Multi Price DataFalseNot statedFor checking systems later.
    Verf. Price Data GroupsBlankNot statedVerification data, used later (Module 3).
    Optimize WF Price DataFalseFalse (Trademaid: "the recommend setting")For checking systems later.

    Optimization and Genetic Algorithm

    SettingValue for your first buildDefaultWhat it does
    Training %4040 (Trademaid: "a typical default")GSB finds the best systems on this share of the data. Trademaid recommends 30% to 50%. Peter only uses % splits for a first look at an unknown market. His own method holds data out with Nth days and later dates instead (see the note below these tables).
    Test %6060Kept back to check the systems. The search never uses it.
    Validation %0Not statedNo separate validation data in this build.
    Generations25Not statedHow many times each population evolves.
    Population200Not statedThe number of systems in each generation.
    Restarts5000Not statedThrows the population away and starts a fresh search. Far more than this build uses, because it stops at Max. Uniq. Sys. Raise or lower it for more or fewer systems.

    Quantity, Costs and Exits

    SettingValue for your first buildDefaultWhat it does
    Capital Quantity / Quantity Mode10000 / CapitalInvestmentNot statedEach trade is sized from $10,000.
    Commission / Commission Mode2.5 / TradePerSideNot statedCosts per trade, per side.
    Slippage / Slippage Mode15 / TradePerSideNot statedSlippage per trade, per side. Don't set costs to zero: they make the backtest more honest.
    Minutes, Bars, Profit TargetBlankNot statedNo time exit and no profit target.
    Stop Loss2500Not statedA stop loss on each trade, in dollars per contract. Peter's view: err on the side of big, about $2,000 for ES, NQ and most markets. Don't build without a stop and add one later, because a few huge trades skew the search. Optimise the stop last, in TradeStation or MultiCharts, and look for a range that works, not one best value. Tight stops fall apart in volatile, trending periods. After a stop-out GSB can re-enter unless Max. Entries per Day is 1.
    Exit Stop Loss Entry Check Factor1Not statedLeave as loaded. (What it does: check Trademaid's current help.)
    MOC (Market on Close)TrueTrue (Trademaid's 2018 setup guide)Trades are closed at the end of the day, so this is a day-trading build.
    Exit on Close ModeEasyLanguageNot statedThe other MOC and weekend rows stay False or blank. EasyLanguage is fine for TradeStation and MultiCharts backtests. Its SetExitOnClose can fail when trading live at a TradeStation brokerage, so check how your exit on close behaves before you go live (see Live Trading Operations).

    Trading Periods

    SettingValue for your first buildDefaultWhat it does
    Glob. Start Date / Glob. End Date1 January 2008 / 10 June 2025Not statedThe range of data used.
    Dates ModeTRD (trade)Not statedLeave as loaded.
    Times3:00 am to 2:30 pmNot statedWhen trades may be entered. It only gates entries: every bar still feeds the indicators. For a swing system the stop also only works inside this window. Peter finds allowing entries over the whole session is nearly always best (skipping the last 30 to 60 minutes is optional).
    Week-DaysAs loadedNot statedThe days trading is allowed.
    Nth Day rowsAs loadedNot statedHold back some days. Covered later.

    How Peter holds data back. Your file uses a 40% training split, which is fine for a first look. When Peter builds systems to trade, he holds data out with Nth days and later dates instead. His rules:

    • The in-sample period you use to choose indicators must be the same as the in-sample period you build on.
    • Leave the most recent year or two out of GSB entirely.
    • Never train only on 2007 to 2009. The financial crisis was too volatile to be typical.
    • He leaves data after 28 February 2020 out of builds, so the volatility of 2020 to 2022 isn't curve-fitted.

    Fitness and filters (lesson 2.3)

    Keep two ideas apart. Fitness ranks systems: the genetic algorithm breeds from the ones with the highest score. Performance filters reject systems: each filter is a hard pass or fail rule, and a system that fails any active filter isn't kept.

    General

    SettingValue for your first buildDefaultWhat it does
    Fitness CriteriaNetProfit * AvgTradeNet Profit × Average TradeThe score that ranks every system, worked out on the training data only. It's a score, not dollars, so it often runs into the millions.
    Grade Metrics Increase / DecreaseEmptyNot statedNudge the search towards metrics you care about. For later.
    Positions AllowedLongAndShortNot statedLong and short trades are both allowed.
    Max. Uniq. Sys.2500Not statedThe number of unique systems the run aims to build. Peter says 2,500 is enough for a test. Never build 50,000 in one go: the top 300 end up too similar, and the GUI struggles. He uses 20,000 when building systems to trade.
    Max. Run Time24:00Not statedA time limit of 24 hours. Whichever of the two limits comes first ends the run.

    Why Net Profit × Average Trade? Net profit on its own can reward lots of tiny trades that may not cover commission and slippage. Average trade on its own can reward a handful of lucky trades. Multiplying them favours systems with both a good total profit and a solid average trade.

    Now scroll down the left panel to the Performance Filter sections. Each one has the same kinds of rules. Open each one, read its values, and leave them:

    Performance FilterMin. Avg. TradeMin. Net ProfitMin. PearsonMin. Profit FactorMin. Trades CountWhat it means
    Full PeriodVery lowVery low (e.g. −1 billion)−1Very lowVery lowSwitched off: nothing can fail it.
    Latest DaysVery lowVery low−1Very lowVery lowSwitched off. Checks only the last 365 days.
    Training030000.961.7100The filter that does the real work. Max. Trades Count and Min. Net Profit to Drawdown are effectively off.
    Test−9999−99999−1−1−1Switched off, so no system is rejected on its test results. You compare test with training yourself (Selecting Trading Systems).
    Validation−999−999990.81.3100Has real values, but Validation % is 0, so there's no validation data in this build.
    Test and ValidationVery lowVery lowVery lowVery lowVery lowSwitched off.
    Verification010.951.2100Not used in the build. Used when you verify a system (Module 3).
    Walk-Forward010.951.2100Not used in the build. Used when you walk a system forward (Module 3).

    What the Training filter asks for, in plain words:

    • Min. Net Profit 3000: at least $3,000 profit in the training data, after costs.
    • Min. Pearson 0.96: Pearson measures how close the equity curve is to a straight line. A perfectly straight, rising line scores 1. Trademaid wants curves close to a straight line, with no major drawdowns, so 0.96 keeps only very steady training curves.
    • Min. Profit Factor 1.7: gross profit must be at least 1.7 times gross loss.
    • Min. Trades Count 100: systems with too few trades to mean anything are thrown out.

    Auto-Saved Systems, just above the filter sections, isn't used by default. Leave it. Every filter is explained in the Interface Reference.

    4. Running your first build, click by click

    This is lesson 2.4. Before you start:

    • Your copy of the natural gas file is loaded, with nothing changed except your platform.
    • You're using GSB Standalone, ideally with at least 16 GB of RAM.
    • In Module 1 you stopped after a few systems. This time, let it run to the end.
    • While it runs you'll watch three things: Uniq. Sys., Sys. RAM (%) and Fitness.

    Last checks

    1. Open Genetic Algorithm. Check Generations 25, Population 200, Restarts 5000. Leave all three.
    2. Go back to General and look at the last rows. Check Max. Uniq. Sys. 2500 and Max. Run Time 24:00. Leave both, and leave the other General rows alone.

    Step 1: Save again only if you changed something

    If you've changed nothing since lesson 1.3, there's nothing to save. If you did change something, click File → Save Optimization Settings As, pick your own copy's file name, and choose to overwrite it. Trademaid recommends saving before you start building. Never overwrite Trademaid's original file, so you can always load it again.

    Step 2: Click the green Start button

    Click the big green Start button at the bottom left of the window. You can also press F5, or choose Process → Start. The yellow button pauses GSB, and the red button stops it. This time, don't press Stop. Trademaid says systems should start to appear after a few minutes.

    The green Start button at the bottom of the GSB window

    The green Start button (older screenshot from Trademaid's help)

    Step 3: Watch it work

    1. Uniq. Sys. climbing. In the right-hand panel, under Optimization, Uniq. Sys. is the number of unique systems found so far. Watch it climb towards 2,500. Fitness shows a fitness score from the search, a big number in the millions. Below are the percentage complete, elapsed and remaining time, speed and restarts. You don't need to change anything.
    2. Sys. RAM (%). At the top of the same panel is Machine Resources. Trademaid says it's worth checking, especially Sys. RAM (%). From experience you need at least 16 GB of RAM to run GSB without problems. Glance at it now and then.
    Machine Resources and Optimization progress in GSB's right-hand panel

    Machine Resources and Optimization progress in the right-hand panel (older screenshot from Trademaid's help)

    Two warning signs

    Fitness stays at 0. Trademaid says this means a drastic problem with your settings, for example trading times that don't match your data, or a filter needing more trades than your data can give.

    #C/US is high, for example over 100. GSB is finding it hard to make systems. (Trademaid's screenshot of this is from GSB Manager; check whether your Standalone panel shows it.)

    Either way, stop the run with the red button and check your settings.

    Step 4: See the search in action

    Click the Reporting Graph tab above the chart. Each grey dot is one system's fitness. The dark blue line, Max Fitness, is the best fitness found so far. It jumps up early, then flattens out as better systems get harder to find. That's the genetic algorithm at work.

    Step 5: Your systems arrive

    As systems pass your filters, they're added to the Unique-Systems tab under the chart. The number in brackets is how many it holds. Expect a few more than 2,500 (Trademaid's example shows 2,532). That's normal: workers keep going for a short grace period after the target is reached (30 seconds by default, set in App Settings), so a few extra systems are made.

    Step 6: When it's done

    When the build finishes, Status in the right panel shows Completed. Your systems are in the Unique-Systems tab. Don't trade anything yet. Next, read them in a fixed order on Selecting Trading Systems.

    5. If you get too few systems, or too many

    For your first build, keep the file's values. But it helps to know the levers for later:

    • Fitness stuck at 0: something is badly wrong with your settings (see the warning signs above).
    • Too few systems pass: Trademaid's advice for its verification filters is to reduce the values a little.
    • Too many: raise Min. Pearson.
    • Too little data: one year is far too short. You need 5+ years and about 100 or more trades.
    • Profit looks low with Nth days on: that's expected. Only some of the days trade, so the profit you see is roughly halved.
    • Change one value at a time.
    Members only
    Should you cap Max. Trades Count?

    Peter Zwag's notes on this from Trademaid's private forum for GSB buyers, free with a GSB Pro account.

    More fixes are on the Troubleshooting page.

    6. Going further (later)

    Trademaid's recommended route: settings files and macros

    Running NG_20250717_40%InSample straight away gives you a feel for what GSB can do, but Trademaid says it's not the recommended way to use GSB. Its Ultra-quick guide recommends this instead:

    1. Open the supplied file NG_20250717_SysBuild.
    2. Click M1, then the macro Play button. This builds 2,500 systems to find the best 10 indicators, and creates NG_20250717_SysBuild_green. (Trademaid: 24 minutes on an i9 13900, GSB Standalone.)
    3. Close GSB and open another GSB. Open NG_20250717_SysBuild_green, click M2, then macro Play. This builds 2,500 systems, and the best ones go into Favorites D.
    4. Click M3 (m3-Final). It groups the systems into families and puts the result in Favorites A. See the Macros Overview.
    5. Repeat the whole process. Results vary from run to run.

    Peter says the 40% InSample files are only for newcomers to get a feel for GSB. Competent users shouldn't be running them. They have Advanced Mode set to False, which is why you see fewer rows. Build with the SysBuild files instead. Start with a market that has supplied settings: a new market is much more work, and some markets are close to impossible.

    Trademaid notes its guide may differ from the trial version, so check that these files and macros are in your install. See the Macros Overview and Trademaid's current help.

    Other things to try, one at a time

    • Build on your own market and data, as in lesson 1.4 (Uploading Data).
    • Other Fitness Criteria, with care. Older guides list several favourites; Peter now builds with NetProfit × AvgTrade only (2023). Net profit alone gives trades too small to survive costs. More weight on average trade (for example NP × AT²) leaves too few trades for a robust sample. Fitness types that use MFE or NPLateEntry can build well but mislead the walk-forward. Use NP/DD, Pearson and the walk-forward curves to select systems, not to build them. (NP/DD fitness means the NetProfitOverDrawdown option. That isn't the same as entering Net Profit and Drawdown as two fitness items.) Build 77.5x adds %Profitable × AT × Trades and SQN; Peter's first tests (October 2026) showed no difference. Further reading: the forum's methodology updates thread.
    • Grade Metrics, to favour or penalise metrics such as win rate or drawdown.
    • More indicators, with care. Every indicator you enable widens the search and slows the build. Switching all of them on can cut build speed five- to ten-fold (a member's 2023 test went from over 1,000 systems a minute to 100–200). Trademaid's two-pass macros pick a short list first for this reason; see Peter's Build Rules.
    • Swing trading. Your file closes every trade at the end of the day (MOC True). Trademaid's 2018 setup guide says to set Market On Day Close to False for a swing system that holds positions overnight. For current swing settings, see the methodology case studies and Trademaid's current help.

    Older guide values. You may see Trademaid's 2018 beginners' setup guide (an AAPL 30-minute example with Generations 1000, Population 200, Restarts 10, and Training and Test filters at Pearson 0.95 and profit factor 1.2). Trademaid's December 2022 note says those settings are now redundant and to use the settings that come with GSB. Follow the values above instead.

    Older video walkthroughs

    These 2019 videos from Trademaid show older versions of GSB and older settings. They're useful background, but for your first build follow the steps above.

    Building a Day Trading System in GSB (2019)
    Build an automated day trading system from scratch

    The basics of using GSB to build a day trading system that you can export to TradeStation, MultiCharts and NinjaTrader.

    Swing Trading System on Apple, Part 2 (2019)
    Verification and walk-forward analysis

    Part two of building a swing trading system for Apple: verifying the system on Microsoft and Adobe, and running a walk-forward analysis.

    Next Steps

    Your first systems are built. Next, read them in a fixed order, mark the ones that pass and group them into families. Then, in Module 3, walk them forward.

    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.