Hey Traders,
here is code for Heikin Ashi candlesticks, excellent tool for determining market trends
inputs:
HollowColor( White ),
UpTrendColor( DarkGreen ),
DnTrendcolor( Red ),
Avg( 34 ) ;variables:
GreenBar( false ),
MyHaC(0),
MyHaOpen(0),
color(0),
colorW(0),
TMA1(0),
TMA2(0),
Diff(0),
ZlHa(0),
ZlCl(0),
ZlDif(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}
TMA1= Tema(haC,avg);
TMA2= Tema(TMA1,avg);
Diff= TMA1 – TMA2;
ZlHa= TMA1 + Diff;
TMA1= Tema((H+L)/2,avg);
TMA2= Tema(TMA1,avg);
Diff= TMA1 – TMA2;
ZlCl= TMA1 + Diff;
ZlDif=ZlCl-ZlHa;keep1g=(haC>=haOpen or haC[1]>=haOpen[1]);
keep2g=ZlDif>=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);keep1r=haC<haOpen or haC[1]<haOpen[1] ;
keep2r=ZlDif<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
result = “GreenBar”
else if dnw = false then
result = “RedBar” ;if Result = “GreenBar” then
begin
ColorW = UpTrendColor ;
if Close > Close[1] and Open < Close then
Color = UpTrendColor
else
Color = HollowColor ;
if Close < Close[1] and Open > Close then
Color = UpTrendColor
else
Color = HollowColor ;
end
else
begin
ColorW = DnTrendColor ;
if Close < Close[1] and Open > Close then
Color = DnTrendColor
else
Color = HollowColor ;
if Close > Close[1] and Open < Close then
Color = DnTrendColor
else
Color = HollowColor ;
end ;{ Outlined Candles by Solidus
https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=67474}
inputs:
WICKwidth( 1 ),
BODYwidth( 3 );variables:
BodySize(iff(bodywidth=2, 1, iff(bodywidth>4, 4, bodywidth) )),
Outline(iff(bodysize=0, 2, iff(bodysize=1, 3, iff(bodysize=3, 4, 5))) );plot1(c,”c outline a”,colorW,0,outline);
plot2(c,”c outline b”);
plot3(o,”o outline a”,colorW,0,outline);
plot4(o,”o outline b”);Plot5(c,”C”,color,0,bodysize);
Plot6(o,”O”);Plot7(c,”C outline”,colorW,0,outline);
Plot8(o,”O outline”);plot9(h,”H”,colorW,0,WICKwidth);
plot10(l,”L”);