September 2014 Newsletter – Understanding the Art of Paper Trading

September 10, 2014

Understanding the Art of Paper Trading 

by Marge Sherald, CEO

One question we are often asked in technical support is “how can a model that does so well during the optimization period fall apart in the out-of-sample period?”  The answer is that any time you use optimization, you can “overfit” your model to the data in the optimization period.  There is a very good tip called “Steve Ward’s tips on preventing over-optimization” that addresses this problem with a variety of different solutions.

In this article we’ll concentrate on the use of a paper trading data set that appears in both the prediction and trading strategy wizards on the dates tab in NeuroShell Trader.   (If paper trading is not visible on the Dates tab of the Trading Strategy wizard, click on the options button and choose Optimization Range Specification in the Dates Interface.)  Click on the paper trading check box and the paper trading period appears in orange on the timeline.

This chart shows results for the optimization period in white/gray, paper trading in orange, and out-of-sample data in green.  

When you choose paper trading, the model’s parameters are still optimized on the gray colored optimization data set, but each new optimal solution that is found by the GA is applied to the paper trading set. If that optimal solution is found to get better results on the paper trading set than previous optimal solutions, then it is saved as the ‘best model’. Optimal solutions that underperformed on the paper trading are still used in the GA optimization process to find an optimal solution on the optimal data set, but they are not used as the ‘best model’. The final model selected by the optimization is the last saved ‘best model’.

How Much Data Do You Include in Paper Trading?

When you choose paper trading, the default setting splits the data loaded in the chart so that the oldest half of the data becomes the optimization set, and remaining data becomes the paper trading set.

Note that there is a third option to create an out-of-sample data set called “Trading”, but we’ll talk about that in a minute.

But back to paper trading.  Is using half of your data for paper trading the best practice for building your model?

It All Depends

First take a look at your data, no matter what type of bars you are using.  Does the range and direction of the optimization period match the paper trading period?  Are there similar peaks and valleys in both data sets?  If that’s the case, deciding where to break the data doesn’t matter that much.  If the data in the two periods doesn’t match, you may want to look for a shorter paper trading period that matches the majority of the data in your optimization period.  This choice has the added advantage of training a model that should more closely match current market conditions.

Another option is to choose a paper trading period that reflects market conditions you want to be able to identify. To use this option, you have to enter the start and end dates for the paper trading period. To enter the start date.  Select “Specify Date” from the drop down box in the paper trading section.

To specify an end date rather than using the end of the chart data, turn on the option for “Start trading before last chart date” in the Dates tab. (If you don’t see this option listed, go the Trader Tools Menu, Options, and select the Advanced tab.  Under Date Interface Settings, click on the check box to “Allow real trading to begin before last chart date”.)  The rest of the data in your chart (displayed in green) will not be used to build the model, but you can use it to gauge real world performance.

If your chart is based on intraday data, you may want to skip having a paper trading data set.   The theory behind this choice is that there is enough diversity in intraday price movement to cover all market conditions.  You might want to watch the model for a day or two, and then trade it for a few days.  Reoptimize the model on all of the data up to present, watch for a day or two and then trade. Repeat as needed.

The exception to the rule for intraday data is when you want to trade only certain hours in a trading day, such as London market hours that overlap with the US.  You’re creating a more specialized model that might provide better results by using paper trading.

Next newsletter:  Using the Power User batch processing and walk forward features to decide the size of the paper trading set.  

Choosing the Right Securities to Model

You’ve done the comparison shopping for a data supplier and are pleased with the amount of historical data you can use for building your models.  However, giving it “everything you’ve got” may not be the best solution for building successful models.  The key is to give your model relevant patterns.  Does your training data include some up trends, down trends, and sideways markets?  If you don’t include these types of diverse patterns, your model might fail the test when some new pattern comes up that the model didn’t study.  If your security of choice only shows an up trend, it might be time to find a new security that can provide a variety of patterns.  Not all securities are that easy to model.  A good habit is to manually examine the price curves in your set to make sure it shows lots of rising, falling, and volatile patterns.

This data set graphed in ChaosHunter shows a variety of patterns in both the optimization and out-of-sample data sets.

If you are building intra-day models, make a similar analysis without going back so far in time.

At the end of the day we cannot give you an exact cookbook of how to choose which securities to model, because like all of trading, it is more an art than a science. Experiment and come to your own conclusions about what is best for the stocks or other issues you are dealing with. Keep in mind that not every issue is always predictable (has repeating patterns). Sometimes stocks and markets change based on news, and totally new patterns will appear.

Using the Power User Features to Identify a Paper Trading Period

by Marge Sherald, CEO

In last month’s newsletter, we talked about using the paper trading period to mitigate the effects of over optimizing a model.   This month we’re going to talk about using the Trader Power User’s ability to batch process saved Trading Strategy templates and walk-forward optimization to identify a paper trading period of interest.

 

This chart uses two different Trading Strategy Templates with different paper trading periods.

In the chart above, we used the same trading rules, but in the upper Trading Strategy we chose a two month paper trading period.  In the lower Trading Strategy, we chose a one month paper trading period.  The profit in the trading period (out-of-sample) was the same:  $88.00.  Which one would I choose to use in the future?  I would use the first model with the two month paper trading period because it was able to capture more up and down price movement than the Trading Strategy with only one month of paper trading.

So how do you implement using templates to decide on the correct size of the data set for paper trading?  Simply create a Trading Strategy with your rule set, set the paper trading size and other Trading Strategy parameters and then save it as a template.  (There’s a button on the results screen that allows you to save the template.)  Next copy the Trading Strategy on the chart (right click on the Trading Strategy displayed on the chart and select copy) paste it on the chart and the right click once again and select modify.  Leave everything the same except change the amount of time for the paper trading period on the dates tab under Modify Trading Strategy Parameters.  Save this template as well as any other variations you want to test.

If you have NeuroShell Trader Power User or NeuroShell DayTrader Power User, you can open a new chart with multiple chart pages, and when you insert a new Trading Strategy, you can select several different Trading Strategy templates that you had previously saved.  The Trading will then start to optimize all of the Trading Strategy templates for all of the chart pages.  When optimization is finished, the results will be displayed, and you can check the ones that you want to have graphed on the chart.  As a final test, look for the Trading Strategies that produce trading signals on the peaks and valleys that occur during the paper trading and trading period to decide which models to use in the future.

Walkforward Testing

If you’re using the Trading Strategy template method described above, you will see the results for one instance of optimization, paper trading, and trading data in each Trading Strategy.  However, if you have enough historical data, you can view the results for multiple instances of those data sets by using the walkforward feature in the Trading Strategy Wizard.  (Walkforward optimization is a feature of the Power User versions only.)  With walkforward optimization, the Trader allows you to evaluate the paper trading and out-of-sample performance of a Trading Strategy that is reoptimized regularly on newer data.

First create your Trading Strategy rules, either in the Trading Strategy Wizard itself or by loading templates as described above, and then when you reach the Modify Trading Strategy Parameters button, go to the Advanced Tab and enter the number of walkforward tests you wish to run.  The number of tests will depend on the amount of data in your chart and the sizes of the optimization, paper trading, and trading data sets.  If you select two walkforwards with optimization, paper trading, and trading data sets, you’ll see results for walkforward 2 (beginning with the oldest data) for optimization, paper trading, and trading data sets; followed by results for walkforward 1 for the optimization, paper trading, and trading data sets; and finally walkforward 0 which displays results for the optimization and paper trading sets only.  If you decide to go forward with trading this model, it will be the model with trading rules and parameters found during walkforward 0 that will be used.

Just as we did with Trading Strategy templates,  you can copy a Trading Strategy that includes walkforward tests and change the amount of data included in the paper trading period to compare results.  You can also save Trading Strategies with walkforward tests as templates.

To learn more about walkforward testing, watch the video that you can access from the Trader’s Help menu.  Look in the Power User section at the bottom of the video list.

If you own a Power User version, click here to download a copy of these charts.

Using ChaosHunter Neural Nets in NeuroShell Trader
by Dr. Andrei Deviatov, ChaosHunter Developer

One of our customers wanted to implement a ChoasHunter model directly in NeuroShell Trader without calling the ChaosHunter formula with a .DLL indicator.  The problem was the ChaosHunter formula included a neural net, and he wanted to know which of the neural network add-ons to use to get the same results.

The N2, N3 and N4 neural nets in ChaosHunter are so simplistic that there are really no counterparts for them in NeuroShell Trader. The closest (and yet very distant) would be Ward nets in the Neural Indicators add-on. However, N2, N3 and N4 can be reproduced using the Indicator Wizard in NeuroShell Trader. For example, n2 = tanh (a*b+c*d), where tanh is hyperbolic tangent and a, b, c, and d are arbitrary inputs (really anything – constants, prices, or other indicators). Tanh is not found as a built-in indicator in NeuroShell Trader, but again can be easily reproduced using the exponent indicator since by definition:

tanh(x)=(1-exp(-2*x)) / (1+exp(-2*x))
Correspondingly: 
n3=tanh(a*b + c*d + e*f)
n4=tanh(a*b + c*d + e*f + g*h)

Was this article helpful?

Related Articles