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

Re: Re: Avoid reentering



PureBytes Links

Trading Reference Links

I use the same logic as Alex, with one minor change:
In place of 
 if marketposition <= 0 {....}
 if marketposition >= 0 {....}
try
 if marketposition < +1 {....} then buy  {...}
 if marketposition > -1 {....} then sell {...}

This is a bit cleaner.

Regards,
Leslie

> 
> From: alex@xxxxxxxxxxxxxx (Alex Matulich)
> Date: 2003/01/07 Tue AM 11:45:05 EST
> To: massimiliano.scorpio@xxxxxxxxxxxx (Scorpio Massimiliano)
> CC: omega-list@xxxxxxxxxx
> Subject: Re: Avoid reentering
> 
> Max wrote:
> >If the short moving average is above the long one I buy the market, the
> >opposite for selling.
> >If I want to use a trailing stop or profit taking and I exit from the
> >market, if the condition is still true, I immediatly re-enter in the same
> >position that I just closed.
> 
> And you want to avoid this.  It's easy, just use the marketposition
> variable.  I'll assume the names ShortAverage and LongAverage for your
> moving averages:
> 
> if marketposition <= 0 and ShortAverage>LongAverage then buy;
> if marketposition >= 0 and ShortAverage<LongAverage then sell;
> 
> marketposition is a TS internal value; it is +1 if you have a long
> position already open, -1 if you have a short position already open,
> and 0 if you have no open positions.
> 
> Therefore the two "if" statements above will enter the market ONLY
> when you have no open positions, or when your entry signal is
> opposite in direction to your open position.
> 
> -- 
>   ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
>  // +__>   Director of Research and Development
>  //  \ 
>  // __)    Unicorn Research Corporation -- http://unicorn.us.com
> 
>