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

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 TraderBCL, Today, 04:38 AM
      2 responses
      8 views
      0 likes
      Last Post TraderBCL  
      Started by martin70, 03-24-2023, 04:58 AM
      14 responses
      105 views
      0 likes
      Last Post martin70  
      Started by Radano, 06-10-2021, 01:40 AM
      19 responses
      606 views
      0 likes
      Last Post Radano
      by Radano
       
      Started by KenneGaray, Today, 03:48 AM
      0 responses
      4 views
      0 likes
      Last Post KenneGaray  
      Started by thanajo, 05-04-2021, 02:11 AM
      4 responses
      471 views
      0 likes
      Last Post tradingnasdaqprueba  
      Working...
      X