TradersEdgeSystems.com

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

May 2013 Stocks and Commodities Traders Tips


Detecting Head & Shoulders Algorithmically

AIQ Version:

Original article by Giorgos E. Siligardos
AIQ Code by Richard Denning

The code in the article by Giorgos E. Siligardos, “Detecting Head & Shoulders Algorithmically”, was not translated into AIQ EDS code since the AIQ program provides chart pattern recognition as part of the program. The code provided will find the H & S patterns as well as many other patterns for either a completed pattern or for an emerging pattern. In Figure 1, I show an example of a completed H & S topping pattern with the sell signal (red down arrow). The bars after the signal indicate that this trade was immediately profitable. In Figure 2, I show an example of a completed inverse H & S bottoming pattern with a buy signal (red up arrow). The bars after the signal indicate that this trade was immediately profitable.

Captions:

Figure 1 – Example of H & S topping pattern recognition with signal (red down arrow) on iShares Nasdaq Biotechnology (IBB).

Figure 2 – Example of inverse H & S bottoming pattern recognition with signal (red up arrow) on Alcoa (AA).

EDS Code:
Head & Shoulders.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by Dirk Vandycke
Traders Studio Code by Richard Denning

For the May issue, I substituted the January 2013 article by Dirk Vandycke, “The Chartmill Value Indicator”. TradersStudio is fully capable of handling all the code that is in the May issue Traders’ Tips article, but for personal reasons of time constraints with the large quantity of code to be translated and debugged, I opted for coding an indicator that was covered in the January 2013 . The CVI indicator is also appears in February and March 2013 issues by the same author.

The following code files are contained in the download below:

  • Function: “VALUE_SMA” returns the simple average of the median of two prices
  • Function: “CHARTMILL_VALUE” returns the indicator value
  • Indicator plot: “CVI_IND” indicator code that plots the Chartmill Value indicator and two horizontal lines
  • System: “CVI_SYS” a system that I devised to test signals from the indicator
The test system buys when the oscillator is below a certain level and exits when the indicator cross above the exit buy level. The reverse rules for shorts. I set up a test session using the SP futures contract (Pinnacle data). After optimizing the parameters in the system, I chose the parameter set (cviLen=10, buyLvl=-1, exitBuyLvl=0, sellLvl=1, exitSellLvl=0). In Figure 1, I show the Equity curve and underwater equity curve trading one contract from 1982 to 2013. In Figure 2, I show the indicator on a chart of SP with the buy, sell and exits.

Captions:
Figure 1 – Equity and underwater equity for the CVI_SYS system trading one contract of the SP from 1984 through 2013.

Figure 2 – CVI indicator on a chart of the SP with parameter length of 10.

Traders Studio Code:
CVI Indicator & System.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

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