PureBytes Links
Trading Reference Links
|
Hey,
This worked out pretty well, I expose my ignorance and the experts jump
in to show some cool things about the formula language. BTW, I use (try to),
MS EOD 7.02.
When Jeff wrote (in EasyLanguage):
Value1 = Close + 0.088*Value1[6];
Value2 = Value1 - Value1[6] + 1.2*Value2[6] - 0.7*Value2[12];
D = Value2[12] - 2*Value2[6] + Value2;
Plot1(D,"D");
I assumed that this was a fragment of a larger formula that he was working
on. If that was true, then I also assumed that Value1 already had a number
associated with it. Otherwise, the calculation of the first line be
dependent on whatever number Value1 was loaded with in the declaration
section of EasyLanguage.
WARNING....WARNING....I am no expert on EasyLanguage. Heck, I stumble
through englishk.
But, if the formula is taken literally, you are absolutely correct, PREV
would have to be used. For instance:
V1:=0.088*Ref(PREV,-6)+C;
V1
Will result in a graph, but:
V1:=0.088*Ref(V1,-6)+C;
V1
won't because V1 hasn't been pre-loaded with a number.
It's interesting that:
Value1:=1; {to load Value1 for Ref}
Value1:=1 + Ref(Value1,-1); {=line at 2.0}
Value2:=1 + PREV; {=Cum(1)}
Value3:=1 + Ref(PREV,0); {=Cum(1)}
Value4:=1 + Ref(PREV,-1); {=Cum(1)/2}
So, try:
Value1:= ((H+L)/2) + 0.088*Ref(PREV,-5);
Value2:=ROC(Value1,6,$) + 1.2*Ref(PREV,-5) - 0.7*Ref(PREV,-11);
Ref(Value2,-12) - 2*Ref(Value2,-6) + Value2
I used (H+L)/2 for prices since that is what Ehlers used on p.26. There
isn't much change from using CLOSE, but it helps.
I tried this on a test plot similar to TASC July 2000, p. 26 and it looks
close in both freq and amplitude.
Dave Nadeau, I had no idea that:
ROC(Value1,6,$)=Value1-Ref(Value1,-6)
this is a valued lesson for me and you are now known as "The Wiz" in these
parts.
-Corey.
----- Original Message -----
From: "Brooke" <brookelise@xxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Monday, March 05, 2001 5:19 PM
Subject: Re: EasyLanguage to Metastock conversion
> Corey:
>
> I don't think that'll do the job, because the formulas are
self-referential,
> or recursive. Did you get values with it? If so, you're working with a
later
> version of Metastock than I am.
>
> I would have thought that you'd need to use PREV. I don't get anything
with
> this in Metastock, for example:
>
> Value1:=Ref(Value1,-1) + C;
> Value1;
>
> What that formula would be trying to say is:
>
> Value1:=PREV +C;
> Value1;
>
> The first line in the formula would be this, I think:
>
> Value1:=0.088*ref(PREV,-6) +C;
>
> But the Easy Language formula requires two PREV's in this line:
>
> Value2 = Value1 - Value1[6] + 1.2*Value2[6] - 0.7*Value2[12];
>
> It might be translated as:
>
> Value2:= 1.2*ref(PREV,-6) - 0.7*ref(PREV,-12) + Value1 - ref(Value1,-6) ;
>
> Except that
>
> a) PREV now refers back to the other PREV in the line, I think, and
>
> b) I get an "Add Overflow" message with that formula.
>
> So it would have to be broken down in some way so that there was only one
> PREV in the line.
>
> Something like this, though this still won't do it. I'd have to have an
> EasyLanguage program to compare values.
>
> Value1:=0.088*ref(PREV,-6) +C;
> Value2a:= 1.2*ref(PREV,-6)+ (Value1 - ref(Value1,-6)) ;
> Value2b:= 0.7*ref(PREV,-12)+(Value1 - ref(Value1,-6)) ;
> Value2:=Value2a +Value2b;
>
> But who knows? Maybe I'm wrong, and newer versions of Metastock can do
> recursive formulas without PREV.
>
> ----- Original Message -----
> From: "C.S." <csaxe@xxxxxxxxxxx>
> To: <metastock@xxxxxxxxxxxxx>
> Sent: Monday, March 05, 2001 4:55 PM
> Subject: Re: EasyLanguage to Metastock conversion
>
>
> > OK,
> > I'll take a stab at this. Please chime in if I'm wrong, as I can
learn
> > from this too.
> >
> > Value1:=C + 0.088 * Ref(Value1,-6);
> > Value2:=Value1 - Ref(Value1,-6) + 1.2*Ref(Value2,-6) -
> 0.7*Ref(Value2,-12);
> > Ref(Value2,-12) - 2*Ref(Value2,-6) + Value2
> >
> > Although the PREV function could have been used, I didn't because it
tends
> > to slow computation.
> > -Corey
> >
> > ----- Original Message -----
> > From: "Jeff Haferman" <haferman@xxxxxxxxxxxxxxxxxxxxxxx>
> > To: <metastock@xxxxxxxxxxxxx>
> > Sent: Sunday, March 04, 2001 5:03 PM
> > Subject: EasyLanguage to Metastock conversion
> >
> >
> > >
> > > I've got some code I'm trying to convert to Metastock...
> > > it's written in EasyLanguage.
> > >
> > > I've got:
> > >
> > > Value1 = Close + 0.088*Value1[6];
> > > Value2 = Value1 - Value1[6] + 1.2*Value2[6] - 0.7*Value2[12];
> > > D = Value2[12] - 2*Value2[6] + Value2;
> > > Plot1(D,"D");
> > >
> > > Is there an easy way to write this as a Metastock indicator?
> > > For example, Value1[6] means the value of Value1 6 bars ago.
> > > But Value1 is defined recursively, so I'm not sure
> > > how this can be done in Metastock.
> > >
> > >
> > >
> >
> >
>
>
|