• 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 gtpiylnu, Yesterday, 11:23 PM
    0 responses
    2 views
    0 likes
    Last Post gtpiylnu  
    Started by Trade95, Yesterday, 05:38 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_EricB  
    Started by Karelgp7, Yesterday, 03:16 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by orenytz, Yesterday, 01:18 PM
    1 response
    22 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by des.kkeng, Yesterday, 01:10 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X