• 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

sequence of events

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

    sequence of events

    what is the sequence of events when i add a strategy to a chart? for example, if the price is drawn, then the indicator computed, then the strategy. it means that the strategy can see in the future. on the other hand, if the price, indicator and strategy are calculated bar by bar, the indicator can't see in the future.

    #2
    Hi tubular2000,

    Thanks for your note.

    When a strategy is added to a chart only the Intialize() function will be run. This is to initialize variables and set defaults. No other functions will run in the script at that time.

    For all NinjaScripts, indicator or strategy, certain functions run at certain times.

    First, the data will be received by the platform and processed. Next the bar will appear on the chart.

    The OnBarUpdate will run whenever a bar is closed (when CalculateOnBarClose is set to true) or when a tick is received (when CalculateOnBarClose is set to false).

    OnMarketData will always run whenever any data is received (such as a tick, or daily high, daily low, volume etc).

    An indicator and strategy added directly to the same chart will be asynchronous, meaning that there is no guarantee that either will run before the other. They will both depend on NinjaTrader closing a bar or receiving data independently.

    An indicator that is called from a strategy will always be run when it is called.


    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Erhard, Today, 04:24 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_ChrisSch  
    Started by rontronimous, Yesterday, 05:55 PM
    2 responses
    18 views
    0 likes
    Last Post rontronimous  
    Started by brunoviveiros, Today, 04:26 AM
    0 responses
    3 views
    0 likes
    Last Post brunoviveiros  
    Started by StevenNelson, 11-19-2019, 05:39 AM
    3 responses
    21 views
    0 likes
    Last Post brucerobinson  
    Started by guidoisot, Today, 03:01 AM
    0 responses
    8 views
    0 likes
    Last Post guidoisot  
    Working...
    X