[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

Gary
its been a month but have finally checked out the math and from what I can
workout the following seems to work. It will plot an 'x' for the price
required for macd to cross the macd signal line. What I checked out firstly
in excel manually appeared to give what I though to be more accurate
results. But these appear close. Thankyou very much Gary for your time and
effort in straightening my maths out.

Inputs: fast(12), slow(26), sigAvge(9);
Vars: FX(0), FY(0), FZ(0), avgeX(0), avgeY(0), macdZ(0);
FX = 2/(fast+1);
FY = 2/(slow+1);
FZ = 2/(sigAvge+1);

if fast + 1 <> 0
then begin
 if CurrentBar <= 1
 then begin
  avgeX = Close;
 end
 else
  avgeX = FX * Close + (1 - FX) * avgeX[1];
end;
if slow + 1 <> 0
then begin
 if CurrentBar <= 1
 then begin
  avgeY = Close;
 end
 else
  avgeY = FY * Close + (1 - FY) * avgeY[1];
end;

if sigAvge + 1 <> 0
then begin
 if CurrentBar <= 1
 then begin
  macdZ = Close;
 end
 else
  macdZ = FZ * (avgeX-avgeY) + (1 - FZ) * macdZ[1];
end;


Value1 =
(FZ*((close*(FX-FY)+(1-FX)*avgeX[1]-(1-FY)*avgeY[1]))+(1-FZ)*macdZ+(1-FY)*av
geY-(1-FX)*avgeX)/(FX-FY);

Plot1(Value1,"forecast");

{...plot indicator as /   x's   /   same as price data. Shows price required
tomorrow for macd to cross the signal line...}

Jon


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


> > What I was trying to do was to have the equation calculate a value
> > for the macd to cross the macd signal line (smoothed macd). So,
> > where your equation had zero on one side (at one of its earlier
> > stages) I simply replaced it with yesterday's macd signal line
> > value.
>
> Ohhh.  I never use MACD and I never even thought about that.  :-)
>
> > Then, as you had done, I tried to get 'C' only onto one side
> > of the equation. What i'd sent previously seemed to work in excel,
> > but no doubt isn't perfectly accurate. worth a try!?
>
> OK, then you probably had it right to start with.  If I modify my
> equations for that, I'd get:
>
> > > 0 = FZ*C*(FX-FY) + FZ*(1-FX)*xavgX - FZ*(1-FY)*xavgY + (1-FZ)*macdZ
>
> Instead of 0=, it should be C*(FX-FY) + (1-FX)*avgX - (1-FY)*avgY =.
>
> Then
>
> C*(FX-FY) - FZ*C*(FX-FY)
>   = FZ*(1-FX)*avgX - (1-FX)*avgX - FZ*(1-FY)*avgY + (1-FY)*avgY
>        + (1-FZ)*macdZ
>
> (1-FZ)*C*(FX-FY)
>    = -(1-FZ)*(1-FX)*avgX + (1-FZ)*(1-FY)*avgY + (1-FZ)*macdZ
>
> So the value of C that causes the fast MACD to cross the smoothed
> MACD is:
>
> C = -(1-FX)*avgX + (1-FY)*avgY + macdZ
>     ----------------------------------
>                 FX-FY
>
> ...which, interestingly enough, is **identical** to the previous
> equation I derived (for the value of C that causes the smoothed MACD
> to cross zero), except for a (1-FZ)/FZ factor on the macdZ term:
>
> > > C = -(1-FX)*avgX + (1-FY)*avgY - (1-FZ)*macdZ/FZ
> > >     --------------------------------------------
> > >                        FX-FY
>
> As always, this is untested, your mileage may vary, etc etc.
> Gary
>
>