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

TS5 appears to generate invalid signals when using Buy STOPs below the market...


  • To: "List, Omega" <omega-list@xxxxxxxxxx>
  • Subject: TS5 appears to generate invalid signals when using Buy STOPs below the market...
  • From: "Brian Massey" <bnm03@xxxxxxx>
  • Date: Thu, 25 Nov 1999 18:27:50 -0800

PureBytes Links

Trading Reference Links

I was writing a system that bought pullbacks to a moving average that was
below the market in an up trend.  I had changed a previous Buy signal
statement to buy below the market rather than above it but didn't change the
Stop order in the statement from STOP to LIMIT.

{I'm using Jurik's MA (updated version with SP3 fix) but the concept is the
same}

MA_L = XAverage(C, 14);
Buy ("B1") At MA_L STOP;

When I ran it, the results were fantastic.  Skeptical, I started leafing
through the signals and noticed that TS was generating Buy signals at the
highs of the previous day when it should have never generated a signal.  The
MA where the stop was supposed to be placed wasn't close the current price
and no signal should have been generated.

Aside from the kind words I uttered about this being the 3rd build with
still these types of problems, this had me stumped so I went to get a bowl
of cereal.  When I got back, I looked through my code and noticed the
problem with the buy signal using STOP instead of LIMIT.  I changed it to:

MA_L = XAverage(C, 14);
Buy ("B1") At MA_L LIMIT;

When I changed it, results changed dramatically (more down to earth) and
appear to be more realistic.  The bad signals seemed to have gone away.

>From this I concluded 3 things:

1. Make sure you know where your orders are being placed (above or below the
market) when using STOP and LIMIT orders in your code.  If you have a system
that just arbitrarily places orders that could be either above or below the
market and you hardcode just either STOP or LIMIT, then your results could
be wrong.  The thing to do would be to have two statements that used
buy-limit when below the market and buy-stop when above.

2. Always question authority!  Review the signals that TS says are valid.
It sucks that you have to do this but you have to.

4. If this is a defect as it appears to be, the design of TS and EL is
lacking.  EL should catch errors like this (because they're so easy to make)
during !!RUNTIME!! and report them to the user instead of generating
erroneous signals.

I would prefer to see EL handle STOP and LIMIT orders automtically instead
of requiring the user to specify STOP or LIMIT.  These words should be kept
in EL vocabulary for backwards compat and maximum control for those who want
to use them.  But EL should simply allow a price to be stated (maybe it
already does but my tests have not shown this) and then handle the STOP or
LIMIT automtically.

The statement would look like this:

Buy("B1") At MA_L ; {Right now this generates a compile-time error in EL}.