Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Javierw.ok, Today, 04:12 PM
      0 responses
      3 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Started by alifarahani, Today, 09:40 AM
      6 responses
      40 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X