PureBytes Links
Trading Reference Links
|
Jeff,
I worked on this for a time last July. Incorporating Dave's
improvements, I came up with the following for Ehlers code for the modified
optimum elliptic filter and detrender as described on p.29. Although I'm not
impressed with the output, this may be something you can use.
{Ehlers TASC Jul 00, p. 29}
P1:=(H+L)/2;
V1:=P1 + 0.088*Ref(PREV,-5);
V2:=ROC(V1,6,$) + 1.2*Ref(PREV,-5) - 0.7*Ref(PREV,-11);
D1:=Ref(V2,-12) - (2*Ref(V2,-6))+V2;
S1:=0.13785*(2*D1-Ref(D1,-1))+0.0007*(2*Ref(D1,-1)-Ref(D1,-2))+0.13785*(2*Re
f(D1,-2)-Ref(D1,-3))+(1.2103*PREV)-(0.4867*Ref(PREV,-1));
S2:=0.13785*(2*S1-Ref(S1,-1))+0.0007*(2*Ref(S1,-1)-Ref(S1,-2))+0.13785*(2*Re
f(S1,-2)-Ref(S1,-3))+1.2103*PREV-0.4867*Ref(PREV,-1);
S1;
S2
-Corey.
----- Original Message -----
From: "Jeff Haferman" <haferman@xxxxxxxxxxxxxxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Wednesday, March 07, 2001 7:20 AM
Subject: Re: EasyLanguage to Metastock conversion
>
> Dave,
> Thanks, I tried your code in MS 6.52, and it plots, but
> does not seem correct. The original EasyLanguage code is:
>
> 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");
>
> So I modified yours to read
> Value1:=0.088*Ref(PREV,-6)+CLOSE;
> Value2:=(1.2*Ref(PREV,-6))-(0.7*Ref(PREV,-12));
> V3:=ROC(Value1,6,$)+Value2;
> D:=Ref(V3,-12)-2*Ref(V3,-6)+V3;
> D;
>
> This seems like it's correct, and it does plot, but I don't
> have any EasyLanguage numbers to compare to. I wrote up
> a C program to perform the computation, and the shape of
> the resulting plot seems identical to what metastock gives,
> but the actual numbers are off. Your line of thinking
> seems to me to be correct, however. I'll try to do
> some more verfication.
>
> Jeff
>
>
> Dave Nadeau wrote:
> >Try this one out:
> >
> >Value1:=0.88*Ref(PREV,-6)+Close;
> >Value2:=(1.2*Ref(PREV,-6))-(0.7*Ref(PREV,-12));
> >ROC(Value1,6,$)+Value2
> >
> >--------------------------------------
> >I can get away with the last statement because
> >ROC(Value1,6,$)=Value1-Ref(Value1,-6)
> >
> >The above plots on Metastock Pro 7.03.
> >
> >Dave Nadeau
> >Fort Collins, CO
> >
> >3/5/2001 3:19:56 PM, "Brooke" <brookelise@xxxxxxxx> wrote:
> >
> >>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.
> >>> >
> >>> >
>
|