Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order bookkeeping issues for live and simulation

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

    Order bookkeeping issues for live and simulation

    I am wonder if there is any order bookkeeping mechanism in NT7. I am going to implement one. There is an example SampleMonitorStopProfit in the forum.

    protected override void OnOrderUpdate(IOrder order)
    {
    if (order.OrderState = = OrderState.PendingSumbit)
    {
    orderbook.Add(order)
    }

    if (order.OrderState == OrderState.Cancelled || order.OrderState == OrderState.Filled || order.OrderState == OrderState.Rejected)
    {
    orderbook.Remove(order)
    }
    }

    Therefore I can query the orderbook to find those pending order and trying to modify it. However, there is a question. Suppose I stop the strategy which already place an stop order in the broker, what will happen to the orderbook if I restart the strategy? As the time the strategy just before live, those orders are handled by NT7 internally. Will the order state and info about the order will be reflected once it turns into live order? Will the orderbook syn during switch from sim to live?

    Thanks!

    #2
    Welcome to our forums - depending on the sync options you've chosen NinjaTrader would rerun the historical portion of the strategy and match to any open orders already running on the account, it has to be a 100% match though to be considered value.



    If you directly compare IOrders you would be fine, but if you're working with the Tokens and OCO strings as well be advised those will change as your strategy goes from historical to live, the order id itself can also change in the lifetime cycle of the order.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    71 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X