Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order getting cancelled... why?

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

    Order getting cancelled... why?

    Hi:

    I'm having a problem with an strategy cancelling Limit orders, and I don't know how to sort it out.

    On OnBarUpdate, if entry conditions are met I execute:

    SetProfitTarget("", CalculationMode.Price, priceTarget);
    SetStopLoss("", CalculationMode.Price, priceStopLoss, false);
    PacManEntryPrice = priceIn + 5 * TickSize;
    EnterShortLimit(p032NumContractesPacMan, PacManEntryPrice, "PACMAN");
    DrawTriangleUp("pacman"+CurrentBar,true,0,PacManEn tryPrice,Color.Blue);

    The problem comes because the order is valid of 1 bar only, then gets cancelled :-(.

    What should I do to have this order valid until it is cancelled by the strategy decision?


    Following is an example taken from output


    17/01/2014 15:01:21 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=9726 Currency=0 Simulated=False

    17/01/2014 15:01:21 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=9764,5 Currency=0 Simulated=False

    17/01/2014 15:01:21 Entered internal PlaceOrder() method at 17/01/2014 15:01:21: BarsInProgress=0 Action=SellShort OrderType=Limit Quantity=1 LimitPrice=9747,0 StopPrice=0 SignalName='PACMAN' FromEntrySignal=''

    17/01/2014 15:01:21 Cancelled expired order: BarsInProgress=0: Order='NT-00043/Sim101' Name='PACMAN' State=Working Instrument='FDAX ##-##' Action=SellShort Limit price=9747 Stop price=0 Quantity=1 Strategy='SB_AneuACagar_v1_06' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='bf85283bc61c4086b9a6d19a0ad23cfd' Gtd='01/12/2099 0:00:00'

    Thanks!
    Pak

    #2
    Originally posted by pakricard View Post
    Hi:

    I'm having a problem with an strategy cancelling Limit orders, and I don't know how to sort it out.

    On OnBarUpdate, if entry conditions are met I execute:

    SetProfitTarget("", CalculationMode.Price, priceTarget);
    SetStopLoss("", CalculationMode.Price, priceStopLoss, false);
    PacManEntryPrice = priceIn + 5 * TickSize;
    EnterShortLimit(p032NumContractesPacMan, PacManEntryPrice, "PACMAN");
    DrawTriangleUp("pacman"+CurrentBar,true,0,PacManEn tryPrice,Color.Blue);

    The problem comes because the order is valid of 1 bar only, then gets cancelled :-(.

    What should I do to have this order valid until it is cancelled by the strategy decision?


    Following is an example taken from output


    17/01/2014 15:01:21 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=9726 Currency=0 Simulated=False

    17/01/2014 15:01:21 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=9764,5 Currency=0 Simulated=False

    17/01/2014 15:01:21 Entered internal PlaceOrder() method at 17/01/2014 15:01:21: BarsInProgress=0 Action=SellShort OrderType=Limit Quantity=1 LimitPrice=9747,0 StopPrice=0 SignalName='PACMAN' FromEntrySignal=''

    17/01/2014 15:01:21 Cancelled expired order: BarsInProgress=0: Order='NT-00043/Sim101' Name='PACMAN' State=Working Instrument='FDAX ##-##' Action=SellShort Limit price=9747 Stop price=0 Quantity=1 Strategy='SB_AneuACagar_v1_06' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='bf85283bc61c4086b9a6d19a0ad23cfd' Gtd='01/12/2099 0:00:00'

    Thanks!
    Pak
    Use the correct calling syntax. Look up "liveUntilCancelled" in the NT Help.
    Code:
    EnterShortLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)
    ref: http://www.ninjatrader.com/support/h...shortlimit.htm

    Comment


      #3
      Hello pakricard,

      NinjaTrader will cancel an order if the order is not filled in the same bar that it is submitted to and if the entry order condition is not true again.

      If you would like the order to remain either the entry condition has to be true the next bar, or you may use the Advanced Order Handling approach that koganam suggested.
      JCNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X