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

Re: EL Help Please



PureBytes Links

Trading Reference Links

Rod:  This is a difficult issue that I have had to deal with many times in the
past.  Let me first tell you why this happens.  When you have a statement that
says to buy @ price, that order is being worked on the open of the next bar.  If
that next bar closes and you were not filled, unless that buy statement is
executed again, the order is lost.

What you need to do is use a variable to store the entryprice and continue to
restate the buy statement until order is filled.  Here is an example:

WRONG USAGE:
if x = y then buy 1150 stop;

CORRECT USAGE:
if x = y then buyprice = 1150;
if marketposition <> 1 then buy buyprice stop;

See, in the wrong example, if you don't get filled on the very next bar, unless x
= y again, the buy order is gone.  In the correct example, the buy price is
established when x = y and the order will be place on every bar afterwards until
"marketposition = 1" meaning that you are long.

Hope this helps.

Jay Becker

rod wheeler wrote:

> TS 4.0 Build 19.6
> Market:  S&P future
> Compression:  1 Minute
>
> I have a set of conditions which generate a buy signal at a specific price.
> The way the system is written ie: to buy at a specific price, is only valid
> in TS for the next bar after which the order seems to be cancelled.
>
> As an example:
> The system generates a buy order at 1150.00 on the close of a bar.
> The next bar doesn't get to 1150.00 so the order isn't filled.
> The next bar goes through 1150.00 but no entry is indicated.
>
> I would like the code to leave the order price in the market until it is hit.
>
> Any help or direction would be greatly appreciated. TIA
>
> Rod Wheeler