Traders' Tip text
In December 2008 issue of the TASC magazine, Sylvain Vervoort guides us step by step in an entertaining tutorial of building a customized candlestick oscillator. Utilizing the Heikin-Ashi chart's consistency, it provides an overlay tool that allows for some discretion to help holding onto a profitable trade.
Figure 1. Here is how
HACO was signaling about a downtrend in Euro in Summer'2008.
The Heikin-Ashi Candlestick Oscillator (
HACO), as presented by its author in this issue, is available to Wealth-Lab Developer/Pro 6 users. To power your chart analysis with HACO, just select «Extension Manager» from the Tools menu to update TASC Indicators library (open source).
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 slider parameters
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 ) );
}
}
}
}
}