Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Best practices - Calculate.OnPriceChange

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

    Best practices - Calculate.OnPriceChange

    There are many indicators that do not use other than price information.

    For those indicators it does not make sense to call them with every incoming tick. NinjaTrader 8 has an improvement here, as it is possible to run OnBarUpdate() on price change only.

    The idea here is to force an indicator to run in Calculate.OnPriceChange when the user erroneously select Calculate.OnEachTick. This would be done in State == State.SetDefaults. Now adding the following lines

    Code:
    if(Calculate == Calculate.OnEachTick)
          Calculate = Calculate.OnPriceChange;
    works, when the indicator is added to a chart.

    Here comes my question: If I call such an indicator from another indicator or strategy that runs in Calculate == Calculate.OnEachTick, would that produce any conflicts when the called indicator is forced to run in Calculate == Calculate.OnPriceChange?

    #2
    Hello Harry, and thank you for your question. Bearing in mind your indicator or strategy's lifecycle for states earlier than realtime, once your indicator or strategy enters realtime, every sub-indicator's OnBarUpdate and OnMarketData events will trigger independently of the parent indicator or strategy. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by f.saeidi, Yesterday, 08:12 AM
    3 responses
    24 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by algospoke, Yesterday, 06:40 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by quantismo, Yesterday, 05:13 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by The_Sec, 04-16-2024, 02:29 PM
    3 responses
    16 views
    0 likes
    Last Post NinjaTrader_ChristopherS  
    Started by hurleydood, 09-12-2019, 10:45 AM
    15 responses
    1,099 views
    0 likes
    Last Post Leeroy_Jenkins  
    Working...
    X