[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anybody have the ela code for MACD Histogram?



PureBytes Links

Trading Reference Links

-------------------------------------------
{MACD red/green Hist edited from TS4}
{MaxBarsBack set to 1}

inputs: FastMA(12),SlowMA(26),MacdMA(9);

Plot1(MACD(Close,FastMA,SlowMA),"MACD");
{green line}
Plot2(XAverage(MACD(Close,FastMA,SlowMA),MacdMA),"MACDAvg");    {red
line}

plot3(0,"MA up"); {green hist}
plot4(0,"MA dn"); {red hist    <======reset plot values to 0 before
plotting
                     the MACDD values (erases last bar value)}

value1=MACD(Close,FastMA,SlowMA)-(XAverage(MACD(Close,FastMA,SlowMA),MacdMA));

{Note that the MACD calculation here is not optimized for speed. It
should be... }

if value1>value1[1] then begin
 plot3(value1,"MA up");   { <=========plots according to MACD climbing}
 end else begin
 plot4(value1,"MA dn");   { <=========plots according to MACD falling}

end;
-----------------------------------
yahoo wrote: