PureBytes Links
Trading Reference Links
|
> Bob Fulks suggested an option of reverse engineering an indicator.
> But I am not 'fit and able' in this department. If anyone has the
> expertise, and is willing to reverse engineer say a MACD
> crossover.........?
MACD(X,Y) = xaverage(c, X) - xaverage(c,Y)
xaverage(c, X) = Factor * C + (1 - Factor) * xaverage[1]
so MACD(X,Y) =
FactorX*C + (1-FactorX)*xavgX[1] - FactorY*C + (1-FactorY)*xavgY[1]
= C*(FactorX-FactorY) + (1-FactorX)*xavgX[1] - (1-FactorY)*xavgY[1]
FactorX = 2/(X+1)
FactorY = 2/(Y+1)
At the close of bar N, you know xavgX and xavgY for bar N. Those
values will be the xavgX[1] and xavgY[1] on bar N+1. So at the close
of bar N you can calculate the value of C that will cause MACD to
cross zero on bar N+1:
0 = C*(FactorX-FactorY) + (1-FactorX)*xavgX - (1-FactorY)*xavgY
(1-FactorY)*avgY - (1-FactorX)*avgX = C*(FactorX-FactorY)
so C = (1-FactorY)*avgY - (1-FactorX)*avgX
-----------------------------------
(FactorX-FactorY)
is the value of Close that will cause the MACD to cross.
Somebody should check my math, but I think that's right.
Now if what you wanted was the *smoothed* MACD, that's another level
of xaverage around the whole MACD definition above. That will make
the derivation a bit messier, and unfortunately I'm late for an
appointment. So I'll leave the derivation of that as an exercise for
the student. :-)
Gary
|