Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Variable Assignments

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

    Variable Assignments

    When using the unmanaged approach, should I assign orders in OnBarUpdate or OnOrderUpdate? And when that order is filled, should I assign the executed order in OnExecutionUpdate? The help guide gives an example of assigning variables in OnBarUpdate, but then says to assign in OnOrderUpdate for more accurate assignments.

    Any help is appreciated.
    Last edited by Lumbeezl; 01-24-2019, 06:03 PM. Reason: Added tags

    #2
    Hello Lumbeezl,

    In general, this would be up to your design but it is commonly suggested to use the OnOrderUpdate or OnExecutionUpdate for multiple reasons, often to assign variables as this would be more accurate toward the actual order events. These overrides are event-driven based on the events of the orders so you can use that information to further drive logic. This is more accurate in the sense that you are not waiting on a bar close or for data to come in to drive the script.

    If you only need to know when the order is filled to assign the variable, you could just use OnExecution however if you needed to track the order earlier on OnOrderUpdate would be best. Using the order events would generally be suggested for situations where you may need to track partial fills or also do other actions based on the order events rather than waiting for bar closes, however, this is again dependant on your overall goal.

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    24 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    46 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    23 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X