Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tradestation/Ninja Order timing.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Tradestation/Ninja Order timing.

    In Tradestation, if I enter a position, and place a Profit and stop, when I reach one of those, the other is automatically canceled.

    For example:
    if AverageFC(10) crosses over AverageFC(100) then
    buy next bar at market;

    if marketposition = 1 then begin
    sell next bar at entryprice + 10 limit;
    sell next bar at entryprice - 10 stop;
    end;

    When one of the 2 exit orders is hit, the other is IMMEDIATELY cancelled.

    However, if I use the following EL code, the other order is not canceled until the beginning of the next bar.

    if lastbaronchart and NTConnected(1) then begin
    if AverageFC(10) crosses over AverageFC(100) then
    NTBuyMarket("LE",1);

    if NTmarketposition("") > 0 then begin
    NTSellLimit("LPT",entryprice + 10, 1);
    NTSellStop("LStop",entryprice - 10, 1);
    end else begin
    NTCancel("LPT");
    NTCancel("LStop");
    end;
    end;

    I appreciate your help in advance!

    #2
    Forgot to mention, this is all running in simulation mode.

    Comment


      #3
      sgordon77,

      That is because your orders are not submitted as OCO orders. Your cancellation command is not sent until the next bar that is why you don't see it till the next bar. If you want OCO you need to use NTCommand to submit your orders.
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      147 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      4 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,282 views
      0 likes
      Last Post Leafcutter  
      Working...
      X