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

Re: Dallas System by Keith Fitschen CODING ATTEMPT



PureBytes Links

Trading Reference Links

Without trying to match this code to the system in question here is my basic flag construction with
what I hope will be a useful description. This has a number of applications and provides an accurate
and reasonably compact way of remembering whether a condition is true or false.

Start:=Fml("Your start condition");
Stop:=Fml("Your stop condition");
Init:=Cum(Start<>-1 AND Stop<>-1)=1;
Flag:=If(BarsSince(Init OR Start)>= BarsSince(Init OR Stop),0,1);

The Start and Stop code can be internal to the indicator, or external using an Fml(). If this was a
trade-in-progress flag then Start could be your Enter Long code, and Stop your Close Long code.

Init is for Initialisation, and this will give a starting reference point (value of 1) for any
BarsSince() or ValueWhen() to reference. It is the first bar for which the Start and Stop variables
return a valid value rather than N/A. This could also be done using the IsDefined() or IsUndefined()
functions for MS V7.xx, but V6.52 cannot use either "Defined()" function.

Including "OR Init" in subsequent ValueWhen() functions can be very useful because it allows the new
variable to be defined right from the first valid bar (Init=1) instead of returning N/A until the
required event happens. As most of you will know, including only one N/A variable in an indicator
renders the entire indicator N/A until all variables are valid - rather annoying at times.

The reason for using <>-1 (not equal minus one) is that it is very easy to construct a Start and
Stop variable that will never have a value of -1. Where there is a possibility of -1 as a legitimate
value then the Start variable (for example) could be changed to
Start:=Fml("Your start condition")>0; thus turning it into a binary and so eliminating -1 as a
possible value.

The Flag variable is constructed in such a way that it does not miss the first event. There can be
an issue when Start and Stop are true together but there are ways to get around that problem if
necessary.

Note that this method of flag construction does not use a PREV.

Roy


----- Original Message -----
From: "Dave Nadeau" <dave_nadeau@xxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Monday, 10 September 2001 16:28
Subject: RE: Dallas System by Keith Fitschen CODING ATTEMPT


> Hi Philip,
>
> Probably the easiest way to turn this flag on and off is to use the
> BarsSince function.  Create a variable that is defined by the low
> volatility
>
> Signal:=Sigma<Ref(Sigma,-Lookback);
> EnterLong:= <the entry conditions here>;
> EnterShort:= <the entry conditions here>;
> ExitLong:= <the exit conditions here>;
> ExitShort:= <the exit conditions here>;
>
> Since you don't want to reenter a position until your low volatility
> trade signal has occured, just make sure that the BarsSince your
> Signal are less than the BarsSince your ExitLong or ExitShort.
>
> This code will miss the first trade on the chart because BarsSince is
> defined only after ExitLong or Exitshort exists.  Roy had posted a
> great workaround for this problem.  I don't code very much in
> Metastock anymore, so I haven't used his technique.  Perhaps someone
> can fill in that missing piece.
>
> ================
> Dave Nadeau
> Fort Collins, CO
>
> > -----Original Message-----
> > From: owner-metastock@xxxxxxxxxxxxx
> > [mailto:owner-metastock@xxxxxxxxxxxxx]On Behalf Of Philip
> > Sent: Friday, September 07, 2001 11:52 PM
> > To: metastock@xxxxxxxxxxxxx
> > Subject: Re: Dallas System by Keith Fitschen CODING ATTEMPT
> >
> >
> > Greetings,
> >
> > Here's a first shot at coding the long side of "Dallas" --
> > thanks to the generous assistance of Dave
> > Nadeau! You'll see that I've used Dave's narrative as a
> > kind of fill-in-the-blanks exercise. I'm not
> > sure, though, how to include the set-up, i.e. the initial
> > volatility contraction. Any suggestions?
> >
> > Looks like there might be some useful ideas in "Dallas." I
> > would really appreciate any pointers the
> > more experienced technicians in the house may have to offer.
> >
> > CMA:= Close-Mov(Close,LengthMA,S);
> > Sigma:= StdDev(CMA,LengthStDev);
> > LengthStDev:= 50;
> > Lookback:= -22;
> > LengthMA:=3;
> >
> > {When Sigma becomes less than the Sigma of 22 bars ago, the
> > setup begins}
> >
> > Ref(Sigma > Ref(Sigma,Lookback),-1)?
> > or how about
> > Alert(Sigma > Ref(Sigma,Lookback), x?)
> >
> > and
> > Sigma > Mov(Sigma, LengthMA ,S)
> > and
> > Sigma > Ref(Sigma, Lookback )
> > and
> > Close > Ref(Close, Lookback )
> > {All signs that the volatility is increasing, and the price
> > is beginning to move upward}
> > and Close < Ref(Close,-1){small pullback}
> > {then}
> > {you'd enter long at the open of the next bar}
> >
> > Best regards,
> > Philip
> >
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>