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

Re: ELA Question: Entry as soon as MA xover vs at the close



PureBytes Links

Trading Reference Links

Hi Gary

Many, many thanks for your reply. I'm hopeless at trying to get this right,
but I put your statements into excel and it seems to work well. There are
small differences in the excel figures which I guess are due to rounding and
precision error differences. So I tried to take your work a step toward
finding the price required tomorrow to have macd cross the signal line,
which incidentally, is the type of crossing that I have looked toward for
some time. I'm not good enough to be able to work out what the signal line
projection might be for tomorrow, for the macd to cross, so have compromised
to the macd projection crossing todays signal line value. On fast macd
averages guess this would be a problem.

Again, I ran some checks on the code manually in excel and the results
appear somewhat sound, given the general premature concept that it is in any
case.

Hopefully, you'll find my math below not too bad?

Regards
Jon

----- Original Message -----
From: "Gary Fritz" <fritz@xxxxxxxx>
To: "jonmac" <jonmac@xxxxxxxxxxx>
Cc: <omega-list@xxxxxxxxxx>
Sent: Saturday, 22 September, 2001 9:43 AM
Subject: Re: ELA Question: Entry as soon as MA xover vs at the close


> > 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)

macdZ = xavg(MACD(X,Y),Z)

> 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]

macdZ = FactorZ*((C*(FactorX-FactorY) + (1-FactorX)*xavgX[1] -
(1-FactorY)*xavgY[1])) + (1-FactorZ)*macdZ[1]

> FactorX = 2/(X+1)
> FactorY = 2/(Y+1)

FactorZ = 2/(Z+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

Close for next bar required to make macd cross signal line (changed to P
incase 'any price/last price' is used;

FactorZ*((C*(FactorX-FactorY) + (1-FactorX)*xavgX[1] -
(1-FactorY)*xavgY[1])) + (1-FactorZ)*macdZ[1]
= P*(FactorX-FactorY) + (1-FactorX)*xavgX - (1-FactorY)*xavgY

so;
FactorZ*((C*(FactorX-FactorY) + (1-FactorX)*xavgX[1] -
(1-FactorY)*xavgY[1])) + (1-FactorZ)*macdZ[1] + (1-FactorY)*xavgY -
(1-FactorX)*xavgX
= P*(FactorX-FactorY)

so;
P = (FactorZ*((C*(FactorX-FactorY) + (1-FactorX)*xavgX[1] -
(1-FactorY)*xavgY[1])) + (1-FactorZ)*macdZ[1] + (1-FactorY)*xavgY -
(1-FactorX)*xavgX) / (FactorX-FactorY)

Been a long Sunday arvo!

Reagrds
Jon







>