Wed05222013

Last update12:00:00 AM

BackHomeS&C MagazineDepartmentsTraders' Tips WEALTH-LAB: HEIKIN-ASHI CANDLES OSCILLATOR LONG TERM (HACOLT)

WEALTH-LAB: HEIKIN-ASHI CANDLES OSCILLATOR LONG TERM (HACOLT)

In “Long-Term Trading Using Exchange Traded Funds” in this issue, author Sylvain Vervoort describes the evolution of his HACO indicator into a long-term version named HACOLT. He also presents an application of it to a portfolio of ETFs.

Based on Vervoort’s rules, the Wealth-Lab strategy shown here contains configurable parameters to set the two periods (TEMA and shorting LT average) and the candle size factor.

Wealth-Lab users who want to test the new HACOLT indicator on any market (including but not limited to ETFs) can download this sample strategy directly into Wealth-Lab. From the Open Strategy dialog (Ctrl-O), choose “Download” to get all strategies that have been uploaded recently. The strategy is also available for copying & pasting below.

C# 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 HACOLTStrategy : WealthScript
{
private StrategyParameter period;
private StrategyParameter candlesize;
private StrategyParameter ltaverage;
public HACOLTStrategy()
{
period = CreateParameter("TEMA Period",55,2,100,10);
candlesize = CreateParameter("Candle Size",1.1,0.01,5,0.5);
ltaverage = CreateParameter("Shorting LT Average",60,1,200,20);
}
protected override void Execute()
{
HACOLT hacolt = HACOLT.Series(Bars, period.ValueInt, candlesize.Value, 2, ltaverage.ValueInt);
ChartPane paneHACOLT = CreatePane(30,true,true);
PlotSeries(paneHACOLT, hacolt, Color.FromArgb(255,138,43,226), LineStyle.Solid, 2);
HideVolume();
for(int bar = hacolt.FirstValidValue; bar < Bars.Count; bar++)
{
bool buyLong = hacolt[bar] == 100;
bool closeLong = hacolt[bar] == 0 || CrossUnder(bar, hacolt, 50);
bool goShort = hacolt[bar] == 0;
bool coverShort = hacolt[bar] == 100;
// The first trade
if (Positions.Count == 0){
if ( buyLong ) 
BuyAtMarket( bar + 1 );
else if( goShort )
ShortAtMarket( bar + 1 );
}
// Subsequent trades
else 
{
Position p = LastPosition;				
if ( p.PositionType == PositionType.Long ) 
{
if ( closeLong ) 
{
SellAtMarket( bar + 1, p );
if( goShort )
if( ShortAtMarket( bar+1 ) != null )
LastPosition.Priority = Close[bar];
}
}
else if ( coverShort ) 
{
CoverAtMarket( bar + 1, p );
if( buyLong )
if( BuyAtMarket( bar+1 ) != null )
LastPosition.Priority = -Close[bar];
}
}
}
}
}
}

A sample chart is shown in Figure 4.

Image 1

FIGURE 4: WEALTH-LAB, HEIKIN-ASHI CANDLES OSCILLATOR LONG TERM (HACOLT). Here is an example of applying Sylvain Vervoort’s HACOLT strategy to BA (Boeing) shares in Wealth-Lab 6.3.

—Eugene
www.wealth-lab.com


To read the entire issue click here and subscribe today!

PTSK — The Professional Traders' Starter Kit
Home| Working Money Magazine | S&C Magazine | Traders.com Advantage | Online Store | Traders’ Resource
Add a Product to Traders’ Resource | Message Boards | Subscribe/Renew | Free Trial Issue | Article Code | Search

DEPARTMENTS: Advertising | Editorial | Circulation | Employment | Contact Us | BY PHONE: (206) 938-0570

Join us on Facebook     Follow us on Twitter     Follow Us on StockTwits

Bookmark and ShareCopyright © 1996-2013 Technical Analysis, Inc. All rights reserved. Read our disclaimer & privacy statement.

SUBSCRIBE TO OUR FREE
EMAIL NEWSLETTER!