• 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

  • Luigio
    started a topic Placing Order ERROR

    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.

  • NinjaTrader_ChelseaB
    replied
    Hello Luigio,

    bltdavid is asking the right questions.

    To start, is the myLongOrder OrderState OrderState.Accepted or OrderState.Working when you are calling CancelOrder()?

    Leave a comment:


  • bltdavid
    replied
    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.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by sun0781, Today, 05:02 PM
0 responses
6 views
0 likes
Last Post sun0781
by sun0781
 
Started by ronhb107, 09-12-2019, 10:09 AM
4 responses
41 views
0 likes
Last Post Mr.Trader  
Started by rwilliam, Today, 03:55 PM
0 responses
3 views
0 likes
Last Post rwilliam  
Started by asmmbillah, Today, 03:42 PM
2 responses
7 views
0 likes
Last Post asmmbillah  
Started by NT-Roland, Today, 03:25 PM
0 responses
7 views
0 likes
Last Post NT-Roland  
Working...
X