Automation & Macros

    Link Trademaid's macros to the M1 to M6 buttons, run them, read the Macro Log, then edit and make your own

    What you need
    • GSB installed, with a project and price data you've built on by hand (Modules 1 and 2)
    • A walk-forward done by hand (Module 3), so you know what the macros are doing for you
    • Advanced view on: View → Advanced (Alt+A). Trademaid says that if you can't see the macros, Advanced mode isn't on
    • Your login for the Trademaid GSB forum, to download the macros

    This page is the Module 7 (Macros) lessons 26 to 32 of the Training Hub, written down. Each section below is one lesson, in order.

    1. What macros are, and every macro control

    A macro is a list of GSB commands that runs in order, one after another, with no clicking from you. Each macro is saved as a file ending in .gsbmacro, and you link it to one of the buttons M1 to M6. Trademaid says macros can fully automate tasks like market validation. They can load settings, build systems, put the best ones into favourites, and work out statistics. Trademaid's own market guides mostly come down to: click M1, then play.

    When to use macros

    • Loading a whole set of settings without missing one (a setup macro, section 2)
    • Trademaid's recommended build: M1 finds the best indicators, M2 builds systems with them (section 5)
    • Measuring a whole batch of systems on the same dates every time (stats macros, section 6)
    • Market validation: testing a market on data the build never saw (section 7)
    • Running GSB Automation, which drives GSB through these same macros

    In this first lesson you don't run anything. You find every macro control and learn which settings to leave on their defaults.

    The macro bar at the bottom of the window

    Look at the very bottom of the GSB window, under the big green Start button. Trademaid's help colours this row in four parts:

    ControlWhat it doesFor now
    M1 to M6Each holds one macro file. Clicking a button picks that macro. Hover over it to see which file is linkedUsed from section 2
    Macro play and stopThe small green play button starts the macro on the button you picked. The small grey stop button ends a macro early. These are not the big green, yellow and red buttons above, which start, pause and stop building systemsUsed from section 2
    New, Link, Edit, Unlink, DeleteCreate a macro, and link or unlink it to a buttonLeave alone until section 7
    Macro GroupOpens a list: Macro Group 1, 2 and 3. Each group has its own six buttons, so up to 18 macros can be linkedLeave on Macro Group 1
    GSB macro bar: Macros label, M1 to M6, small green play and grey stop buttons, New, Link, Edit, Unlink, Delete and Macro Group 3, with the Macros section of the left panel above

    The macro bar (bottom) and the Macros section of the left panel. Here Macro Group 3 is picked and M1 holds m13_cl_GetSFprospects. Trademaid's Crude Oil setup guide

    When a Trademaid guide says, for example, group three, M1, pick Macro Group 3 first, then click M1.

    Hover over a button to see what's linked

    Rest your mouse on a macro button and a small label appears. A linked button shows the macro's name. An empty button says Click to select the Macro file linked to M6 (or whichever button it is). Always hover first, so you know which macro you're about to run.

    Mouse resting on the M1 button with the label greenMax10

    Hovering over M1 shows the linked macro, here greenMax10

    The Macros section of the left panel

    In the left panel, scroll down to the section called Macros and click its arrow to open it. It sits under Script, above the Performance Filter sections. It has eight rows:

    RowWhat to doWhat it is
    User MacrosLeaveShows the commands of the macro that's loaded, starting with a comment. You read it in section 4
    On Opt. CompletedLeave on FalseGSB's help box: run macros once optimisation completed. False in most of Trademaid's screenshots. Set it to True only when a Trademaid guide tells you to (section 3)
    M1 Macros fileDon't type hereThe file linked to M1 in the current macro group. Empty until you link a file. It fills in by itself when you do (section 2)
    M2 to M6 Macros fileDon't type hereThe same, for buttons M2 to M6

    The Macro Log tab

    At the top right of GSB, next to Performance, Graphs and Settings, there's a tab called Macro Log. Trademaid says it shows the macro's status and progress, with time stamps. Each line is one command, and the green line is the command running now. Section 3 shows how to read it.

    Menus and shortcuts

    • Tools → Macro Run (Ctrl+M) runs a macro
    • Tools → Macro Cancel (Ctrl+Shift+M) stops one early
    • Right-click a systems grid: Run Macro and Cancel Macro, near the bottom of the menu
    Check Trademaid's current help. The Tools → Macro Run / Macro Cancel items and shortcuts come from Trademaid's Macros help and release notes, but a Tools menu screenshot from build 1.0.52.04 shows no macro items, so the path may have moved. Also unconfirmed: the factory default of On Opt. Completed, and exactly what the User Macros row shows. All macro screenshots on this page are from 2019 to 2023 builds.

    2. Download and run your first macro

    Why start with a setup macro? Trademaid's help puts it simply: GSB has a number of settings, and it's easy to make an error or miss something when you set it up by hand. So Trademaid recommends using a macro to load the settings. The one you'll use fills in everything except the Data section.

    Step 1: Forum → Search → repository

    Log in to the GSB forum. Click Search in the menu bar near the top of the page. In the Search for box, type repository, then click the Search button near the bottom of the page.

    Step 2: Click "file repository"

    In the results, click the thread called file repository. This is where Trademaid posts macro files and settings files. Trademaid's other guides link to it whenever they mention the latest macros, so bookmark it.

    Step 3: Download and extract

    1. Scroll to the top of the thread.
    2. Download the zip. Trademaid's beginners' guide names m1-250_skipwf_stats_till20191231_is2018.zip. The name may have changed since, so pick the one Trademaid's latest post points to.
    3. Extract it into GSB's default macro folder, C:\GSB\Data\Settings\Macros (or wherever you keep your macros).

    That zip holds five .gsbmacro files. Their names start with m1, m2, m5 and m6: the button each is meant for. There are two m1 files: one does statistics up to 2019-12-31, the other up to 2020-04-07. Start with m6, the setup macro. Trademaid notes the names may differ slightly between versions.

    Step 4: Macro Group → Macro Group 1

    At the bottom right, click the Macro Group button and choose Macro Group 1. Check that it now says Macro Group 1.

    Step 5: Right-click M6 to clear it

    Move your mouse over M6 and right-click. This clears any macro already linked to M6. In the Macros section of the left panel, the M6 Macros file row should now be blank. If it was blank already, that's fine.

    Step 6: Left-click M6

    Now left-click M6 once. Because nothing is linked, GSB opens a Windows Open window listing the files in your macro folder.

    Step 7: Pick the m6 setup macro → Open

    Click m6-CL-INIDCATORtest_20180228.gsbmacro (Trademaid's spelling), check it appears in the File name box, then click Open. Your folder may hold more files, so check the name carefully. The M6 Macros file row should now show the file name. If it's still blank, go back to Step 5.

    Step 8: Click M6, then the small green play

    Left-click M6 once more, so it's selected (it turns light blue in Trademaid's screenshots). Then click the small green play button just to the right of M6. Don't click the big green Start button above: that starts building systems.

    The big green Start button above, and below it the macro buttons M1 to M6 with arrows to M1 and the small green macro play button

    Click the M button, then the small green macro play button (bottom right), not the big green Start button (top left)

    Step 9: Check the Macro Log

    The Macro Log tab shows that the macro ran. In Trademaid's example there are two lines, each with a time stamp: line one is SettingsFull, which loads the settings, and line two is a Comment describing the macro. Your left panel is now filled in with Trademaid's settings.

    Step 10: File → Save Optimization Settings As

    Click File → Save Optimization Settings As, type a name you'll recognise, and click Save. Next time you can open the same settings with File → Load Optimization Settings, without running the macro again.

    Load the other macros the same way

    For each button: right-click to clear it, left-click it, pick the file, click Open.

    • M1: the m1 file that does stats till 2020-04-07
    • M2: the m2 file
    • M5: the m5 file

    You'll use them in section 6.

    Check Trademaid's current help. Not yet confirmed: which zip new users should download today, or whether current macros now ship with GSB instead (the Ultra-quick guide says its settings and m3-Final would be included in a GSB release); whether the setup macro needs your price data loaded first; and whether the Macro Log opens by itself. Trademaid's older Macros help also says left-clicking a button un-links it, while the newer step-by-step pages (followed here) say right-click clears and left-click opens the file window.

    3. Running, stopping and the Macro Log

    Four ways to start a macro

    WayHowWhen
    1Click the M button, then the small green playThe way you'll use most: Trademaid's "click M1, then macro play". Hover first to check the name
    2Right-click a systems grid → Run MacroTo run a stats macro on a particular grid. Trademaid runs one from Favorites B, and in another guide from the Walk-Forward tab. Click the tab the guide names first
    3Tools → Macro Run (Ctrl+M)Trademaid: if you manually stop GSB and want to run the macro, for example after stopping a build early
    4On Opt. Completed = TrueThe macro runs by itself when the build finishes. Keep it False while you're learning, and turn it on only when a Trademaid guide says so
    Right-click menu on Favorites D with Favorite A to D, Dates Mode, Run Walk-Forward, Create/Update Family, Run Macro and Cancel Macro

    Run Macro and Cancel Macro near the bottom of the right-click menu

    When does the build count as "completed"?

    For way 4, the build is complete when it reaches Max. Uniq. Sys. In Trademaid's example it's set to 50, so with On Opt. Completed True the macro runs straight after the fiftieth system. In Trademaid's Crude Oil example, M1 holds the build plus walk-forward macro, and setting On Opt. Completed to True makes GSB pick the top 250 systems and walk them forward automatically.

    Reading the Macro Log

    ColumnWhat it shows
    IndexThe line number
    TimeWhen that line ran. A blank time means it hasn't run yet
    MacroThe command and its settings
    • The green line is the command running now. When every line has a time, the macro has finished.
    • Trademaid notes the Macro Log won't appear until after you play a macro.
    • Lines ending in three dots are just too long for the column.
    • Since mid 2019, macros that run walk-forwards wait until all of them are complete. That can take hours: leave GSB alone while it works.

    Stopping a macro early

    • Click the small stop button, just right of macro play (while a macro runs, play is greyed out and stop is active)
    • Or Tools → Macro Cancel (Ctrl+Shift+M)
    • Or right-click → Cancel Macro

    After you stop one, look at the Macro Log. Lines with a time have already run, so their changes (such as new dates) are already made. Trademaid also notes that cancelling user tasks doesn't cancel walk-forwards. Section 6 shows a real example: Trademaid stops a macro part way, then runs M2 to put the dates back.

    A cancel takes effect only once the current step has finished, so a long step can keep running for a while. Peter's habit (2019) is to start his own macros with a 60-second wait (an Idle command), which gives him time to cancel a build he started by mistake before anything changes.

    Check Trademaid's current help. Not yet confirmed: which macro Run Macro and On Opt. Completed run (the selected button's, M1's or the User Macros list), which grid a macro acts on, which section holds Max. Uniq. Sys. in your build (Workplace or General), and whether macro stop also stops a build or walk-forwards the macro started.

    4. Macro building blocks

    A macro is a numbered list of commands, starting at line zero. GSB runs them from top to bottom. The command's name comes first, like Stats or DatesMode, and its settings follow in brackets, for example re-backtest: True. You can see them under User Macros in the left panel, or line by line in the Macro Log. The goal here is to read a macro and know exactly what it does. You won't change anything yet.

    The commands the lessons cover

    CommandKindWhat it does
    CommentHousekeepingA note shown in the log. GSB ignores it. Trademaid starts most macros with one that says what the macro does
    SettingsFullSettingsLoads a whole set of settings in one line. The m6 setup macro in section 2 uses it
    SettingsPartialSettingsLoads some settings in one line. Trademaid's methodology example sets # of Indicators 3, the built-in indicators, entry and normalisation modes, dates to 2015-06-30, Max. Uniq. Sys. 50,000 and the minimum Pearson and profit factor
    StartBuildingSystemsBuildStarts the build, just like the big green Start button
    IndicatorTestingBuildRanks the indicators and keeps the best ones. With Min=10 it keeps at least ten
    IdleHousekeepingWaits. In Trademaid's Nasdaq macro it waits ten seconds
    FavoritesSystemsPuts the systems that pass its filters into a favourites list (A to D), ranked by the Order you pick, keeping the Top number you set. See the row-by-row table below
    SwitchGridHousekeepingMoves to a grid, for example Favorites D
    DatesModeDatesSets which dates the systems are tested on. With re-backtest: False it only changes the setting (Trademaid: "don't re-calculate yet"). With True GSB recalculates every system on those dates
    GlobalDatesDatesSets the global start and end dates
    NthModeDatesSwitches the Nth day mode, for example from no trade to trade
    StartAndEndDatesDatesPut it as the top line and the start and end dates are changed before the rest of the macro runs
    OverrideOriginalSettingsSettingsOverride Original Settings (OOS). Trademaid's help: to run it from a macro, set re-backtest to True
    UseWfCurParamsWalk-forwardTurns a system's current walk-forward parameters (WFP) on or off, so you can compare results with and without walk-forward
    StatsResultsSaves the current results into a destination letter on the Statistics tab (A to F in Trademaid's examples)
    ParamsStatsResultsIndicator statistics: the best and worst indicators for the current systems
    WalkForwardWalk-forwardWalks forward the systems in a favourites grid
    Sound, EmailHousekeepingPlays a sound or sends an email, so you know the macro has finished

    Trademaid's older Macros help also lists the macros that came with GSB: IndicatorStats (indicator stats), NthAll (changes Nth to all), wf_stats (stats before and after a walk-forward) and alldatesto20150630 (sets global dates and dates to 20150630).

    Newer commands

    Peter Zwag (GSB's developer) has added commands since the lessons were recorded. Look for them in the Add list of the Edit Macros window. The build number is the first GSB build that has the command (see the beta builds thread).

    From buildWhat it does
    68.08Reset one favourites list (for example Favorites A) instead of all four
    68.17Load systems from a folder
    68.87Save systems (last in the command list)
    Not statedSave all systems to a CSV file in C:\GSB\Data\Exports\Systems. Run the family command first, so duplicates are removed
    70.44Export all walk-forward results to a file
    Not statedTellAutomationThatGsbFinished: tells GSB Automation this GSB is done, so Automation can move on without waiting for slow stats steps at the end of the macro

    The Favorites command, row by row

    Trademaid's example puts the top 1,000 systems, ranked by fitness, into Favorites A:

    SettingTrademaid's exampleWhat it means
    DestinationAThe favourites list to fill: A, B, C or D
    TypeGDThe rating the systems get. GD is how the favourites columns (FvA to FvD) show Yes, Good
    Min. Avg. Trade0A system's average trade must be at least this
    Min. Net Profit1Net profit must be at least this
    Max. Drawdown-1,000,000,000In practice, no limit
    Min. Pearson0.98A very straight equity curve
    Min. Profit Factor1.5
    Min. Trades Count100
    Max. Trades Count1,000,000In practice, no limit
    Min. Net Profit / DrawdownLeft wide open
    OrderFitnessHow the passing systems are ranked. Since about version 53.00 (late June 2019), VSS and VS scores can also be used
    Top1000How many of the ranked systems to put into the list

    So this command says: of the systems that pass, put the top 1,000 by fitness into Favorites A. The ratings are the same ones you set by hand with right-click → Favorite A to D:

    Favorites menu showing ratings No, Yes Good, Yes Very Good and Yes Excellent

    Right-click → Favorite A to D: No, Yes Good, Yes Very Good or Yes Excellent

    Re-backtest: change only, or recalculate

    Many commands have a re-backtest setting. In Trademaid's stats macro, one line is DatesMode 1900-01-01 to 2018-02-28 with re-backtest False: change the setting, don't recalculate yet. That saves time when the next command recalculates anyway. A later line is 2018-03-01 to 2019-02-28, Dates Mode TRD (trade), re-backtest True: GSB recalculates every system on just those dates, the first out-of-sample year. It's the same choice GSB gives you when you change Dates Mode by hand:

    Dialog asking whether 111 systems should have Dates Mode changed to All, with Yes, No and Cancel

    By hand: Yes changes and re-backtests now, No changes only and re-backtests later, Cancel does nothing

    Putting it together: a stats macro

    Read a whole macro from Trademaid's Crude Oil stats guide, line by line. It's here to teach macro syntax. Don't copy the method: section 6 explains why.

    1. Comment: what the macro does
    2. Favorites: the top systems into Favorites D
    3. SwitchGrid: move to Favorites D
    4. Lines 4 to 6: set the in-sample dates without recalculating, then OverrideOriginalSettings and recalculate
    5. Stats destination A (in-sample)
    6. Then each DatesMode line with re-backtest True is followed by Stats B, C and E (out-of-sample periods)
    Check Trademaid's current help. Not yet confirmed: that Type GD means "Yes, Good"; how VSS / VS appear in the Favorites command; whether Stats destinations now go to H (Stats G and H were added in 52.18); exactly what OverrideOriginalSettings does in the stats macro; which walk-forward types WalkForward can use; and whether the 2019 command list is still complete.

    5. The two-macro system build

    This is Trademaid's recommended way to build systems today, from its Ultra-quick guide for Natural Gas. Trademaid found much better results by testing the indicators first, then building systems with only the best of them. M1 builds systems just to rank the indicators and keeps the best 10. M2 then builds the real systems, and the best go into Favorites D. GSB Automation repeats this in batches (Module 5, lesson 1).

    Before you start

    • GSB standalone is simplest.
    • Or a manager plus workers: every extra worker multiplies the speed. Allow about 10 GB RAM per worker plus about 4 GB for the manager.

    Step 1: File → Load Optimization Settings

    Click File → Load Optimization Settings. The window opens in C:\GSB\Data\Settings\Optimization\Manager. Click NG_20250717_SysBuild, then Open. Trademaid's guide lists similar files for Gold and Crude Oil.

    Step 2: Click M1, then macro play

    Hover over M1 to check the name, click it, then click the small macro play button. This builds 2,500 systems to find the best 10 indicators. Trademaid: 24 minutes on an i9 13900, GSB standalone. Trademaid says you can skip this step, but you'll get significantly weaker systems.

    Watch the Macro Log. In the Nasdaq version of the same macro:

    1. StartBuildingSystems starts the build
    2. IndicatorTesting (Min=10) ranks the indicators and keeps at least ten
    3. Idle waits ten seconds

    The macro then saves a new settings file with _green on the end: NG_20250717_SysBuild_green. The Built-In Indicators row shows Main: 10. Trademaid notes the top 10 vary a lot each time you run it.

    Step 3: Close GSB, open a new GSB, open the _green file

    Close GSB and open another GSB. Open NG_20250717_SysBuild_green with File → Load Optimization Settings. Check the Opt. Settings row at the bottom of the left panel: its name should end in green.

    Step 4: Click M2, then macro play

    This builds another 2,500 systems using only the ten indicators from Step 2. The best go into Favorites D. Trademaid: 9 minutes with Step 2 done, slower without.

    Step 5: M3 (m3-Final) tidies up

    Trademaid's July 2025 update adds a third macro, m3-Final, on M3. Peter explained it in September 2025: for the NG, GC and CL settings, it runs the family command on Favorites D, which removes systems that differ only in their parameter values, and puts the result in Favorites A. So Favorites A is the list to sort afterwards. Peter also says 2,500 systems per pass is enough.

    If your install doesn't have m3-Final, do the same job by hand: clear Favorites A, change Favorites D to Dates Mode All, and run the families command.

    1. Favorites A: Ctrl+A, right-click → Favorite A → No
    2. Favorites D: Ctrl+A, right-click → Dates Mode → All (about a minute; watch the right side of GSB)
    3. Right-click → Create/Update Family (optional but recommended)
    Right-click menu with Create/Update Family highlighted

    Right-click → Create/Update Family. A family is a group of systems with the same indicators but different parameters

    The same pattern on the Nasdaq

    Trademaid's Nasdaq guide uses the same pattern with different settings: M1 holds greenMax10, M2 the nct3-300 build macro, and M3 the custom parameters macro. Max. Uniq. Sys. is 20,000 and Max. Run Time is 24:00, so the test stops after a day even if it hasn't made 20,000 systems.

    Then you choose, by hand

    The macros stop there. In Favorites A, click the NP/DD-F column to sort it. Look for a high net profit to drawdown ratio and a high Pearson's correlation to a straight line. Then walk forward the ones you like (Walk-Forward Optimization) and read them on Selecting Trading Systems. These are hypothetical backtest results, and past results don't guarantee future performance.

    • If you skipped m3-Final and Favorites D holds only a few systems, look in Favorites C too.
    • Choose using NP/DD, Pearson and the walk-forward curves.
    • A selection macro can work as a filter across periods: add a criterion, change the dates or the Nth setting, and run it again.
    • To run stats on just a few systems, put them in a favourites list first. Highlighting rows doesn't limit what the stats cover.
    Favorites A grid sorted by NP/DD-F

    A favourites grid sorted by NP/DD-F (net profit / drawdown, full period)

    Check Trademaid's current help. Not yet confirmed: whether NG_20250717_SysBuild, its _green file and m3-Final ship with your GSB install or trial (Trademaid notes its guide may differ from the trial version), and whether m3-Final does the same job for markets other than NG, GC and CL.

    6. Stats macros and the macro methodology

    This is the older method. The stats macros below come from Trademaid's Crude Oil guides. Keep reading them to learn how stats macros work, but build with the two-macro method in section 5. Peter Zwag has changed his advice since:

    • The old CL macros choose favourites inside the in-sample period, so Peter says they shouldn't be used (March 2023). Copy the current NQ or supplied macros instead.
    • He now looks only at Stats A (in-sample) and F (the whole out-of-sample period) (December 2023).
    • He advises against building 50,000 systems in one go (March 2024). Section 5 uses 2,500 per pass.

    Trademaid's approach is to test thousands of systems and see what they do collectively. A stats macro runs the same steps on the same dates every time, so you get a fair benchmark for a market. Then change one thing at a time, run it again, and see if results improve. The dates below come from Trademaid's guides, so yours may differ.

    The beginners' stats macro (the macros from section 2)

    1. After building 50,000 systems, click M1 (the m1-250_skipwf stats macro), then the small green play. Click the Macro Log tab to follow it.
    2. The Favorites line puts the top 250 into Favorites D. The Favorites tab label shows one count per list, A, B, C, D: here (0,0,0,250).
    3. The Statistics tab fills in: A in-sample (1900 to 2018-02), B 2018-03 to 2019-02, C 2019-03 to 2019-12, E 2020. Hypothetical results only.
    4. Before families, click M2, then play. In this set M2 is m2-alldatesto20180228. Trademaid says it's critical to create families using in-sample data. To check: Graphs, set the X axis to Trade Date, and the curve should end at February 2018.

    The methodology macro set

    Trademaid's Methodology page uses a bigger numbered set, all in Macro Group 1:

    ButtonMacroWhat it does
    M1m1-build+wf250…Builds, then walks forward the top 250
    M2m2-alldatesto20150630…Puts all dates back to 2015-06-30 (in-sample)
    M3m3-wf_statsStats with and without walk-forward into Stats A to F
    M4m4_post2018_2021Stats from 2018 to 2021
    M5m5-Astab-C_top90_2FavDTop 90 by Anchored Stability (Coarse) into Favorites D
    M6m6-Vss_top91_2FavDTop 91 by VSS into Favorites D
    Macros section with M1 m1-build+wf250, M2 m2-alldatesto, M3 m3-wf_stats, M4 m4-250_nowf, M5 m5-Astab-C_top90, M6 m6-Vss_top91, and M4 then macro play highlighted

    The methodology set linked in Macro Group 1. Here M4 (the fast no-walk-forward version) is selected, then macro play. Trademaid's fast Crude Oil guide

    Run order

    1. Run M1. It fills Favorites A to D and walks forward the top 250.
    2. Verify them on noisy data, as in Module 3.
    3. Click the Walk-Forward tab, Ctrl+A, right-click and add them to favourites.
    4. Run M3 from the Walk-Forward tab: in-sample and out-of-sample stats, with and without walk-forward, into Stats A to F.
    5. Run M5 (top 90 by Anchored Stability Coarse into Favorites D), then M3 again.
    6. Run M6 (top 91 by VSS into Favorites D), then M3 again.
    7. Record each set of stats in a spreadsheet. Run the macro of whichever group did best again, to put it back in Favorites D.
    8. Put the dates back with M2, then create families.

    A shortcut: M4 skips the walk-forward

    Walk-forwards take hours, so Trademaid's fast Crude Oil method clicks M4, then play, instead of M1. Its m4-250_nowf macro does the stats without the walk-forward, leaving 250 systems in Favorites D. M4 may be new to you: right-click M4 to clear any old macro, and link the new one first.

    • Results poor? Trademaid says stop and recheck your settings.
    • Results good? Run M2 to put all dates back to 2015 (Trademaid calls this critical after the shortcut), then Favorites D → Ctrl+A → walk forward all 250, then run M3 for the stats.

    Macros in other groups

    Some guides use the other groups. The Crude Oil setup guide says "run macro 13", which is M1 in group 3: click Macro Group, choose Macro Group 3, hover over M1 to check it's m13_cl_GetSFprospects, then click M1 and play. Always check the group before you click.

    Macro Group 3 with M3 selected and the M3 Macros file row showing m15_cl_FindBestIndicators

    Macro Group 3, M3 selected: the M3 Macros file row shows the m15 macro

    For how the older method then picks from Favorites D (M5 top 90 by Anchored Stability Coarse, M6 top 91 by VSS, families), and how Peter selects today, see Selecting Trading Systems.

    Check Trademaid's current help. The beginners' set and the methodology set use different dates and file names, and Trademaid hasn't confirmed which new users should follow today. Also unconfirmed: whether M3 must be started from the Walk-Forward tab or from Favorites D, how macro numbers map to group and button in every guide, and whether the M2 date reset is needed after m3-Final in the two-macro build.

    7. Editing and making your own macros, safely

    Ground rules

    1. Save your settings first: File → Save Optimization Settings As.
    2. Start from a copy of a Trademaid macro that already works, not a blank one.
    3. Change one thing at a time, and save under a new file name, so the original stays safe.
    4. Test it on a small build (Trademaid's own example uses Max. Uniq. Sys. 50) before trusting it with 50,000 systems.

    New, Link, Edit, Unlink, Delete

    Trademaid's help says a macro can be created, and linked or unlinked to a button. In the lesson: New starts a new macro, Link attaches a macro file to a button, Edit opens a macro so you can change it, and Unlink takes it off the button. Trademaid doesn't describe Delete, so leave it alone. You can always unlink instead.

    The Edit Macros window

    • The title shows the file name, for example Edit Macros - test2.gsbmacro.
    • On the left: the list of commands, in run order. The up and down arrows move the selected command.
    • On the right: the selected command's settings.
    • Add puts in a new command, Remove deletes one. OK keeps your changes, Cancel throws them away.

    Example: top 1,000 by fitness into Favorites A

    1. Click Add and choose the Favorites command.
    2. Click it in the list and set Destination A, Order Fitness, Top 1000. Leave the minimums as they are to start.
    3. Click OK.

    Save and load macro files

    In the Macros section of the left panel, right-click the User Macros row, hover over Macros, and click Save. Give it a new name. Load in the same menu opens a macro file. Don't click Reset To Default there unless you mean to clear it.

    Link it to a free button

    1. Pick a Macro Group with a free button, so you don't overwrite Trademaid's macros.
    2. Right-click the button to clear it.
    3. Left-click it, pick your file, click Open.
    4. Hover to check the name, then click the button and the small play button, and watch the Macro Log.

    Tips

    • Add a StartAndEndDates command as line 0 and the start and end dates change before the rest of the macro runs.
    • To use OverrideOriginalSettings in a macro, set re-backtest to True.
    Members only
    Adapting a build macro to a new market

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

    Advanced 1: a market validation macro

    From Trademaid's Macros help:

    1. Build systems from 1900 to 20150630 with Nth day 1, Nth Day Mode no trade and an Nth day period of 80 days: 80 days trading, then 80 days unseen, over and over.
    2. Max. Uniq. Sys. is 50 and On Opt. Completed is True, so the macro starts after 50 systems.
    3. It saves Stats A, changes Nth day mode from no trade to trade (to test the unseen days), and saves Stats B. In Trademaid's example that showed −57.3% market degradation.
    4. Then the dates are inverted to no trade, Nth all, giving results from 20150630 to 20180229, which go into Stats C.

    Advanced 2: an eleven-line validation macro

    1. In-sample into Stats A
    2. Update the parameter stats (top and bottom third of indicators)
    3. Change to the 80 days unseen data: the first out-of-sample
    4. Put it into Stats B
    5. Second out-of-sample: change dates to 6/30/2015 to 2/28/2018, don't recalculate yet
    6. Nth mode to all, recalculate
    7. Put it into Stats C
    8. Indicator stats again for the second out-of-sample
    9. Extend the dates to 3/2019
    10. Dates Mode 1/2000 to 6/28/2018, no trade (so 6/28/2018 to 3/2019 is tested)
    11. Put it into Stats E

    Advanced 3: with and without walk-forward

    This log compares walk-forward with no walk-forward on Favorites D. UseWfCurParams False then Stats A gives the result without walk-forward; UseWfCurParams True then Stats B gives the walk-forward result on the same dates. It repeats for each period, filling Stats A to F: the same idea as the m3-wf_stats macro in section 6.

    Macro Log with 23 lines: Comment, SwitchGrid, DatesMode, GlobalDates, UseWfCurParams, OverrideOriginalSettings and Stats destinations A to F

    Macro Log of a with/without walk-forward stats macro (2019). Each line has an Index, a Time and the Macro command

    Check Trademaid's current help. Not yet confirmed: exactly what New, Edit and Delete do (and whether Delete removes the file from disk), how you choose the command type after clicking Add, whether User Macros → Macros → Save / Load is still the way to save, and where it saves by default. For the market validation macro, Trademaid's text says 1900 to 20150630 but its screenshot shows a 2000 start date.

    Troubleshooting

    ProblemTry this
    I can't see the macro buttons or the Macros sectionTurn on View → Advanced (Alt+A)
    Clicking play starts a build instead of the macroYou clicked the big green Start button. Use the small green play at the end of the macro bar
    The wrong macro ranCheck the Macro Group first, then hover over the button to read the linked name
    Left-clicking a button doesn't open the file windowSomething is already linked. Right-click it to clear it, then left-click
    The M Macros file row stays blankGo back to Step 5 of section 2 and link again; check the file is in C:\GSB\Data\Settings\Macros
    No Macro LogIt appears only after you play a macro
    The macro seems stuckLook for the green line in the Macro Log. Macros wait for walk-forwards to finish, which can take hours
    I stopped a macro part wayLines with a time already ran. Put dates back with the matching Trademaid macro (for example M2) before families
    A file name in a guide doesn't match mineTrademaid's names change between versions. Use the one its latest file repository post points to
    The macro moves on after about 100 systemsGSB may be short of resources: reboot. Also check Max. Run Time and any limit on computations
    Stats say "saving stats for 10000 systems"Raise the stats limit to 100,000
    "Invalid GSB macro file"The macro doesn't match your GSB build. Get fresh macros (the Resource Manager downloads updated ones)
    I edited a macro but nothing changedClick its M button again to reload it
    The macro only walked forward 12 systemsToo few passed its filters. Edit the macro's criteria
    GSB hung during a macroDon't touch GSB while a macro runs
    GSB Automation

    The GSB Automation add-on drives GSB through these same macros, running the indicators-first build in batches. Its macros are copied into C:\GSB\Data\Settings\Macros, and any macro it uses must exist in GSB. See GSB Automation.

    Next steps

    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.