I am using the below code to ma Heiken Ashi chart, but whatever I use it for any symbol, it sill cannot show the first of 7 BarNumber.
But if I using the MC bulit-in Heiken Ashi or Hollow Candlestick, it can be shown back.
Do I miss someting? Or it is right if it is through code to make any chart?
Fm: Tusa
Code: Select all
inputs:
UpColor(green),
DnColor(red);
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; ////average bar price
haOpen = (haOpen [1] + haClose [1])/2 ; ////avg open/close 1 bar ago
haHigh = MaxList(High, haOpen, haClose) ; ////highest of high,open,close
haLow = MinList(Low, haOpen, haClose) ; //// lowest of low, open, close
if haClose > haOpen then color = UpColor
else color = DnColor;
plotPB(haOpen,haClose,"heikin-ashi",color);
SetPlotWidth(1,4);
SetPlotColor(1,color);
end;