Wed06192013

Last update12:00:00 AM

Back

## TRADECISION: HEIKIN-ASHI CANDLES OSCILLATOR LONG TERM (HACOLT)

In “Long-Term Trading Using Exchange Traded Funds” in this issue, author Sylvain Vervoort introduces his HACOLT method for analyzing exchange traded funds (ETFs).

To import the strategy directly into Tradecision, visit the area “Traders’ Tips from TASC Magazine” at www.tradecision.com/support/tasc_tips/tasc_traders_tips.htm or copy the code shown below using the following instructions.

1. Use Tradecision’s Function Builder to recreate Vervoort’s HACOLT function using the following code:
```HACOLT function:
function (avg:numeric=55,CandleSize:Numeric=1.1, LTAverage:Numeric=60):Numeric;
var
hacOpen:=0;
hacC:=0;
hacOpenPrev:=0;
ZlHa:=0;
ZlCl:=0;
keep1:=0;
keep2:=0;
keeping:=0;
keepall:=0;
keep3:=0;
utr:=0;
keep1_byconvertor_1:=0;
keep2_byconvertor_1:=0;
keep3_byconvertor_1:=0;
keeping_byconvertor_1:=0;
keepall_byconvertor_1:=0;
dtr:=0;
upw:=0;
dnw:=0;
Result:=0;
LTSell:=0;
LTResult:=0;
LTResultPrev:=0;
end_var
if HISTORYSIZE > avg then
hacOpenPrev:=(O\2\ + H\2\ + L\2\ + C\2\)/4;
hacOpen:=((O\1\ + H\1\ + L\1\ + C\1\)/4) + hacOpenPrev / 2;
hacC:=((O + H + L + C) / 4 + haOpen + Max(H, haOpen) + Min(L, haOpen)) / 4;
ZlHa:=Tema(haC, avg) + (Tema(haC, avg) - (Tema(Tema(haC, avg), avg)));
ZlCl:=Tema((H + L) / 2, avg) + (Tema((H + L) / 2, avg) - (Tema(Tema((H + L) / 2, avg), avg)));
if hacC >= hacOpen and BarsSince(hacC >= hacOpen) < 3 then keep1:=1;
else keep1:=0;
keep1:= iff(C >= haC, 1, iff(H >Ref(H, -1) or L >Ref(L, -1), 1, 0));
keep2:= iff((ZlCl - ZlHa) >= 0,1,0);
if keep1=1 then keeping:=1; else keeping:=0;
if keep2=1 then keeping:=1; else keeping:=0;
if keeping=1 then keepall:=1; else keepall:=0;
if keeping\1\=1 and (C >= O or C >= C\1\) then keepall:=1; else keepall:=0;
if (Abs(C - O) < (H - L) * CandleSize) and H >= L\1\ then keep3:=1; else keep3:=0;
if keepall=1 or (keepall\1\=1 and keep3=1)then utr:=1; else utr:=0;
if haC < haOpen and BarsSince(haC < haOpen) < 2 then keep1:=1;
else keep1:=0;
if (ZlCl - ZlHa) < 0 then keep2_byconvertor_1:=1; else keep2_byconvertor_1:=0;
if ((Abs(C - O) < (H - L) * CandleSize) and L <= H\1\) then keep3_byconvertor_1:=1;  else keep3_byconvertor_1:=0;
if keep1_byconvertor_1=1 or keep2_byconvertor_1=1  then keeping_byconvertor_1:=1; else keeping_byconvertor_1:=0;
if keeping_byconvertor_1=1 or keeping_byconvertor_1\1\=1 and ((C < O) or (C < C\1\)) then keepall_byconvertor_1:=1;  else keepall_byconvertor_1:=0;
if(keepall_byconvertor_1=1 or (keepall_byconvertor_1\1\=1 and keep3_byconvertor_1=1)) then dtr:= 1;  else dtr:=0;
upw:= iff((dtr=0 and dtr\1\=1 and utr=1),1,0);
dnw:= iff((utr=0 and utr\1\=1 and dtr=1),1,0);
Result:=iff(upw=1, 1, iff(dnw=1, 0, NthValueWhen(1, upw + dnw > 0, iff(upw=1, 1, 0))));
LTSell:=iff(C < Mov(C, LTAverage, E),1,0);
LTResultPrev:=LTResult\1\;
if Result = 1 then LTResult:=1;
else if(Result = 0 and LTSell = 1) then LTResult:=0;
else  LTResult:=LTResult\1\;
return iff(Result = 1, 100, iff(Result = 0 and LTResult = 1, 50, iff(Result = 0 and LTResult = 0, 0, this\1\)));```
2. Use Tradecision’s Indicator Builder to recreate Vervoort’s HACOLT indicator using the following formula:
```HACOLT indicator:
return HACOLT(55,1.1,60);```
3. Use Tradecision’s Strategy Builder to recreate Vervoort’s HACOLT strategy:
```HACOLT strategy:Entry Long:
if  HACOLT(55,1.1,60) = 100 then return true;
return false;
Exit Long:
if  HACOLT(55,1.1,60) = 50 or HACOLT(55,1.1,60)=0 then return true;
return false;
Entry Short:
if  HACOLT(55,1.1,60) = 0 then return true;
return false;
Exit Short:
if  HACOLT(55,1.1,60) = 100 then return true;
return false;```

A sample chart is shown in Figure 11.

FIGURE 11: TRADECISION, HEIKIN-ASHI CANDLES OSCILLATOR LONG TERM (HACOLT), WEEKLY. Here is the HACOLT strategy with trading signals and the HACOLT indicator plotted on a weekly chart of ALPS Equal Sector Weight.

—Yana Timofeeva, Alyuda Research