• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Placing Order ERROR

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

    Placing Order ERROR

    Hello, I have a strategy which place EnterLongLimit orders. If the markets go higher this order is canceled by command:
    Code:
    CancelOrder(myLongOrder);
    I have tried also:
    Code:
    CancelAllOrders(true, true);
    Up to this it seams it's working (there is no error in the log and there is an information that the order has been canceled), then the strategy shoul place another Limit order by:
    Code:
    EnterLongLimit
    At this point, the command which should place the order (EnterLongLimit) returns null during debuging.

    Please can anyone help?

    Thanks.
    Last edited by Luigio; 03-15-2019, 05:43 PM.

    #2
    First, have you studied the constraints here?

    Read section "Internal Order Handling Rules that Reduce Unwanted Positions" and pay special attention to the example showing how "EnterLongLimit" might be ignored.

    Second, some questions for you,

    1. NT7 or NT8?

    2. Are you saving the order handles returned by EnterLongLimit?

    3. Are you using unique signals for your calls to EnterLongLimit?

    4. Are you setting order handles returned by EnterLongLimit to null inside OnOrderUpdate when that order is OrderState.Cancelled?

    5. Are you setting order handles returned by EnterLongLimit to null inside OnExecution when that order is OrderState.Filled?

    6. Are you waiting for the completion of all orders to be cancelled before sending your next EnterLongLimit?

    Assuming NT7, you may not be doing #6, which is a common error.

    To start debugging, try something like this,

    Code:
        if (EntryOrder != null)
            Print("Not ready yet - EntryOrder has not been nullified by OnOrderUpdate or OnExecution");
        else
            EntryOrder = EnterLongLimit(...);
    PS: This NinjaTrader sample shows that the proper way to nullify the order handles is 1) inside OnExecution when the order is OrderState.Filled, or 2) inside OnOrderUpdate when the order is OrderState.Cancelled. Note: A special case is handled 3) inside OnExecution when the order is OrderState.Cancelled but order Filled quantity > 0 -- the sample shows these 3 situations all result in order nullification. Other than when you initially define your IOrder EntryOrder variable, these are the only situations where your strategy should ever ever nullify EntryOrder.

    PPS: Doesn't sound like your issue, but you should be very familiar with EnterLongLimit and "Live Until Cancelled Orders", and with this sample.
    Last edited by bltdavid; 03-16-2019, 02:50 AM.

    Comment


      #3
      Hello Luigio,

      bltdavid is asking the right questions.

      To start, is the myLongOrder OrderState OrderState.Accepted or OrderState.Working when you are calling CancelOrder()?
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by saeed, Today, 12:32 PM
      0 responses
      1 view
      0 likes
      Last Post saeed
      by saeed
       
      Started by motog4, Today, 11:42 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Started by derivtrader, Today, 11:20 AM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by TAJTrades, Today, 10:34 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by timcjpfx, Today, 10:20 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X