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

Re: [EquisMetaStock Group] Problem with if and isUndefined



PureBytes Links

Trading Reference Links

Stephane

Plot this exercise on any chart (unscaled) and take note of the interaction
of the four plots. Then try removing "Init OR" from both BarsSince() and see
what happens.

  {signal timing for a simple latch}

Set:=Cross(Mov(C,15,E),Mov(C,25,E)); Set+3.75;

Reset:=Cross(Mov(C,25,E),Mov(C,15,E)); Reset+2.5;

Init:=Cum(Set+Reset>-1)=1; Init+1.25;

Trade:=BarsSince(Init OR Set)<BarsSince(Init OR Reset);

Trade;



Roy





----- Original Message ----- 
From: "Roy Larsen" <rlarsen@xxxxxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Thursday, October 02, 2003 10:53 AM
Subject: Re: [EquisMetaStock Group] Problem with if and isUndefined


> Stephane
>
> Some suggestions.
>
> 1. Forget about using IsUndefined() - it's a waste of time and space
unless
> you use it to create the following "Initialised" (is valid) type of
formula.
>
> 2. Create an "Initialised" variable that gives a one bar spike when ALL
your
> other formulas are valid.
> I:=Cum("formula 1"+"formula 2"+"formula 3">some impossible negative #)=1;
> Note that for binary variables the formula can be as simple as this
> "I:=Cum((N+X)>-1)=1;"
>
> 3. Include "I OR " in all BarsSince(), HighestSince() or ValueWhen() etc.
> functions.
> BarsSince(I OR Fml("Wkly MACD Histogram")>0))
>
> The "I" variable is doing all that the IsUndefined() can do for you, it
will
> work with 6.52 as well as it works with 8.01, and most importantly it
gives
> a pseudo signal that is the best possible starting point for your useful
> plot. Well actually, as you know, the best starting point is bar one of
the
> chart, but IsDefined() and IsUndefined() are crippled functions and won't
> help you achieve anything in the normal N/A plot area anyway.
>
> The concept of the "I" variable creates a starting reference point where
all
> required variables are known to be valid. It is rarely of any consequence
as
> to what value a BarsSince() or ValueWhen() function returns at this point.
> What is important is that they return ANY value other than N/A.
>
> Roy
>
>
> ----- Original Message ----- 
> From: "stephanegranger_2000" <grangers@xxxxxxxxxxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Thursday, October 02, 2003 10:09 AM
> Subject: [EquisMetaStock Group] Problem with if and isUndefined
>
>
> > Hi everybody,
> >
> > I'm currently trying to write a system tester for the Triple Screen
> > Trading system from Dr. Elder.
> >
> > I'm having a problem with assigning a value when IsUndefined is true.
> >
> > At some point, I need to compute how long the weekly MACD histogram
> > has been under 0.
> >
> > So this is what I wrote,
> >
> > nbBarsSinceBelowZero :=
> > If( IsUndefined(BarsSince(Fml("Wkly MACD Histogram")>0)),
> >     10000,
> >     BarsSince(Fml("Wkly MACD-Histogram")>0));
> >
> > When I plot the variable nbBarsSinceBelowZero, there is a large gap
> > at the beginning of the graph i.e. nbBarsSinceBelowZero is also
> > undefined but I would expect it to have a value of 10000 instead.
> >
> > However if I write
> >
> > If( IsUndefined(BarsSince(Fml("Wkly MACD Histogram")>0)),
> >     10000,
> >     0);
> >
> > I get 10000 at the beginning where I was getting no value and then a
> > lot of 0. So this is clearly a bug in MetaStock.
> >
> > Does anybody have a work around for that problem?
> >
> > Thank you,
> > Stephane
> >
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > equismetastock-unsubscribe@xxxxxxxxxxxxxxx
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
>
>
>
>
> To unsubscribe from this group, send an email to:
> equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>



To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/