<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy > Order Methods > Managed Approach >


Previous page Return to chapter overview Next page


Returns a matching real-time order object based on a specified historical order object reference.


Note:  This method is only needed if you have historical order references which you wish to transition and manage in real-time (i.e., you had a working order which was submitted historically and re-submitted in real-time as the strategy is enabled).  You only need to call this method once (e.g., during OnStateChange() as the strategy State transitions from State.Historical to State.Realtime).  Please see the Advanced Order Handling section on transition orders for more details.



Method Return Value

Returns a real-time order reference associated with the historical order object.  If no associated order exists (i.e. OrderState is Filled, Canceled, Rejected, Unknown), a null value returns


GetRealtimeOrder(Order historicalOrder)




The historical order object to update to real-time






private Order myOrder;
protected override void OnStateChange()
  if (State == State.SetDefaults)
    Name   = "Example Strategy";
  // one time only, as we transition from historical to real-time
  else if (State == State.Realtime)
    // convert any old historical order object references
    // to the new live order submitted to the real-time account
    if (myOrder != null)
        myOrder = GetRealtimeOrder(myOrder);