Another Tradestation 2000i Question - Stop Orders in Strategy Tester

Discussion in 'Trading Software' started by sslack88, Jul 19, 2007.

  1. sslack88


    I just created a signal with the following buy logic:

    buy at opend(0) + value stop;

    Now I started exploring the individual trades on the backtest report. Some of the trades are being filled at the High of the bar, some are being filled at a value between the [opend(0) + value] and the high, etc.

    How does Tradestation set the buy price when you are using a Buy stop?

    I want to replicate this code in C++, but I am having trouble figuring out how Tradestation handles this.

    As always, thanks for your help.

  2. ronblack


    To start with, I'm not sure your entry makes sense. As a general rule, you cannot have an entry at the open while you are already at that bar. But I may be missing what you're trying to do.

    I recall that TS2000i implements an algorithm for "looking inside a bar". I don't remember the details since it's been a long time but in general if the open of the day is closee to the low it assumes the low occurred before the high and vice versa if the open is closer to the high. This was supposed to produce more realistic back testing results but I disagree with such approach. This algorithm maybe the reason you are getting the variations you do.

  3. sslack88


    Hi Ron, it seems to be doing what you are describing. It seems like there is some algorithm at work.

    To be clear on the code, I am placing a buy stop when the price equals or exceeds the (Open + Some Value). For example:

    Open = 1100
    Value = 5 points

    Place a buy stop order @ 1105. So when the price is greater than or equal to 1105, Tradestation will generate a Buy order.

    What I am seeing in the individual trades is sometimes it will buy at the high of a 1-minute bar after 1105 is reached, but the buy price might be 1105.75, 1105.50, etc.

    It's like TS is putting slippage into the buys.
  4. sslack88


    I just figured out what was happening.

    TS is rounding up to the nearest 0.25 point. For example, you cannot buy ES at 1243.80 so it rounds up to 1244.