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

IOrder states logic

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

  • bltdavid
    replied
    Good info here, too:

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello bltdavid,

    Thank you for your post.

    You would use OnOrderUpdate() and check for the Error listed as ErrorCode.UnableToChangeOrder. Keep in mind the order will just stay in the state it was, so the state won't change.

    For information on what information you can pull from an order event please visit the following link: http://ninjatrader.com/support/helpG...t7/?iorder.htm

    Leave a comment:


  • bltdavid
    replied
    "not accepted" vs "rejected": Calling ChangeOrder on a Working order

    Something in this order flow chart is not as clear as I was hoping for.

    When ChangeOrder() is issued on an order in the Working state, and the change is not accepted, doesn't the original state of the order remain in the Working state?

    See last post in this thread:


    It seems the chart does not quite reflect Josh's point.

    My deeper question is this:
    If Josh's comment in the above thread is true, how does one discover the change request was not accepted? I mean, what does "not accepted" mean? I note that Josh did not use the word "rejected", he specifically used the words "not accepted".

    Ok, so if a Working order remains in a Working state after a ChangeOrder() is not accepted, how does one discover this "not accepted" status of the call to ChangeOrder?

    [I mean, one could assume that a change request via ChangeOrder that is not accepted would change a Working order to a Rejected order ... but if Working state means working at the exchange, I can understand how a "not accepted" change request would not actually affect the status of "working at the exchange".]

    Thus, I can see how it does make sense that a change request that is "not accepted" does not change the state of a Working order. But, there we go again ... from a NinjaScript point of view (aka the Strategy programmer) what does "not accepted" really mean?

    How does the strategy programmer know that a change request via ChangeOrder on a Working order is "not accepted"? ChangeOrder has no return value ...

    Am I nuts?
    What am I missing?
    In context of calling ChangeOrder on a Working order, what is the difference between "rejected" and "not accepted"?

    And, also, for sake of complete understanding, are there cases where a ChangeOrder on a Working order would ever change the state to Rejected?

    And, lastly, does the order flow chart need updating to reflect any of this?
    Last edited by bltdavid; 10-14-2015, 11:38 PM. Reason: Added question "for sake of completeness"

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    Very cool - I appreciate the efforts in this thread. We'll look to have something of this nature added to NinjaTrader 8 documentation when we have the time.

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello,

    Thank you all for your comments on misova's diagram.

    I have forwarded koganam's suggestion to the development team for consideration in the documentation.

    Leave a comment:


  • koganam
    replied
    Originally posted by misova View Post
    I am sending the latest version of IOrder state diagram.
    The layout was significantly changed towards lower complexity
    and to be more specific and precise...


    Very nicely done. Makes the order states clear and transparent. I suggest the NT adopt it and put it in the official documentation.

    Leave a comment:


  • misova
    replied
    I am sending the latest version of IOrder state diagram.
    The layout was significantly changed towards lower complexity
    and to be more specific and precise...


    Attached Files

    Leave a comment:


  • misova
    replied
    Originally posted by gregid View Post
    I would suggest adding vertical swim lanes to separate which state/action happens on the PC or at the broker side
    I am not sure, how to draw it ....the only action I see at the broker side is to reply with OK / REJECTED...

    In my thinking it would introduce some request / response sequence diagram,
    which I am not sure, how to draw and mix with current state nature of diagram
    in some elegant and simple way..

    If you have any idea how to draw it, I will do it pleasure...
    Last edited by misova; 05-01-2015, 10:34 AM.

    Leave a comment:


  • gregid
    replied
    I would suggest adding vertical swim lanes to separate which state/action happens on the PC or at the broker side

    Leave a comment:


  • misova
    replied
    Thanx, should be updated and OK now...

    Leave a comment:


  • gregid
    replied
    Originally posted by misova View Post
    This is the latest version of the IOrder states diagram,
    where were added in red color:
    1. Overfill event
    2. Rejection event

    These are good candidates for error handling.
    Still any other improvements/insights ?

    There is a problem with your attachment - can you submit it again?

    Leave a comment:


  • misova
    replied
    Latest version of IOrder states diagram

    This is the latest version of the IOrder states diagram,
    where were added in red color:
    1. Overfill event
    2. Rejection event

    These are good candidates for error handling.
    Still any other improvements/insights ?

    Attached Files
    Last edited by misova; 05-01-2015, 01:32 AM.

    Leave a comment:


  • NinjaTrader_AlexG
    replied
    Hello,
    Thanks for the reply.

    If an order is filled and you attempt to modify the order before the filled status is received the order modification order will be rejected. The original order will be filled and is not rejected.

    The modification is the rejection and the original order will be filled.

    Leave a comment:


  • misova
    replied
    As I am reading another forums, I think I start to understand the mechanics of Rejected order state.

    I misunderstood: that if order is in state Rejected, then it was refused and could have Filled Quantity. My simple logic said: order was Rejected, so it could not be filled.

    But now I start to see my mistake: In reality, order can be in state Rejected could be filled (=have Filled Quantity).

    It is most common scenario, that order that was filled is in state Filled or PartFilled, but it can be also in state Rejected.

    This is something new for me...
    Last edited by misova; 04-30-2015, 09:57 AM.

    Leave a comment:


  • misova
    replied
    This part is understood now, thank you.

    Could you put more light on Comment #9 also please?
    There is a problem discussing, that Rejected and Filled status should be exclusive states,
    but probably they are not. ..

    Thanks

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by wzgy0920, 04-20-2024, 06:09 PM
2 responses
26 views
0 likes
Last Post wzgy0920  
Started by wzgy0920, 02-22-2024, 01:11 AM
5 responses
32 views
0 likes
Last Post wzgy0920  
Started by wzgy0920, Yesterday, 09:53 PM
2 responses
49 views
0 likes
Last Post wzgy0920  
Started by Kensonprib, 04-28-2021, 10:11 AM
5 responses
192 views
0 likes
Last Post Hasadafa  
Started by GussJ, 03-04-2020, 03:11 PM
11 responses
3,234 views
0 likes
Last Post xiinteractive  
Working...
X