December 2008
TRADERS' TIPS


Here is this month's selection of Traders' Tips, contributed by various developers of technical analysis software to help readers more easily implement some of the strategies presented in this and other issues.

You can copy these formulas and programs for easy use in your spreadsheet or analysis software. Simply "select" the desired text by highlighting as you would in any word processing program, then use your standard key command for copy or choose "copy" from the browser menu. The copied text can then be "pasted" into any open spreadsheet or other software by selecting an insertion point and executing a paste command. By toggling back and forth between an application window and the open Web page, data can be transferred with ease.

This month's tips include formulas and programs for:

or return to December 2008 Contents

TRADESTATION: HEIKIN-ASHI CANDLESTICK OSCILLATOR

In "Trading With The Heikin-Ashi Candlestick Oscillator" in this issue, author Sylvain Vervoort uses heikin-ashi techniques to provide visual aids that complement one another.

He suggests displaying the results of his calculations by coloring candlestick bars based on modified heikin-ashi rules. Vervoort provides two fully defined indicators, but makes it clear that "no system is perfect," and recommends that traders adapt the rules to suit their circumstances. With this in mind, we provide an EasyLanguage indicator (named "HA Candles Modified") with listed conditions that allow the user to easily modify the code and test Vervoort's rules.

To download the EasyLanguage code for this study, go to the TradeStation and EasyLanguage Support Forum (https://www.tradestation.com/Discussions/forum.aspx?Forum_ID=213). Search for the file "HA CandleStick.Eld." Translations of three studies included in the article, "HA Crossover," "UpTrend_HA," and "Hoac" are included in the Eld file.
This article is for informational purposes. No type of trading or investment recommendation, advice, or strategy is being made, given, or in any manner provided by TradeStation Securities or its affiliates.

FIGURE 1: TRADESTATION, HEIKIN-ASHI INDICATORS. In this sample TradeStation chart, Sylvain Vervoort's heikin-ashi indicators are plotted on a daily chart of General Electric (GE). The indicator "UpTrend_HA" is in the uppermost subgraph. It is what causes the price bars to be colored green and red. "HA Crossover" is in the subgraph directly below the price bars. "HACO" (heikin-ashi candlestick oscillator) is in the bottom subgraph. These three indicators are included in the file "HA CandleStick.Eld," available in the TradeStation and EasyLanguage Support Forum at TradeStation.com.

 

Indicator:  HA Candles Modified
inputs:	 
	HollowColor( White ), 
	UpTrendColor( DarkGreen ),
    	DnTrendColor( Red ),
	TEMALength( 34 ),
	WickWidth( 1 ), 
	BodyWidth( 3 ) ;

variables:	 
	BodySize( 0 ),
	Outline( 0 ),
	HaCValue( 0 ),
	HaOpenValue( 0 ),
	TMA1( 0 ),
	TMA2( 0 ),
	TMADiff( 0 ),
	ZlHa( 0 ),
	ZlCl( 0 ),
	ZlDiff( 0 ),
	Z1DiffPos( false ),
	HABasic( false ),
	DiffAndLastBasic( false ),
	UpSigns( false ),
	NoDojiReverse( false ),
	GreenBar( false ),
	Color( 0 ), 
	ColorW( 0 ) ;

Once
	begin
		
	switch BodyWidth
		begin
		case 2:
			BodySize = 1 ;
		case > 4:
			BodySize = 4 ;
		default:
			BodySize = BodyWidth ;
		end ;

	switch BodySize
		begin
		case 0:
			Outline = 2 ;
		case 1:
	 		Outline = 3 ;
		case 3:
			Outline = 4 ;
		default:
			Outline = 5 ;
		end ;

	end ;		

HaCValue = HaC ;
HaOpenValue = HaOpen ;

{ Crossover formula for trend determination }
TMA1 = TEMA( HaCValue, TEMALength ) ;
TMA2 = TEMA( TMA1, TEMALength ) ;
TMADiff = TMA1 - TMA2 ;
ZlHa = TMA1 + TMADiff ;
TMA1 = TEMA( MedianPrice, TEMALength ) ;
TMA2= TEMA( TMA1, TEMALength ) ;
TMADiff = TMA1 - TMA2 ; 
ZlCl = TMA1 + TMADiff ;
ZlDiff = ZlCl - ZlHa ;

{ trend determination }
Z1DiffPos = ZlDiff >= 0 ;
 
{ basic Heikin-Ashi condition }
HABasic = HaCValue >= HaOpenValue ; 

{ if prior bar was Green, then make this one green too }
DiffAndLastBasic = Z1DiffPos and HABasic[1] ; 

{ make one more green if "upwards signs" exist }
UpSigns = ( ( HABasic[2] and DiffAndLastBasic[1] ) or
 UpSigns[1] ) and ( Close >= Open or Close >=
 Close[1] ) ; 

{ don't let a Doji reverse an uptrend }
NoDojiReverse = ( AbsValue( Close - Open ) < ( High -
 Low ) * 0.35 and High >= Low[1] ) and ( HABasic or
 DiffAndLastBasic or UpSigns ) ;

GreenBar = HABasic or DiffAndLastBasic or UpSigns or
 NoDojiReverse ;

if GreenBar then
	begin

	ColorW = UpTrendColor ;

	if ( Close > Close[1] and Open < Close ) or
	 ( Close < Close[1] and Open > Close ) then
		Color = UpTrendColor 
	else
		Color = HollowColor ;
	
	end
else 
	begin

	ColorW = DnTrendColor ;
	
	if Close < Close[1] then
		begin
 		if Open > Close then
			Color = DnTrendColor 
		else
			Color = HollowColor ;
		end
	else if  Close > Close[1] then
 		begin
		if Open < Close then
			Color = HollowColor 
		else
			Color = DnTrendColor ;
		end ;

	end ;

{ outlined candles by "Solidus," see:  https://www.
tradestation.com/Discussions/Topic.aspx?Topic_ID=67474 }

Plot1( Close, "C Outline A", ColorW, 0, Outline ) ;
Plot2( Close, "C Outline B" ) ;
Plot3( Open, "O Outline A", ColorW, 0, Outline ) ;
Plot4( Open, "O Outline B" ) ;
Plot5( Close, "C", Color, 0, Bodysize ) ; 
Plot6( Open, "O" ) ; 
Plot7( Close, "C Outline", ColorW, 0, Outline ) ; 
Plot8( Open, "O Outline" ) ; 
Plot9( High, "H", ColorW, 0, WickWidth ) ; 
Plot10( Low, "L" ) ;

Function:  HaC
HaC = 0.25 * ( AvgPrice + HaOpen + MaxList( High,
 HaOpen ) + MinList( Low, HaOpen ) ) ;

Function:  HaOpen
HaOpen = 0.5 * ( AvgPrice[1] + HaOpen[1] ) ;

--Mark Mills
TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.
www.TradeStation.com


BACK TO LIST

WEALTH-LAB: HEIKIN-ASHI CANDLESTICK OSCILLATOR

In "Trading With The Heikin-Ashi Candlestick Oscillator" in this issue, Sylvain Vervoort guides us step by step in an entertaining tutorial on building a customized candlestick oscillator. Utilizing the heikin-ashi chart's consistency, it provides an overlay tool that allows for some discretion to help hold onto a profitable trade (Figure 2).

The heikin-ashi candlestick oscillator (Haco) is available to Wealth-Lab Developer 5 users. To power your chart analysis with Haco, just select «Extension Manager» from the Tools menu to update the "Tasc Indicators" library (open source).

FIGURE 2: WEALTH-LAB, Heikin-Ashi Candlestick Oscillator (HACO). Here is how HACO signaled a downtrend in euros in summer 2008.

  Strategy Code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;

namespace WealthLab.Strategies
{
	public class HACO_Demo : WealthScript
	{
		// Create parameter sliders
		
		private StrategyParameter TemaPeriod;
		private StrategyParameter timeoutPeriod;
		
		public HACO_Demo()
		{
			TemaPeriod = CreateParameter("TEMA Period", 34, 10, 120, 1);
			timeoutPeriod = CreateParameter("Timeout", 2, 1, 3, 1);
		}		
		
		protected override void Execute()
		{
			// Plot HACO

			int period = TemaPeriod.ValueInt;
			HACO haco = HACO.Series( Bars, period, timeoutPeriod.ValueInt );
			ChartPane hacoPane = CreatePane( 20, true, true );
			PlotSeries( hacoPane, haco, Color.BlueViolet, LineStyle.Solid, 2 );
			HideVolume();
			
			for(int bar = period*3; bar < Bars.Count; bar++)
			{
				if ( haco[bar] == 1 )
				{
					SetBarColor( bar, Color.FromArgb( 130, Color.Green ) );
					SetBackgroundColor( bar, Color.FromArgb( 50, Color.Green ) );
				}
				else if ( haco[bar] < 1 )
				{
					SetBarColor( bar, Color.FromArgb( 130, Color.Red ) );
					SetBackgroundColor( bar, Color.FromArgb( 50, Color.Red ) );
				}
			}
		}
	}
}

--Eugene
www.wealth-lab.com


BACK TO LIST

AMIBROKER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

In the article "Trading With The Heikin-Ashi Candlestick Oscillator" in this issue, author Sylvain Vervoort presents an oscillator derived from a transformation of a heikin-ashi charting technique originally introduced by Dan Valcu in a Stocks & Commodities article in 2004.

The implementation of Haco (heikin-ashi candlestick oscillator) in AmiBroker is straightforward compared to the MetaStock code presented in the article. We simply wrapped a zero-lag TEMA (triple exponential moving average) into a function so we can call it multiple times without code repetition. Also added is a parameter that controls the Haco binary wave display correlated with the background color in the candlestick chart indicating long/short positions.

The formula is presented in Listing 1. To use it, simply enter the code in the AmiBroker Formula Editor, then choose Tools->Apply Indicator menu from the editor. You can use the Parameters window (available from the right-click menu) to set the period for the Tema filter and to switch the chart type.
A sample chart is shown in Figure 3.

FIGURE 3: AMIBROKER, HACO.Here is a daily chart of General Electric (GE) with a red background indicating short positions and green indicating long positions. The upper pane shows the HACO binary wave.

LISTING 1
function ZeroLagTEMA( array, period ) 
{ 
 TMA1 = TEMA( array, period ); 
 TMA2 = TEMA( TMA1, period ); 
 Diff = TMA1 - TMA2; 
 return TMA1 + Diff ; 
} 

///////////////////// 
// Heikin-Ashi code 
HaClose = (O+H+L+C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 

avp = Param("Up TEMA avg", 34, 1, 100 ); 
avpdn = Param("Dn TEMA avg", 34, 1, 100 ); 

// Velvoort is using not original, but modified Heikin-Ashi close 
HaClose = ( HaClose + HaOpen + Max( H, HaOpen ) + Min( L, HaOpen ) )/4; 

// up average 
ZlHa = ZeroLagTEMA( HaClose, avp ); 
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avp ); 
ZlDif = ZlCl - ZlHa; 

keep1 = Hold( HaClose >= HaOpen, 2 ); 
keep2 = ZlDif >= 0; 
keeping = keep1 OR keep2; 
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C > O ) OR C >= Ref( C, -1 ) ); 
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND H >= Ref( L, -1 ); 
utr = keepall OR ( Ref( keepall, -1 ) AND keep3 ); 

// dn average 
ZlHa = ZeroLagTEMA( HaClose, avpdn ); 
ZlCl = ZeroLagTEMA( ( H + L ) / 2, avpdn ); 
ZlDif = ZlCl - ZlHa; 

keep1 = Hold( HaClose < HaOpen, 2 ); 
keep2 = ZlDif < 0; 
keeping = keep1 OR keep2; 
keepall = keeping OR ( Ref( keeping, -1 ) AND ( C < O ) OR C < Ref( C, -1 ) ); 
keep3 = abs( C - O ) < ( H - L ) * 0.35 AND L <= Ref( H, -1 ); 
dtr = keepall OR ( Ref( keepall, -1 ) AND keep3 ); 

upw = dtr == 0 AND Ref( dtr, -1 ) AND utr; 
dnw = utr == 0 AND Ref( utr, -1 ) AND dtr; 

Haco = Flip( upw, dnw ); 


if( ParamToggle("Chart Type", "Price with color back|HACO wave" ) ) 
{ 
 Plot( Haco, "Haco", colorRed ); 
} 
else 
{ 
 Plot( C, "Close", colorBlack, 
       ParamStyle( "Style", styleCandle, maskPrice ) ); 
 Plot( 1, "", IIf( Haco , colorPaleGreen, colorRose ), 
       styleArea | styleOwnScale, 0, 1 ); 
}

--Tomasz Janeczko, AmiBroker.com
www.amibroker.com


BACK TO LIST

eSIGNAL: HEIKIN-ASHI CANDLESTICK OSCILLATOR

For this month's Traders' Tip, we've provided the eSignal formula "Haco.efs," based on the formula code from Sylvain Vervoort's article in this issue, "Trading With The Heikin-Ashi Candlestick Oscillator." Figure 4 is a sample chart.

To discuss this study or download a complete copy of the formula code, please visit the Efs Library Discussion Board forum under the Forums link at www.esignalcentral.com or visit our Efs KnowledgeBase at www.esignalcentral.com/support/kb/efs/. The eSignal formula scripts (Efs) are also available for copying and pasting from the Stocks & Commodities website at Traders.com.

FIGURE 4: eSIGNAL, HACO. This sample eSignal chart shows the heikin-ashi candlestick oscillator.

/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2008. All rights reserved. This sample eSignal 
    Formula Script (EFS) is for educational purposes only and may be 
    modified and saved under a new file name.  eSignal is not responsible
    for the functionality once modified.  eSignal reserves the right 
    to modify and overwrite this EFS file with each new release.

Description:        
    Heikin-Ashi Candelstick Oscillator (HACO) 

Version:            1.0  10/08/2008

Notes:
    The related article is copyrighted material. If you are not
    a subscriber of Stocks & Commodities, please visit www.traders.com.

Formula Parameters:                     Default:
    Long Positions Color                  Lime
    Short Positions Color                 Red
    Up TEMA Average Length                 34
    Down TEMA Average Length               34
**********************************/

var fpArray = new Array();
var bInit = false;
var bVersion = null;

function preMain() {
    setPriceStudy(true);
    setShowCursorLabel(false);
    setShowTitleParameters( false );
    setStudyTitle("Heikin-Ashi Candelstick Oscillator");
    setDefaultBarBgColor(Color.white, 0);    
    var x=0;
    fpArray[x] = new FunctionParameter("UpColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Long Positions Color");
        setDefault(Color.RGB(160, 255, 160));
    }    
    fpArray[x] = new FunctionParameter("DnColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Short Positions Color");
        setDefault(Color.RGB(255,160,160));
    }    
    fpArray[x] = new FunctionParameter("Avg", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setName("Up TEMA Average Length");
        setLowerLimit(1);		
        setDefault(34);
    }
    fpArray[x] = new FunctionParameter("Avgdn", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setName("Down TEMA Average Length");
                setLowerLimit(1);		
        setDefault(34);
    }
}

var xhaOpen = null;
var xhaC = null;
var xTMA1 = null;
var xTMA2 = null;
var xTMA1_hl2 = null;
var xTMA2_hl2 = null;
var xTMA1_2 = null;
var xTMA2_2 = null;
var xTMA1_hl2_2 = null;
var xTMA2_hl2_2 = null;
var bkeeping = false;
var bkeeping_Ref = false;
var bkeepall = false;
var bkeepall_Ref = false;
var bkeeping1 = false;
var bkeeping1_Ref = false;
var bkeepall1 = false;
var bkeepall1_Ref = false;
var butr = false;
var bdtr = false;
var butr_Ref = false;
var bdtr_Ref = false;
var nhaOpen = 0;
var nhaOpen_Ref = 0;
var nRes = 0;
var nRef = 0;

function main(Avg, Avgdn, UpColor, DnColor) {
var nState = getBarState();
var nhaC = 0;
var nDiff = 0;
var nZlDif = 0;
var nZlHa = 0;
var nZlCl = 0;
var nTMA1 = 0;
var nTMA2 = 0;
var nTMA1_hl2 = 0;
var nTMA2_hl2 = 0;
var bkeep1 = false;
var bkeep2 = false;
var bkeep3 = false;
var nupw = 0;
var ndnw = 0;

    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;   
    if ( bInit == false ) { 
        xhaOpen = efsInternal("Calc_haOpen", ohlc4());
        xhaC = efsInternal("Calc_haC", ohlc4(), xhaOpen);
        xTMA1 = efsInternal("TEMA", xhaC, Avg);
        xTMA2 = efsInternal("TEMA", xTMA1, Avg);
        xTMA1_hl2 = efsInternal("TEMA", hl2(), Avg);
        xTMA2_hl2 = efsInternal("TEMA", xTMA1_hl2, Avg);
        xTMA1_2 = efsInternal("TEMA", xhaC, Avgdn);
        xTMA2_2 = efsInternal("TEMA", xTMA1_2, Avgdn);
        xTMA1_hl2_2 = efsInternal("TEMA", hl2(), Avgdn);
        xTMA2_hl2_2 = efsInternal("TEMA", xTMA1_hl2_2, Avgdn);
        bInit = true; 
    } 

    if (nState == BARSTATE_NEWBAR) {
        bkeeping_Ref = bkeeping;
        bkeepall_Ref = bkeepall;
        bkeeping1_Ref = bkeeping1;
        bkeepall1_Ref = bkeepall1;
        butr_Ref = butr;
        bdtr_Ref = bdtr;
        nhaOpen_Ref = nhaOpen;
        nRef = nRes;        
    }

    nTMA1 = xTMA1.getValue(0);
    nTMA2 = xTMA2.getValue(0);
    nTMA1_hl2 = xTMA1_hl2.getValue(0);
    nTMA2_hl2 = xTMA2_hl2.getValue(0);
    nDiff = nTMA1 - nTMA2;
    nZlHa = nTMA1 + nDiff;
    nDiff = nTMA1_hl2 - nTMA2_hl2;
    nZlCl = nTMA1_hl2 + nDiff;
    nZlDif = nZlCl - nZlHa;
    bkeep1 = Alert1(xhaC, xhaOpen, 2);
    if (nZlDif >= 0)
        bkeep2 = true 
    else 
        bkeep2 = false;
    if (bkeep1 || bkeep2)
        bkeeping1 = true
    else 
        bkeeping1 = false;
    if (bkeeping1 || (bkeeping1_Ref && (close(0) >= open(0)) || close(0) >= close(-1))) 
        bkeepall1 = true
    else 
        bkeepall1 = false;
    if (Math.abs(close(0) - open(0)) < (high(0) - low(0)) * 0.35 && high(0) >= low(-1))
        bkeep3 = true
    else
        bkeep3 = false;
    if (bkeepall1 || (bkeepall1_Ref && bkeep3))
        butr = true;
    else
        butr = false;

    nTMA1 = xTMA1_2.getValue(0);
    nTMA2 = xTMA2_2.getValue(0);
    nTMA1_hl2 = xTMA1_hl2_2.getValue(0);
    nTMA2_hl2 = xTMA2_hl2_2.getValue(0);
    nDiff = nTMA1 - nTMA2;
    nZlHa = nTMA1 + nDiff;
    nDiff = nTMA1_hl2 - nTMA2_hl2;
    nZlCl = nTMA1_hl2 + nDiff;
    nZlDif = nZlCl - nZlHa;
    bkeep1 = Alert2(xhaC, xhaOpen, 2);
    if (nZlDif < 0)
        bkeep2 = true
    else    
        bkeep2 = false;
    
    if (Math.abs(close(0) - open(0)) < (high(0) - low(0)) * 0.35 && low(0) <= high(-1))
        bkeep3 = true;
    else 
        bkeep3 = false;
    if (bkeep1 || bkeep2) 
        bkeeping = true;
    else 
        bkeeping = false;
    if (bkeeping || (bkeeping_Ref && (close(0) < open(0)) || close(0) < close(-1)))
        bkeepall = true
    else 
        bkeepall = false;
    if(bkeepall || (bkeepall_Ref && bkeep3) == true)
        bdtr = true
    else
        bdtr = false;
    if (bdtr == false && bdtr_Ref && butr)
        nupw = 1     
    else
        nupw = 0;     
    if (butr == false && butr_Ref && bdtr)
        ndnw = 1
    else 
        ndnw = 0;
    if (nupw == 1)
        nRes = 1
    else 
        if(ndnw == 1)
          nRes = 0
        else 
                    nRes = nRef;

    if (nRes == 1) 
        setDefaultBarBgColor(UpColor, 0);    
    else 
        if (nRes == 0)
            setDefaultBarBgColor(DnColor, 0);    
    return; 
}

function Calc_haOpen(xOHLC4) {
var nRes = 0;
var nRef = ref(-1);
    if (nRef == null) nRef = 1;
    if (xOHLC4.getValue(-1) == null) return;
    nRes = (xOHLC4.getValue(-1) + nRef) / 2;
    if (nRes == null) return;
    return nRes;
}

function Calc_haC(xOHLC4, xhaOpen) {
var nhaOpen = 0;
var nRes = 0;
    if (xOHLC4.getValue(-1) == null) return;
    nhaOpen = xhaOpen.getValue(0);
    nRes = (xOHLC4.getValue(0) + nhaOpen + Math.max(high(0), nhaOpen) + Math.min(low(0), nhaOpen)) / 4;
    if (nRes == null) return;
    return nRes;
}

function Alert1(xhaC, xhaOpen, Length) {
var bRes = true;
    for (var i = 1; i  Length; i++) {
        if (xhaC.getValue(-i) < xhaOpen.getValue(-i)) bRes = false; // >=
    }
    return bRes;
}

function Alert2(xhaC, xhaOpen, Length) {
var bRes = true;
    for (var i = 1; i < Length; i++) {
        if (xhaC.getValue(-i) >= xhaOpen.getValue(-i)) bRes = false; // <
    }
    return bRes;
}

var xEMA1 = null;
var xEMA2 = null;
var xEMA3 = null;
var bInitTEMA = false; 
        
function TEMA(xPrice, Length) {
var nTEMA = 0;
    if ( bInitTEMA == false ) { 
        xEMA1 = ema(Length, xPrice);
        xEMA2 = ema(Length, xEMA1);
        xEMA3 = ema(Length, xEMA2);        
        bInitTEMA = true; 
    } 

    if (xEMA1.getValue(0) == null || xEMA2.getValue(0) == null || xEMA3.getValue(0) == null) return;
    nTEMA = 3 * xEMA1.getValue(0) - 3 * xEMA2.getValue(0) + xEMA3.getValue(0);
    return nTEMA;
}


function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=https://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    return b;
}

        

--Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com


BACK TO LIST

NEUROSHELL TRADER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

The heikin-ashi candlestick oscillator and trading system described by Sylvain Vervoort in his article in this issue can be easily implemented in NeuroShell Trader using the NeuroShell Trader's ability to call external programs. The programs may be written in programming languages such as C, C++, Power Basic, or Delphi.

FIGURE 5: NeuroShell, HACO. Here is a sample NeuroShell chart demonstrating the heikin-ashi candlestick oscillator and corresponding trading system.

After moving the MetaStock code given in the article to your preferred compiler, you can insert the resulting heikin-ashi candlestick oscillator (Haco) indicators into a chart (see Figure 5) as follows:

1. Select "New Indicator …" from the Insert menu.
2. Choose the External Program & Library Calls category.
3. Select the appropriate External Dll Call indicator.
4. Set up the parameters to match your Dll and select "Indicator output is a Boolean value."
5. Select the Finished button.

To create a heikin-ashi candlestick oscillator–based reversal trading system, select "New Trading Strategy …" from the Insert menu and enter the following in the appropriate locations of the Trading Strategy Wizard:

	Buy Long Market order if all of the following are true:
	   HACO( Open, High, Low, Close, 34, 34 )

	Sell Long Market order if all of the following are true:
	   Not( HACO( Open, High, Low, Close, 34, 34 ) )

If you have NeuroShell Trader Professional, you can also choose whether the system parameters should be optimized.

After backtesting the trading strategies, use the "Detailed Analysis…" button to view the backtest and trade-by-trade statistics for the trading strategy.

Users of NeuroShell Trader can go to the Stocks & Commodities section of the NeuroShell Trader free technical support website to download a copy of this or any past Traders' Tips.

--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com


BACK TO LIST

NEOTICKER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

In the article "Trading With The Heikin-Ashi Candlestick Oscillator" in this issue, author Sylvain Vervoort uses heikin-ashi candle rules to highlight trend changes in price bars. This coloring algorithm can be implemented in NeoTicker using formula language.

The formula indicator is called "Tasc Uptrend HA" (Listing 1) with one parameter, avg, that allows the user to adjust the number of periods that Tema is calculated (the default is 34). This indicator plots vertical color bars that mark the highs and lows of the underlying data series (Figure 6).

The Haco oscillator and background coloring can be produced from the same indicator code by changing the plot value settings (refer to NeoTicker blog site for details).

A downloadable version of this indicator will be available at the NeoTicker blog site (https://blog.neoticker.com).

FIGURE 6: NEOTICKER, HACO INDICATOR.

LISTING 1
$avg := param1;
haOpen := ((O(1)+H(1)+L(1)+C(1))/4 + haOpen(1))/2;
haC := ((O+H+L+C)/4+haOpen+maxlist(H,haOpen)+minlist(L,haOpen))/4;
TMA1 := tema(haC,$avg);
TMA2 := tema(TMA1,$avg);
$myDiff := TMA1-TMA2;
$ZlHa := TMA1+$myDiff;
TMA1 := tema(((h+l)/2), $avg);
TMA2 := tema(TMA1, $avg);
$myDiff := TMA1-TMA2;
$ZlCl := TMA1+$myDiff;
$ZlDif := $ZlCl-$ZlHa;
$keep1 := (haC(1)>=haOpen(1)) and (haC>=haOpen);
$keep2 := $ZlDif>=0;
keeping := $keep1>0 or $keep2>0;
keepall := keeping>0 or (keeping(1)>0 and C>=O or C>=C(1));
$keep3 := absvalue(C-O)<((H-L)*0.35) and H>=L(1);
utr := keepall>0 or (keepall(1)>0 and $keep3>0);
$keep1 := (haC(1)<0;
$keep3 := (absvalue(C-O)<(H-L)*0.35) and L<=H(1);
keeping := $keep1>0 or $keep2>0;
keepall := keeping>0 or (keeping(1)>0 and C0) or (keepall(1)>0 and C0) and (utr>0);
$dnw := (utr=0) and (utr(1)>0) and (dtr>0);
plot1 := h;
plot2 := l;
plot3 := choose($upw>0, clgreen,$dnw>0, clred, plot3(1));
success1 := barsnum(0) > $avg;
success2 := barsnum(0) > $avg;
success3 := barsnum(0) > $avg;
<O or C>0) or (keepall(1)>0 and C0) and (utr>0);
$dnw := (utr=0) and (utr(1)>0) and (dtr>0);
plot1 := h;
plot2 := l;
plot3 := choose($upw>0, clgreen,$dnw>0, clred, plot3(1));
success1 := barsnum(0) > $avg;
success2 := barsnum(0) > $avg;
success3 := barsnum(0) > $avg;

--Kenneth Yuen, TickQuest Inc.
www.tickquest.com


BACK TO LIST

AIQ: HEIKIN-ASHI CANDLESTICK OSCILLATOR

The AIQ code for Sylvain Vervoort's Haco indicator from his article, "Trading With The Heikin-Ashi Candlestick Oscillator," is shown here. In Figure 7, I show both the color study and the oscillator on a recent chart of Wells Fargo. Due to time constraints, I was not able to run any tests of the indicator.

The code can be downloaded from the Aiq website at www.aiqsystems.com and also from www.tradersedgesystems.com/traderstips.htm.

FIGURE 7: AIQ, HACO INDICATOR. Here is a chart of Wells Fargo & Co. showing both the color study and the HACO indicator.

   

!! TRADING WITH HEIKIN-ASHI CANDLESTICK OSCILLATOR
! Author: Sylvain Vervoort, TASC, December 2008
! Coded by: Richard Denning

! CODING ABBREVIATIONS:
H is [high].
H1 is valresult(H,1).
L is [low].
L1 is valresult(L,1).
C is [close].
C1 is valresult(C,1).
O is [open].
V is [volume].

! INPUTS:
emaLen is 34.

!-------------------------HEIKIN-ASHI-----------------------------------
haC is (O + H +L + C) / 4.
DaysInto is ReportDate() - RuleDate().
end if DaysInto > 30.
endHAO is iff(end,O, haO).
haO is (valresult(endHAO,1) + valresult(haC,1)) / 2.
haH is Max(H,max(haO,haC)).
haL is Min(L,min(haO,haC)).
haCL is (haC + haO + haH + haL) / 4.
!---------------------end HEIKIN-ASHI---------------------------------

!---------------TYPICAL PRICE ZERO-LAG TEMA----------------
TP is (H+L+C)/3.
TMA1 is expavg(TP,emaLen).
TMA2 is expavg(TMA1,emaLen).

TMA3 is expavg(TMA2,emalen).
tpTEMA1 is 3*TMA1-3*TMA2+TMA3.
TMA4 is expavg(tpTEMA1,emaLen).
TMA5 is expavg(TMA4,emaLen).
TMA6 is expavg(TMA5,emalen).
tpTEMA2 is 3*TMA4-3*TMA5+TMA6.
Diff2 is tpTEMA1 - tpTEMA2.
zLAGtp is tpTEMA1 + Diff2.
!-----------end TYPICAL PRICE ZERO-LAG TEMA----------------

!-----------------HEIKIN-ASHI ZERO-LAG TEMA--------------------
haTMA1 is expavg(haCL,emaLen).
haTMA2 is expavg(haTMA1,emaLen).
haTMA3 is expavg(haTMA2,emalen).
haTEMA1 is 3*haTMA1-3*haTMA2+haTMA3.
haTMA4 is expavg(haTEMA1,emaLen).
haTMA5 is expavg(haTMA4,emaLen).
haTMA6 is expavg(haTMA5,emalen).
haTEMA2 is 3*haTMA4-3*haTMA5+haTMA6.
Diff3 is haTEMA1 - haTEMA2.
zLAGha is haTEMA1 + Diff3.
!----------end HEIKIN-ASHI ZERO-LAG TEMA----------------------

zLAGdif is zLAGtp - zLAGha.

!------------------ HA CANDLE COLOR CODE-------------------------
rule1 if haCL >= haO or valrule(haCL >= haO,1).
rule2 if zLAGdif >= 0.
r1r2 if rule1 or rule2.
ruleA if r1r2 or (valrule(r1r2,1) and (C>=O or C>C1)).
rule3 if abs(C-O)<(H-L)*0.35 and H>=L1.
utr if ruleA or (valrule(ruleA,1) and rule3).
rule4 if haCL < haO or valrule(haCL < haO,1).
rule5 if zLAGdif < 0.
rule6 if abs(C-O)<(H-L)*0.35 and L>H1.
r4r5 if rule4 or rule5.
ruleB if r4r5 or (valrule(r4r5,1) and (C<O or C<C1)).
dtr if ruleB or (valrule(ruleB,1) and rule6).
upw if not dtr and valrule(dtr,1) and utr.
dnw if not utr and valrule(utr,1) and dtr.
endRes is iff(end,0,res).
res is iff(upw,1,iff(dnw,0,valresult(endRes,1))).

green if res = 1. !! USE THIS RULE FOR COLOR GREEN BAR

red if res = 0. !! USE THIS RULE FOR RED COLOR BAR

HACO is res. !! PLOT HACO AS CUSTOM INDICATOR

!---------------end HA CANDLE COLOR CODE-------------------------

--Richard Denning
For AIQ Systems
richard.denning@earthlink.net


BACK TO LIST

TRADERSTUDIO: HEIKIN-ASHI CANDLESTICK OSCILLATOR

Here is the TradersStudio code for Sylvain Vervoort's Haco indicator based on his article in this issue, "Trading With The Heikin-Ashi Candlestick Oscillator."

In Figure 8, I show both the color study and the oscillator on a recent chart of natural gas. Due to time constraints, I was not able to run any tests of the indicator.

FIGURE 8: TRADERSTUDIO, HACO INDICATOR. Here is a sample chart of natural gas with both the color study and the HACO indicator.

The code can be downloaded from the TradersStudio website at www.TradersStudio.com ->Traders Resources->FreeCode and also from www.TradersEdgeSystems.com/traderstips.htm.

Sub HA_OSC(xmaLen,startWith)

    'xmaLen = 34
    'green candle: startWith = 1
    'red candle: startWith = 0
    Dim haC As BarArray
    Dim haO As BarArray
    Dim haH As BarArray
    Dim haL As BarArray
    Dim haCL As BarArray
    haC = (O+H+L+C)/4
    haO = IIF(BarNumber = FirstBar,O,(haO[1] + haC[1])/2) 
    haH = Max(H,haO)
    haL = Min(L,haO)
    haCL = (haC+haO+haH+haL)/4
        
    Dim zeroHAtemaa As BarArray
    Dim haTMA1, haTMA2, haTMA3, haTMA4, haTMA5, haTMA6, haTEMA1, haTEMA2, diff1
    haTMA1 = XAverage(haCL,xmaLen)
    haTMA2 = XAverage(haTMA1,xmaLen)
    haTMA3 = XAverage(haTMA2,xmaLen)
    haTEMA1 = 3*haTMA1-3*haTMA2+haTMA3
    haTMA4 = XAverage(haTEMA1,xmaLen)
    haTMA5 = XAverage(haTMA4,xmaLen)
    haTMA6 = XAverage(haTMA5,xmaLen)
    haTEMA2 = 3*haTMA4-3*haTMA5+haTMA6

    
diff1 = haTEMA1 - haTEMA2
zeroHAtemaa = haTEMA1 + diff1

Dim zeroLagTPP As BarArray
Dim tp, tma1, tma2, tma3, tpTEMA1, tma4, tma5, tma6, tpTEMA2, diff2
tp = (H+L+C)/3
tma1 = XAverage(tp,xmaLen)
tma2 = XAverage(tma1,xmaLen)
tma3 = XAverage(tma2,xmaLen)
tpTEMA1 = 3*tma1-3*tma2+tma3
tma4 = XAverage(tpTEMA1,xmaLen)
tma5 = XAverage(tma4,xmaLen)
tma6 = XAverage(tma5,xmaLen)
tpTEMA2 = 3*tma4-3*tma5+tma6
diff2 = tpTEMA1 - tpTEMA2
zeroLagTPP = tpTEMA1 + diff2

Dim k1, k2,k3,k4,k5,k6
Dim zeroLdif,upw,dnw
Dim dtr As BarArray
Dim utr As BarArray
Dim k1k2 As BarArray
Dim k4k5 As BarArray
Dim keepA As BarArray
Dim keepB As BarArray
Dim res As BarArray
zeroLdif = zeroLagTPP - zeroHAtemaa
k1 = IIF(haCL >= haO Or haCL[1] >= haO[1],1,0)
k2 = IIF(zeroLdif >= 0,1,0)
k1k2 = IIF(k1 = 1 Or k2 = 1,1,0)
keepA = IIF(k1k2 = 1 Or (k1k2[1] = 1 And (C>=O Or C>C[1])),1,0)
k3 = IIF(Abs(C-O)<(H-L)*0.35 And H >= L[1],1,0)
utr = IIF(keepA = 1 Or (keepA[1] = 1 And k3 = 1),1,0)
k4 = IIF(haCL < haO Or haCL[1] < haO[1],1,0)
k5 = IIF(zeroLdif < 0,1,0)
k6 = IIF(Abs(C-O)<(H-L)*0.35 And L>H[1],1,0)
k4k5 = IIF(k4 = 1 Or k5 = 1,1,0)
keepB = IIF( k4k5 = 1 Or (k4k5[1] = 1 And (C<O Or C<C[1])),1,0)
dtr = IIF(keepB = 1 Or (keepB[1] = 1 And k6 = 1),1,0)
upw = IIF(dtr = 0 And dtr[1] = 1 And utr = 1,1,0)
dnw = IIF(utr = 0 And utr[1] = 1 And dtr = 1,1,0)
If BarNumber = FirstBar Then
res = startWith
Else
res = IIF(upw = 1,1,IIF(dnw = 1,0,res[1]))
End If
plot1(res)

If res = 1 Then
barcolor(0) = vbGreen
Else
barcolor(0) = vbRed
End If
End Sub

--Richard Denning
For TradersStudio
richard.denning@earthlink.net


BACK TO LIST

STRATASEARCH: HEIKIN-ASHI CANDLESTICK OSCILLATOR

In "Trading With The Heikin-Ashi Candlestick Oscillator" in this issue, author Sylvain Vervoort gives us a helpful way to trade candlestick patterns. Using the traditional heikin-ashi pattern as a base, we have a complete indicator that provides a good foundation for further exploration.

Using the Haco indicator on its own, the results proved to be a good starting point. The indicator did a good job of letting the winning trades continue while cutting the losing trades short. The system also produced a large number of trades, which is helpful for additional filtering. However, profitability per trade was rather low, running about 40% for the Nasdaq 100 and S&P 500 components from 2004 to 2007.

In a separate test, the Haco was run alongside a variety of supporting trading rules. In just a short time, we were able to improve profitability per trade, increase the returns, and cut the holding periods nearly in half. Thus, the Haco can greatly benefit from the use of supporting indicators.

As with all other Traders' Tips, additional information, including plug-ins, can be found in the shared area of the StrataSearch user forum. This month's plug-in contains a number of prebuilt trading rules that will allow you to include this indicator in your automated searches. Simply install the plug-in and let StrataSearch identify the benefits of using this indicator alongside other trading rules.
See Figure 9 for a sample chart.

FIGURE 9: STRATASEARCH, HACO. In the center panel, green identifies long positions while red identifies short positions.

Editor's note: The Strata-Search code is not shown here but can be found at our website at www.traders.com in the Traders' Tips area.

--Pete Rast
Avarin Systems, Inc.
www.StrataSearch.com


BACK TO LIST

WORDEN BROTHERS STOCKFINDER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

Note: To use the indicators, rules, and charts discussed here, you will need the StockFinder software. Go to www.StockFinder.com to download the software and get a free trial.

The heikin-ashi candlestick oscillator (Haco) from Sylvain Vervoort's article in this issue can be implemented in StockFinder using RealCode.

RealCode is based on the Microsoft Visual Basic.Net framework and uses the Visual Basic (VB) language syntax. RealCode is compiled into a .Net assembly and run by our StockFinder application. Unlike the scripting language that other trading applications use, RealCode is fully compiled and runs at the same machine-language level as the StockFinder application itself. This gives you unmatched performance running at the same speed as if we (the developers of StockFinder) wrote the code ourselves, with the flexibility of "run-time development and assembly" that you get by writing your own custom code.

FIGURE 10: STOCKFINDER, HACO. Long positions are displayed with a green background and short positions in red. To load this chart in StockFinder, click the Shared Items button on the toolbar and search for "HACO" on the Charts tab.

The Haco chart in Figure 10 can be added to your layout by clicking the Share menu in StockFinder and searching for "Haco" on the chart tab. This chart implements Sylvain Vervoort's heikin-ashi candlestick oscillator (Haco) as a StockFinder rule used to shade the chart's background either red or green.

Eight additional rules are also included on this chart that implement the four stages of the green candle and red candle expert functions presented in the article. You can drag and drop these rules onto the price history plot to paint it the correct colors using these conditions. You can also choose which rule-based paint brushes are applied as well as the priority of how these rules are applied in the colors tab of price history. This allows you to follow along with the article to see how the various steps in the evolution of the green candles and red candles from the article would affect how the symbol you are looking at would be colored.

Here's an example of the RealCode used to implement the first version of the green candle as a rule in StockFinder:

RealCode: 
'Green Candle v1
Static haOpen As Single
Static haC As Single
If isFirstBar Then
	haOpen = Price.Open
Else
	haOpen = (haOpen+(Price.Open(1)+Price.High(1)+Price.Low(1)+Price.Last(1))/4)/2
End If
haC = ((Price.Open+Price.High+Price.Low+Price.Last)/4+haOpen+ _
	System.Math.Max(Price.High,haOpen)+System.Math.Min(Price.Low,haOpen))/4
If haC >= haOpen Then Pass

For more information or to start your free trial, please visit www.StockFinder.com.

--Bruce Loebrich and Patrick Argo
Worden Brothers, Inc.


BACK TO LIST

VT TRADER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

Our Traders' Tip is inspired by "Trading With The Heikin-Ashi Candlestick Oscillator" by Sylvain Vervoort in this issue. In the article, Vervoort introduces an indicator called the heikin-ashi candlestick oscillator (Haco). The Haco is the final digital representation (0/1 oscillator) of a complex four-step process that Vervoort applies to the basic heikin-ashi candlesticks in an effort to achieve more uniform uptrend and downtrend heikin-ashi candlestick patterns. A Haco reading of "1" indicates a green modified HA candle while a reading of "0" indicates a red modified HA candle.

FIGURE 11: VT TRADER, HACO. Here is the HACO attached to a GBP/USD 30-minute candle chart.

We'll be offering the Haco indicator for download in our client forums. The VT Trader code and instructions for creating the Haco indicator are as follows:

The heikin-ashi candlestick oscillator
1. Navigator Window>Tools>Indicator Builder>[New] button
2. In the Indicator Bookmark, type the following text for each field:

Name: TASC - 12/2008 - Heikin-Ashi Candlestick Oscillator (HACO)
Short Name: vt_HACO
Label Mask: TASC - 12/2008 - Heikin-Ashi Candlestick Oscillator (%avg%,%avgdn%)
Placement: New Frame
Inspect Alias: HACO

3. In the Input Bookmark, create the following variables:

[New] button... Name: avg , Display Name: Up TEMA average , Type: integer , Default: 34
[New] button... Name: avgdn , Display Name: Down TEMA average , Type: integer, Default: 34

4. In the Output Bookmark, create the following variables:

[New] button...
Var Name: HACO
Name: (HACO)
Line Color: black
Line Width: thin
Line Type: solid

5. In the Formula Bookmark, copy and paste the following formula:

{Provided By: Capital Market Services, LLC & Visual Trading Systems, LLC (c) Copyright 2008}
{Description: December 2008 Issue - Trading with the Heikin-Ashi Candlestick Oscillator by Sylvain Vervoort}
{vt_HACO Version 1.0}

{Uptrend}

UpTMA1:= vt_TEMA(haC,avg,E);
UpTMA2:= vt_TEMA(UpTMA1,avg,E);
UpDiff:= UpTMA1 - UpTMA2;
UpZlHa:= UpTMA1 + UpDiff;
UpTMA1_2:= vt_TEMA((H+L)/2,avg,E);

UpTMA2_2:= vt_TEMA(UpTMA1_2,avg,E);
UpDiff_2:= UpTMA1_2 - UpTMA2_2;
UpZlCl:= UpTMA1_2 + UpDiff_2;
UpZlDif:= UpZlCl - UpZlHa;
Upkeep1:= SignalHold(haC>=haO,2);
Upkeep2:= UpZlDif>=0;
Upkeeping:= (Upkeep1 OR Upkeep2);
Upkeepall:= Upkeeping OR (Ref(Upkeeping,-1) AND (C>=O) OR C>=Ref(C,-1));
Upkeep3:= (Abs(C-O)<(H-L)*0.35 AND H>=Ref(L,-1));
Uptrend:= UpKeepall OR (Ref(Upkeepall,-1) AND Upkeep3);

{Downtrend}

DownTMA1:= vt_TEMA(haC,avgdn,E);
DownTMA2:= vt_TEMA(DownTMA1,avgdn,E);
DownDiff:= DownTMA1 - DownTMA2;
DownZlHa:= DownTMA1 + DownDiff;
DownTMA1_2:= vt_TEMA((H+L)/2,avgdn,E);
DownTMA2_2:= vt_TEMA(DownTMA1_2,avgdn,E);
DownDiff_2:= DownTMA1_2 - DownTMA2_2;
DownZlCl:= DownTMA1_2 + DownDiff_2;
DownZlDif:= DownZlCl - DownZlHa;
Downkeep1:= SignalHold(haC<haO,2);
Downkeep2:= DownZlDif<0;
Downkeep3:= Abs(C-O)<(H-L)*0.35 AND L<=Ref(H,-1);
Downkeeping:= Downkeep1 OR Downkeep2;
Downkeepall:= Downkeeping OR (Ref(Downkeeping,-1) AND (C<O) OR C<Ref(C,-1));
Downtrend:= If(DownKeepall OR (Ref(Downkeepall,-1) AND Downkeep3)=1,1,0);

{HACO}

upw:= Downtrend=0 AND Ref(Downtrend,-1) AND Uptrend;
dnw:= Uptrend=0 AND Ref(Uptrend,-1) AND Downtrend;
HACO:= If(upw,1,If(dnw,0,PREV(0)));

6. Click the "Save" icon to finish building the HACO indicator.

To attach the indicator to a chart, activate the chart window's contextual menu and select "Add Indicator." Select "12/2008 - Heikin-Ashi Candlestick Oscillator (HACO)" from the indicator list and click [Add].
To learn more about VT Trader, visit www.cmsfx.com.

--Chris Skidmore
Visual Trading Systems, LLC (courtesy of CMS Forex)
(866) 51-CMSFX, trading@cmsfx.com
www.cmsfx.com


BACK TO LIST

NINJATRADER: HEIKIN-ASHI CANDLESTICK OSCILLATOR

The Haco indicator as discussed in "Trading With The Heikin-Ashi Candlestick Oscillator" by Sylvain Vervoort in this issue is available for download at www.ninjatrader.com/SC/December2008SC.zip.

Once it's been downloaded, from within the NinjaTrader Control Center window, select the menu File > Utilities > Import NinjaScript and select the downloaded file. These indicators are for NinjaTrader Version 6.5 or greater.

You can review the indicator's source code by selecting the menu Tools > Edit NinjaScript > Indicator from within the NinjaTrader Control Center window and selecting Haco.

NinjaScript indicators are compiled Dlls that run native, not interpreted, which provides you with the highest performance possible. See Figure 12 for a sample chart.

FIGURE 12: NINJATRADER, HACO. This NinjaTrader screenshot shows the HACO indicator applied to a one-minute chart of the December 2008 S&P 500 emini contract.

--Raymond Deux & Josh Peng
NinjaTrader, LLC
www.ninjatrader.com


BACK TO LIST

TRADE IDEAS: STOCK MOVEMENT VS. MARKET MOVEMENT

"It's not the strongest of the species [traders] that survive, nor the most intelligent,
but the ones most responsive to change." --Charles Darwin

For this month's Traders' Tips, we've provided a strategy that came from our support forum. We learned that by changing the original intent of a strategy to go long and instead short-sell each opportunity, we turned a dismal strategy into a profitable one that the market has been rewarding for a while. The strategy is based on the Trade Ideas inventory of alerts and filters and is backtested with trading rules modeled in The OddsMaker.

The strategy is simple: Find stocks with prices that are rising faster than the market and go long on those, and find stocks that are falling faster than the market and short those. That part is easy; the hard part is not overstaying your welcome and getting out before these trends reverse. So we made the strategy to be when any long stock no longer trades above its 50-day moving average, sell it. This strategy also appears on the Trade Ideas blog at https://marketmovers.blogspot.com/.

FIGURE 13: TRADE IDEAS, STOCK STRATEGY. Here is the Trade Ideas PRO configuration for the strategy.

Description:  "SHORT - Rising Faster Than Market Above 50 Day SMA" 
Source: email support question based on an online article by Jim Van Meerten,
MSN Money: 
https://articles.moneycentral.msn.com/Investing/StrategyLab/Rnd18/P2/Strategy.aspx


Provided by:
Trade Ideas (copyright (c) Trade Ideas LLC 2008). All rights reserved. This sample 
Trade Ideas strategy is for educational purposes only and may be modified to 
further reflect a trading plan.  Remember these are sketches meant to give an 
idea how to model a trading plan. Use this 'as is' or modify it as many others 
do. Know, however, that Trade-Ideas.com and all individuals affiliated with this 
site assume no responsibilities for trading and investment results.

Copy this string directly into Trade-Ideas PRO using the "Collaborate" feature 
(right-click in any strategy window)(spaces represent an underscore if typing): 
https://www.trade-ideas.com/View.php?O=20000000000000000000000_1D_0&QRUI=2&MaxDNbbo=
0.1&MaxSpread=10&MinDia15=0.1&MinMA50R=1&MinPUp15=0.2&MinPrice=5&MinQqqq15=
0.1&MinSpy15=0.1&MinVol=500000&MinVol15=200&WN=SHORT+-+Rising+Faster+Than+Mkt+Above
+50+Day+SMA+-+Hold+120m+-+Start+30+After+Open+End+30+B4+-+SL+0.75+-+Exit+on+50+SMA+
Cross+ 

FIGURE 14: TRADE IDEAS, STOCK STRATEGY. Here is the OddsMaker backtesting configuration for the strategy.

The strategy's filters stipulate that all three major indices (Nasdaq, S&P, Djia) must be up by 0.1% over a 15-minute period. Then, in order to ensure all the stocks are rising faster than the markets, candidates must be up 0.2% over the last 15-minute period. Finally, the strategy stipulates that all stocks must be one volatility bar above the 50-day Sma. This allows us to honor the exit strategy of leaving when the stock dips below the 50 day Sma.

Given these filtered conditions, the strategy only produces an alert if a stock in this universe starts running 200% (2 as a ratio) faster than normal.

Where one alert and 10 filters are used with the following specific settings:

Running Up Intermediate: 2 (run rate ratio)
Min Price = 5 ($)
Max Spread = 5 (pennies)
Min Distance from Inside Market = 0.1 (%)
Min Daily Volume = 500,000 (shares/day)
Min Volume 15 Minute Candle = 200 (%)
Min Up 15 Minute Candle = 0.2 (%)
Min NASDAQ Up 15 Minute Candle = 0.1 (%)
Min S&P Up 15 Minute Candle = 0.1 (%)
Min Dow Up 15 Minute Candle = 0.1 (%)
Min Up from 50 Day SMA = 1 (Volatility Bars)

The definitions of these filters appear here: https://www.trade-ideas.com/Help.html.

The problem with this strategy is that currently, the market is not rewarding the signal to go long — it's actually rewarding the signal as a short opportunity. The OddsMaker summary provides the evidence. Here is what the OddsMaker reported given the following trade rules:

	On each alert, sell short 
	Buy back the stock if price moves up $0.75 
	Exit if the stock crosses the 50-day MA 
	Otherwise, hold the stocks for no more than 120 minutes 
	Start trading only after the first 30 minutes of the session 
	Stop new trades 30 minutes before the end of the session. 

The results (last backtested for the period of 9/23/2008 to 10/14/2008) are as shown in Figure 15. Learn how to interpret these backtest results from The OddsMaker by reading the user's manual at https://www.trade-ideas.com/OddsMaker/Help.html.

FIGURE 15: TRADE IDEAS, STOCK STRATEGY. Here are the results from the OddsMaker backtesting results for "Over Extended Up Move."

--Dan Mirkin, dan@trade-ideas.com
Trade Ideas, LLC
www.trade-ideas.com


BACK TO LIST

Return to December 2008 Contents