Hey Traders,
this binary heikin ashi code will be displayed in a subgraph with either 1 for uptrend or 0 for downtrend, excellent if you want to look at original style candles and still use the heikin ashi trend tool:
{HACO}
inputs:
Avg( 34 ),
AvgDn( 34 );variables:
TMA1g(0),
TMA2g(0),
Diffg(0),
ZlHag(0),
ZlClg(0),
ZlDifg(0),
TMA1r(0),
TMA2r(0),
Diffr(0),
ZlHar(0),
ZlClr(0),
ZlDifr(0),keep1r(false),
keep2r(false),
keep3r(false),
keepingr(false),
keepallr(false),
keep1g(false),
keep2g(false),
keep3g(false),
keepingg(false),
keepallg(false),
utr(false),
dtr(false),
upw(false),
dnw(false),
result(” “);
{CrossOver formula}
TMA1g= Tema(haC,avg);
TMA2g= Tema(TMA1g,avg);
Diffg= TMA1g – TMA2g;
ZlHag= TMA1g + Diffg;
TMA1g= Tema((H+L)/2,avg);
TMA2g= Tema(TMA1g,avg);
Diffg= TMA1g – TMA2g;
ZlClg= TMA1g + Diffg;
ZlDifg=ZlClg-ZlHag;keep1g=(haC>=haOpen or haC[1]>=haOpen[1]);
keep2g=ZlDifg>=0;
keepingg=(keep1g OR keep2g);
keepallg=keepingg OR (keepingg[1] AND (Close >=Open) OR Close >=Close[1]);
keep3g=(AbsValue(Close-Open)<(High-Low)*.35 AND High>=Low[1]);
utr=Keepallg OR (keepallg[1] AND keep3g);{CrossOver formula}
TMA1r= Tema(haC,avgdn);
TMA2r= Tema(TMA1r,avgdn);
Diffr= TMA1r – TMA2r;
ZlHar= TMA1r + Diffr;
TMA1r= Tema((H+L)/2,avgdn);
TMA2r= Tema(TMA1r,avgdn);
Diffr= TMA1r – TMA2r;
ZlClr= TMA1r + Diffr;
ZlDifr=ZlClr-ZlHar;keep1r=haC<haOpen or haC[1]<haOpen[1] ;
keep2r=ZlDifr<0;
keep3r=AbsValue(Close -Open )<(High-Low)*.35 AND Low<= High[1];
keepingr=keep1r and keep2r;
keepallr=keepingr OR (keepingr[1] AND (Close<Open) OR Close<Close[1]);
dtr= Keepallr OR (keepallr[1] AND keep3r);upw=dtr=false AND dtr[1]=false AND utr;
dnw=utr=false AND utr[1]=false AND dtr;if upw then
plot1(1,”HACO”)
else if dnw then
plot1(-1,”HACO”)
else
plot1(plot1[1],”HACO”);