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

RE: Exit and Re-Entry firing on the *same* bar



PureBytes Links

Trading Reference Links

> Some time ago there was a post concerning how to prevent/preclude a
> System exiting and immediately re-entering 
> 12/21/99  9:55am  Buy   2  141^05  IJM -L
> *12/21/99  10:15am LExit2  144^05  Profit Target $ 5.50	$ 38.88
> *12/21/99  10:15am Buy  2  144^05  IJM -L
> 12/21/99  10:25am LExit	2  143^05  Money Mngmt S $-2.50	$ 36.38

I'd guess that your code continues to issue the "IJM -L" buy signal, 
even after you've gone long.  As long as you're long, and you don't 
allow multiple entries in the same direction, the extra buy signals 
are ignored.

But as soon as you hit your profit target and exit, *poof* you're no 
longer long, and the "IJM -L" buy order (probably a stop?) can jump 
right in.  Instantly you're long again.

Solution:  stop issuing the buy order when you're already long.  If 
you're using something like

  var Bstop(0);
  Bstop = mumble;
  buy at Bstop stop;

change it to something like this:

  var Bstop(0);
  Bstop = mumble;
  if High > Bstop then Bstop = 0;  { Clear stop when it's hit }
  if Bstop > 0 then buy at Bstop stop;

Gary