Article Contents
Print

Solving Problems With The Execution Report

So how do we find out why the last test did so badly? If you refresh the Usage In Test column and sort it, like we did before, then click down the list of traded shares you’ll notice that there are lots of positions but they are all of a very short duration. At his point it may well be obvious to you what’s gone wrong, but knowing how to trouble-shoot problems is very useful, so lets go through the process.

  1. Pick a share that has a fore-shortened position and locate the sell trade, as that’s clearly where the problem is. For this example we’ll use 4imprint Group plc, as it’s at the top of the list, and we’ll focus in on the sell trade on 13/5/2024:
The Status Panel gives us the details of the trades made and the Rule Highlights also show us which rules were responsible for those trades
  1. Click on the price bar on the day of the trade and the trade details are shown in the Status Panel, which tells us the sale was a result of the ‘Stop-Loss’ rule. In fact, we can tell that by the green halo around the trade, which was the Rule Highlight colour we chose for that rule (not such a great choice, in hindsight, as the bars are also green). Indeed, we can see from the green haloes everywhere that all the sales are down to the ‘Stop-Loss’ rule.
  2. The smart move now would be to review the definition for that rule and see if we can spot the error. But why make it easy when we can learn something new, instead? What we need to know is exactly what was going on in the trading spec when the ‘Stop-Loss’ rule was triggered – for this we have the Execution Report. To start, make a note of the sell-date (13/5/2024), then open the Dashboard and reset the test. RuleTrader will ask if you want to save the test first – hardly worth it given this error.
  3. Re-open the Dashboard and change the Stop-test at setting to ‘named rule’, click the Stop Parameters button, then choose ‘Stop Loss’ in the drop-down list for the ‘Named rule’ tests to next trade by rule and click Ok. This sets up the test to stop at the first occurrence of the ‘Stop Loss’ rule. We could have equally left the Stop-test at setting at ‘specified date’ and just changed the date to the sell-date of 13/5/2024, but this gives us an opportunity to try something new.
  4. All tests which run to an event, as opposed to a date, (i.e. all those events below the horizontal line, in the Stop-test at drop-down list) can only be used with single-share tests (as the event relates to a single-share’s data). The single-share tests are also all listed below the line in the Securities to test setting’s list and each starts with ‘Chart’s security…’, as they run the test only for the selected security currently displayed in the Chart.

Choose the last option: ‘Chart’s security if selected in file’. This setting, which is explained here, tests just the one share – 4imprint – and ensures it’s only tested during the period it was selected. This ensures the test results will be exactly the same for this one share, as it was with the original multi-share test. Testing only one share has two advantages:

    • it reduces the amount of data that we’ll have to work through in the Execution Report
    • it saves a lot of time, particularly as we’re using the saved trading-list to determine when it was selected, rather than re-selecting the list. This is another good reason for saving trading-lists. The name of the file we created should still be in the Trading-list file field. If it isn’t, click the button labelled ‘…’, which will open a file browser, allowing  you to find and select the previous file
  1. Now click the Execution Report tab button and tick the Enable execution report checkmark. We could also limit the period in the test that the report covers, both to speed up the test and reduce the amount of data that’s collected. For a short, single-share test like this it’s not worth it, but for a long multi-share test it definitely is, as the Execution Report generates a very large amount of data and can considerably slow the test in the process.

IMPORTANT: Though not much data will be generated by this test, you should ensure you have enough disk space before running the Execution Report with more complex Specs over long periods. For example, the Example Investment System generates ~80MB of report data per year of test, when the Execution Report is enabled. Over 10 years that’s getting on for 1GB, which shouldn’t bother most modern drives, but its worth being aware of if your drive happens to be nearly full.

Previous log files are automatically deleted every time an Execution Report is run, but if you wish to delete them manually, you’ll find them in \ShareScope\ShareScript\Output\RuleTrader\Test Sessions\Execution Reports

  1. At this point, you could click Start Back-Test but, instead, click the chart because all tests that run to an event can be started, and continued, simply by clicking the chart. The test will run and almost immediately stop with the sell trade on 13/5/2024. If you click the chart again, the test will continue to the next instance of a trade with the ‘Stop Loss’ rule, and so on.

IMPORTANT: The Chart panel must be expanded (i.e. the buttons must be showing) for RuleTrader to be able to respond to mouse-clicks on the Chart. To stop RuleTrader responding to clicks, collapse this panel or set Stop test at to don’t test

  1. Now go back to the Execution Report tab, uncheck Enable execution report (another good habit, to avoid slowing down future back-tests and filling up your hard-drive) and click the View Report button.

The Execution Report Viewer app will then open with the report displayed. The Viewer’s Help window will also be displayed (you can prevent this happening by unchecking the Show help when viewer starts setting at the bottom of the Help). For now, why not familiarise yourself with these instructions, as they’re not very long. Clicking away from the Help window will make it disappear. To bring it back, just press function key #1 (F1) on your keyboard.

The Execution Report Viewer is designed to make the large amount of data in the report manageable, by collapsing the data. This allows you to drill down in to the information you’re interested in by clicking on the + icons to expand the data beneath that line. If you hold the Ctrl key down while doing this, then all the data below the line will be expanded.

At the top, collapsed level, the viewer shows each trading day that was simulated in the test. The sell rule we’re interested in happened on 13/5/2024, so please locate that day. Regrettably, scroll-wheels don’t work in the Viewer; you’ll need to use the vertical scroll-bar. It’s a limitation of the underlying technology and is something we’re working on.

If you didn’t click on the chart more than once during the test, then 13/5/2024 will be the last line, as that’s where the test stopped. Expand the line by clicking on the + icon. Keep doing this to expand each line, focusing on the part of the report that deals with the evaluation of the ‘Stop Loss’ rule. You’ll soon see something like this, which describes the results of evaluating and then comparing the ‘Pooled Return’ and ‘Stop Loss Threshold’ terms (note that the viewer uses colours to highlight different types of information. You can change these colours by clicking the Viewer’s Settings button, which is the gear icon in the top-left corner):

The Execution Report Viewer provides a detailed breakdown of the execution of your Trading Spec

No doubt you can immediately see the problem, if you’ve not done so already. The ‘Stop Loss Threshold’ is +15% but it should be -15%.

  1. So now you know what to fix, close the Viewer then Edit the ‘Stop Loss Threshold’ term in the Trend-Trader v1.01 Trading Spec and change its value to minus 15%, then click Ok to exit the Dashboard. Because you changed the Spec, this will reset the test
  2. Back in the Dashboard, ensure the Execution Report is no longer enabled and change the Stop-test at setting back to ‘specified date’. You can check the stop-date is still set to 31/8/2024 by pressing the U(pdate) button.
  3. Then change the Securities to test setting to ‘All securities loaded from trading-list file’, as we may as well save time by using the previously saved trading-list.
  4. Finally, clear the console, show the updated version of Trend-Trader v1.01, so we have a record, then start the test. When it’s done re-run the Account and Period reports and, while you’re at it, why not try the Performance by Trading Rule and Performance by Trade Type reports, to see how the two sell rules compare.

10 Year Comparison

It’s not worth it to compare Trend Trader v1.00 and v1.01’s results over only 8 months, but when we ran the test over 10 years, we saw that adding a stop-loss rule created a small improvement in the performance of the system:

     TestCAGRCap. GrowthExcess ReturnsROIProfit FactorW/L Length RatioNum Positions
v1.007.41%104.30%23.42%4.08%1.583.32435
v1.018.03%116.40%35.53%4.21%1.603.67468

We were also gratified that this very simple trading system continued to beat the FTSE All-Share over that period, which really illustrates the power of the AutoTrend feature.

What Happened To The Indicator Panel Overlays?

You may have noticed, when you re-ran the test, that the Indicator Panel only shows the number of shares in the main ‘Growth Shares’ strategy list but no longer shows the number of shares in the ‘Quality Companies’ and ‘Small Cap’ Selector Term lists. This is because we loaded the trading list from files, so only the number of shares in the final strategy list were available.

This is also the reason for the Warnings that were issued during the test, where RuleTrader stated that the values for the ‘Quality Companies’ and ‘Small Cap’ Selector Terms were undefined, which was preventing it from updating these overlays.

In the Console, RuleTrader shows warnings and other messages related to the execution of a back-test

Important Note: Excessive use of overlays can slow down back-tests. This is because RuleTrader normally only evaluates definitions in the Spec when their value is required in the evaluation of the Spec’s Trading Rules. So if you have an overlay linked to some complex term that is normally only occasionally evaluated, then it will now have to be calculated for every day of the test in order to update the overlay.

Now let’s look at how back-tests can be batched up for unattended execution.

Scroll to Top