In this issue:
I. Using Chart Page Calculations and setting up a long/short hedging strategy by Denham Ward, lead developer of NeuroShell Trader
II. Build ensemble systems with models you edit in ChaosHunter by Marge Sherald
III. Commentary by Marge Sherald, CEO
********************************************************************************
I. Using Chart Page Calculations and setting up a long/short hedging strategy by Denham Ward, leader developer of NeuroShell Trader
NeuroShell Trader has a powerful category of portfolio analysis indicators called “Chart Page Calculations”. Standard indicators in NeuroShell Trader calculate their values across a single chart page. In contrast, the Chart Page Calculation indicators combine data across all the chart pages in a chart to create their calculations. After creating a chart with multiple chart pages, these indicators can provide the maximum, minimum, sum, average, count, standard deviation, z-score, percentile, upper rank or lower rank of a data series or calculation across all the chart pages. Although the Chart Page Indicators can provide many different types of portfolio analysis, for the purposes of this article I’m going to focus on how they can be used to setup a long/short hedging strategy.
Let’s say you have a basket of 20 stocks for which you wish to create a contrarian strategy of always being in the market long the 5 most oversold stocks and short the 5 most overbought stocks. The first step is to create a new chart and select the 20 stock ticker symbols so that a chart is created with each stock on a different chart page.
Next determine which standard indicator you will use to signal buy and sell conditions. When creating a hedging system which compares indicator values across chart pages, it’s important to choose an indicator which normalizes for price level differences such as percent change instead of using a non-normalized indicator like change. In addition to %change, you could use any of the normalized price momentum indicators like Stochastic or RSI, volume indicators like Money Flow or even a statistics indicator like z-score. For this example, let’s use the Relative Strength Indicator, which indicates overbought as values approach 100 and oversold as values approach 0.
Next we need to determine where each of the 20 stock’s RSI values rank relative to each other. For this we use the Chart Page Upper Rank and Chart Page Lower Rank indicators with the RSI indicator as their time series input. On any given bar, the Upper Rank will produce a value of 1 on the chart page with the highest RSI value, a value of 2 on the chart page with the 2nd highest RSI value and continue down to a value of 20 on the chart page with the lowest RSI value. The Lower Rank will do the exact opposite, with 1 for the chart page with the lowest RSI and 20 for the highest RSI.
Now we simply need to create a trading strategy that is long the 5 most oversold and 5 most overbought stocks. To do this, we create conditions that buy long when any chart page has a lower rank less than or equal to 5, sell long when the lower rank goes back above 5, sell short when any chart page has an upper rank less than or equal to 5 and cover short when the upper rank goes back above 5. The actual conditions in the Trading Strategy would be entered as follows:
Buy Long: A<=B( ChartPageLowerRank( RSI(Close, 10) ), 5 ) Sell Long: A>B( ChartPageLowerRank( RSI(Close, 10) ), 5 )
Sell Short: A<=B( ChartPageUpperRank( RSI(Close, 10) ), 5 ) Cover Short:A>B( ChartPageUpperRank( RSI(Close, 10) ), 5 )
Note that you will probably also want to choose a Position Sizing method such as Fixed Dollar or Percent of Account instead of size based methods if you wish to keep the total dollar amount invested long and short at approximately the same amount.
This strategy could also be optimized for not only the size of the RSI Periods, but also the actual number of simultaneous long and short positions at any given time. However, before optimizing, it should be noted that in order to maintain the constant 5 long and 5 short positions at any given time, the RSI period size (in this case 10) must be the same for each condition and thus the RSI Period range needs to be mapped to the same optimization link*. Likewise, if optimizing the number of long/short open positions (in this case 5), the optimization range for number positions must also be mapped to another optimization link for each of the 4 conditions above. Also note that the upper rank and lower rank indicators won’t provide values all the way to 20 when the input times series is N/A, so the RSI optimization range should range from 2 to xx as RSI periods of 1 can often give N/A values due to the nature of the RSI calculation.
Once the hedging strategy is built, you can verify that a constant 5 long and short (or whatever number the optimizer found to be optimal) is occurring by putting the Position indicator on the chart and displaying the Portfolio View. You could also further your understanding of the cross chart page trading interactions by adding a ChartPageSum of the System Equity to show the cumulative system equity across the 20 stock portfolio.
An example chart that illustrates this strategy, albeit a losing strategy in today’s trending markets, can be downloaded at XXXXX. As proven by the negative backtest results of the example chart, in today’s market climate you might be better off continuing to buy overbought stocks and continuing to sell the oversold ones.
*Linking Parameters
NeuroShell Trader allows you to “link” the lookback parameters so that they optimize to the same value. It does this by giving each such linked parameter a common name. (See the release the 6.0 video “Setting Optimization Ranges”.) Later when you match another parameter of the same name, that link is again inserted for you. If you match a large number of parameters it is a big time saver because you only have to change the range for the linked parameter in one place and it is automatically changed every time the link is used in the Trading Strategy.
****************************************************************************
II. Build ensemble systems with models you edit in ChaosHunter by Marge Sherald
I spent some more time playing with the ChaosHunter Formula Editor and wanted to report back. I exported some data from NeuroShell Trader for Deere (DE) and asked ChaosHunter to create a fairly simple model using all four arithmetic functions and -x and 1/x from the algebra category. Next I chose only two technical indicators, momentum and efficiency, applied to the open, high, low, and close time series. The model is built to reverse from a long to a short, so there are no exit conditions. ChaosHunter derived a fairly simple model based on two versions of the momentum indicator: Mom(Low,5) and Mom(Close,5) and a small formula that included the arithmetic indicators and -x. I went to the Formula Editor and began tweaking the number of periods in the momentum indicators until I liked what I found in both the optimization set and the out-of-sample data. I was primarily looking for models that produced trading signals at the peaks and valleys in the data. I changed the momentum indicators that were based on 5 periods to 4 and 6 periods, with everything else remaining as it was in the formula found by ChaosHunter. I saved each model with a different name and the .MD extension from ChaosHunter.
Next I wanted to create an ensemble system to add some robustness to the original ChaosHunter system. (See the topic Ensemble Estimators. The tip explains how ensemble estimators increase the probability of your model being correct.
For convenience, I copied all three .MD files to the NeuroShell Trader 6 template directory. Next I created a Trading Strategy in NeuroShell Trader that said to buy when 2 out of the 3 rules were true.
To create the trading rules with the ChaosHunter formulas, I first created three indicators in the Trader from the External Program & Library Calls category. I chose the ChaosHunter Signal version of the model. This signal tells you whether you should enter or exit a long or short position. You can examine this signal in the Trading Strategy Wizard to make a decision about when to take a position, instead of comparing the ChaosHunter Output to thresholds. The Signal implicitly knows about the thresholds.
Below are the signal values and meanings. The signal starts out at 0, which is a neutral (not in any position). The signal stays at a given value until a new entry or exit occurs.
signal = 1: Enter a long position on next bar.
signal = 0: Exit the current position on next bar and enter neutral.
signal = -1: Enter into a short position on the next bar.
To implement the ChaosHunter signal in a NeuroShell Trader Trading Strategy rule, use the A = B indicator from the Relational Category as follows:
Long Entry: signal = 1
Short Entry: signal = -1
For reference, the rule for a Long or Short exit would be signal = 0. Because my system was created as a true reversal in ChaosHunter, the Long and Short Exit rules were not used.
If you select true reversal in ChaosHunter, in NeuroShell Trader you need to turn on the option for Long/Short entries exit existing short/long positions on the Sizing tab in the Trading Strategy Parameters to insure the results will be the same.
The ensemble system results produced a slightly larger profit when running the ensemble system in Trader than running the single model found by ChaosHunter.
There were several keys to this experiment:
1. Begin with a somewhat simple model that lets ChaosHunter choose from a small number of technical indicators and functions.
2. Use the ChaosHunter Formula Editor to slightly tweak an already good model found by ChaosHunter.
3. Use both the ChaosHunter model and two tweaked versions of the model in an ensemble system in either ChaosHunter Trader or NeuroShell Trader to increase the probability of generating profitable trading signals.
Future expansion: Tweak the original ChaosHunter model slightly differently for the long and short sides.
******************************************************************************
III. Commentary by Marge Sherald, CEO
1. I know how frustrating building good models can be, even with my pick of the best tools in the business. I might want to build a model for a stock that caught my interest on the web that morning and find that no matter what I throw at it I’m just not getting good results. That’s when I remember what Steve Ward used to call Bizarro Models. The following is from the July 2011 newsletter, but I believe it has relevance for the summer markets which have different trading patterns.
Bizarro Models by Steve Ward
I have long believed that the markets are efficient in at least one way – if patterns emerge, then they MUST change eventually because if they don’t, too many people will detect the patterns and too many people will make money, which can’t happen. Most of us have experienced that often our models are just mostly wrong, usually after the training/optimization period ends. That happens if you overfit, but it can more also happen if you find good patterns, but the patterns change. So if your model always is wrong, then the opposite model may be at least usually right! There are tips on both the NeuroShell and ChaosHunter portions of ward.net to help you create opposite models. Look for “Bizarro Models”. They can make a huge difference in your success rate.
***********************************************************************