TradersEdgeSystems.com

Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

March 2010 Stocks and Commodities Traders Tips


The Flat Base Breakout System (from January 2010 article)**:

AIQ Version:

Original article by Donald Pendergast
AIQ Code by Richard Denning

The AIQ code for Donald Pendergast’s Flat Base Breakout system from his January 2010 article, “The Search for Your Trading Style”, is shown below. In the article, the author uses a trend following system as an example of a trading style. The rules for the system as follows:

1) Go long on the first 55 day “flat” base break out when volatility is falling during the base period (using 7 day average true range (ATR)) and the Chaikin Money Flow is raising over the base period
2) Exit long positions using a 3 ATR trailing stop

After testing with just the above rules, I found that the trailing stop didn’t work very well to protect profits, so I added a profit protect stop that becomes active once the profit has reached 5%. I decided to protect 90% of the profit. I also set up a buy stop entry which uses the prior 55 day high for the entry level. I also added minimum price and volume filters ($5.00 and 300,000 average daily shares). I also insured that the 3 ATR trailing stop could never exceed 20% value by adding a 20% trailing stop. All exits are based on the closing price and then are exited at the next day’s opening price.

This is a long only system that I tested using my entire database for the period December 31, 1998 to January 8, 2010. In Figure 1, I show the equity curve and metrics for a portfolio trading simulation. During this period there were 2,145 signals generated of which about half were actually traded in the portfolio simulation once capitalization rules were added. The large drawdown from July 2007 to March 2009 indicates that the system might benefit from the addition of some simple market timing.

Captions:
Figure 1: Equity curve for the Flat Base Breakout system trading a portfolio of up to ten simultaneous positions together with the related metrics for the period December 31, 1998 to January 8, 2010.

EDS Code for Flat Base Breakout:
Flat Base BO.EDS
(right click and choose Save As)

**NOTE: Due to limitations of AIQ software, I decided to backtest the Flat Base Breakout system from January 2010 issue rather than the Empirical Mode Decomposition from the March 2010 issue. The code and testing of Empirical Mode Decomposition for Traders Studio is below.



Traders Studio Version of Empirical Mode Decomposition (from March 2010 Issue):

Original article by John F. Ehlers and Ric Way
Traders Studio Code by Richard Denning

The TradersStudio code for John Ehlers’ article, “Empirical Mode Decomposition” is shown below. I have supplied the indicator code as well as the code for a simple system (described below) that I devised to test the indicator. In Figure 1, I show the three indicators as they appear on an optimized chart of SPY. The indicator looks different than the examples the author shows in the article because I have changed the parameters based on an optimization. I created a simple system to test the indicator and then used it to find the appropriate range of parameters. In Figure 1, I am using parameters of Period = 85, Delta = 0.4, Fraction = 0.1 which represent one of the better parameter sets for the following system which trades only when the indicator is in the trending mode and steps aside when in the cycle mode:

1) Go long when the Mean of the Empirical indicator crosses over the upper band (AvgPeak)
2) Exit long when the Mean crosses down under the upper band
3) Go short when the Mean crosses under the lower band (AvgValley)
4) Exit short when the Mean crosses over the lower band

In Figure 2, I show a three dimensional parameter optimization map for the above system. The most sensitive parameter is the Fraction which is the one that sets the upper and lower bands. The right most parameter map in Figure 2 shows that this parameter is very sensitive and likes a very small value between 0.05 and 0.1 with larger values degrading rapidly. The other two parameters are more robust. In Figure 3, I show the resulting equity curve trading equal dollar amounts of SPY, DIA, QQQQ and IWB for the period June 2002 to December 2009.

Captions:
Figure 1: Empirical indicator with an exit signal and an entry signal.

Figure 2: A three dimensional parameter map for a trend following system that uses the Empirical indicator to signal trades.

Figure 3: Log equity (blue) and underwater equity (red) curves trading a portfolio of four ETFs (SPY, DIA, QQQQ, IWB) for the period June 2002 to December 2009.

Traders Studio Code for Empirical Mode Decomposition:
EHLERS_EMPIRICAL_SYS.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems