Page 1 of 1

help with Heikin Ashi code : plot Shadows

Posted: 13 Jul 2009
by nuno-online
is it possible to plot shadows like candles with shadows ?
i had this code below but i only see bars with open and close

Code: Select all

plotPB(haHigh ,haLow ,"heikin-ashi_HL",Black);
SetPlotWidth(1,1);
SetPlotColor(1,Black);
As you can see in the screenshot, the heikin-ashi doesn't have shadows
here is the original code:

Code: Select all

{ Heikin Ashi PaintBarStudy }

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(haHigh ,haLow ,"heikin-ashiHL",Black);
SetPlotWidth(1,1);
SetPlotColor(1,Black);

PlotPB(haOpen,haClose,"heikin-ashi",color);
SetPlotWidth(1,2);
SetPlotColor(1,color);
end;
thank you for your help
Nuno

Someone have an idea?

Posted: 16 Jul 2009
by nuno-online
Someone have an idea?

Posted: 16 Jul 2009
by TJ
a mock up would be helpful

Posted: 16 Jul 2009
by nuno-online
i updated my first post

Posted: 16 Jul 2009
by TJ
if heikin-ashi have shadows, then it is not heikin-ashi anymore.

you can Format the symbol style to HLC bars behind the heikin-ashi indicator, that should give you the shadow you want.

Posted: 16 Jul 2009
by nuno-online
TJ

that give me shadows but theses shadows aren't High / Low 's heikin-ashi

Posted: 16 Jul 2009
by TJ
try this:

Code: Select all

{ Heikin Ashi PaintBarStudy }

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;

Plot1(haHigh, "BarHigh", Black);
SetPlotWidth(1,1);
SetPlotColor(1,Black);

Plot2(haLow ,"BarLow", Black);
SetPlotWidth(2,1);
SetPlotColor(2,Black);

Plot3(haOpen, "O-BH", color);
SetPlotWidth(3,2);
SetPlotColor(3,color);

Plot4(haClose, "C-BL",color);
SetPlotWidth(4,2);
SetPlotColor(4,color);

end;

code edited at 11:04am

Posted: 16 Jul 2009
by nuno-online
here the screenshot

Posted: 16 Jul 2009
by TJ
set plot1 and plot 3 to Bar High
set plot2 and plot 4 to Bar Low

Posted: 19 Jul 2009
by nuno-online
Hi TJ

that's ok
thank you very much for your help

Nuno