Type : PaintBar, Name : Heikin Ashiinputs: UpColor(green),DnColor(red),CompBars(6);
vars: haClose(0),haOpen(0),haHigh(0),haLow(0),
color(0);
if BarNumber = 1 then
begin
haOpen = open;
haClose = (O+H+L+C)/4;
haHigh = MaxList( high, haOpen, haClose);
haLow = MinList( low, haOpen,haClose);
end;
if BarNumber > 1 then
begin
haClose = (O+H+L+C)/4;
haOpen = (haOpen [1] + haClose [1])/2 ;
haHigh = MaxList(High, haOpen, haClose) ;
haLow = MinList(Low, haOpen, haClose) ;
if haClose > haOpen then
color = UpColor
else
color = DnColor;
for value1 = 1 to CompBars
begin
if haOpen <= MaxList(haOpen[value1],haClose[value1]) and
haOpen >= MinList(haOpen[value1],haClose[value1]) and
haClose <= MaxList(haOpen[value1],haClose[value1]) and
haClose >= MinList(haOpen[value1],haClose[value1]) then
color = color[value1];
end;
plotPB(haOpen,haClose,»heikin-ashi»,color);
SetPlotWidth(1,4);
SetPlotColor(1,color);
end;