Tradestation easy language question

Discussion in 'Automated Trading' started by shortskirt, Jun 11, 2006.

  1. I'm write a strategy in Tradestation and want to implement a limit order that is only valid for (n) minutes. E.g. enter a limit order at the low of the close of the current bar and if i don't get filled in 15 minutes cancel the order.

    From what i understand from the TS documentation, if an order isn't filled by the end of the next bar, the order is cancelled.

    Has anyone had any experience with the type of orders i'm trying to do?

    Many thanks!
     
  2. the order will remain in effect for the rest of the bar. so if your using 15 minute bars that would work. but you have to consider if the condition will still be true during the next bar. if so its going to try to buy/sell every bar the conditions are true. i have a program i use that creates a signal every 15 minutes but only has the order good for 1 minute.
     
  3. I'm using 1 minute bars, so i would want the order to be active for 15 bars in this example. From further reading it looks like i'd have to re-submit the order at the close of every bar if i didn't get filled. Seems a bit odd that i can't just specify the order to be good until cancelled.
     
  4. tradeProg

    tradeProg

    You need to reissue (refresh) the order every bar. I say "refresh", because TS will not "cancel" the order until you stop reissuing.

    I would code the long side as:

    if marketposition=0 then
    begin
    ....if retries = 0
    ........and (condition1 and condition2) then // signal conditions
    ....begin
    ........limit_price = low;
    ........retries = 15;
    ....end;

    ....if retries > 0 then
    ....begin
    ........buy next bar at limit_price;
    ........retries = retries - 1;
    ....end;
    end;

    if marketposition=1 and marketposition[1] <> 1 then // just went long
    ....retries = 0;
     
  5. Thanks tradeProg