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

Performance considerations

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

    Performance considerations

    Hi,

    I'm after some general advice. I am trying to optimise the platform as much as possible to save ninja cpu cycles. I have an indicator that updates 'on price change', because I want a pre-emptive alert mid bar, but this uses too much cpu as the series is considered each time. On bar close is too late. In very active markets, price can change a lot flicking between bid and ask and I don't actually need it that often.

    In this circumstance, would adding a variable with the last time updated and limiting the update via the indicator to, say, 500ms be a good and acceptable practise?

    If there are any preferred methods, or suggestions? Please let me know.

    #2
    Hello pjsmith,

    Thanks for opening the thread.

    What you have mentioned sounds like it can be a reasonable solution. OnPriceChange is the middle ground between OnEachTick and OnBarClose. If you are trying to optimize your indicators to do less calculations in a highly volatile market with your suggested approach, the following items come to mind:
    • Using OnPriceChange to only iterate OnBarUpdate() on price changes
    • Checking the changes in price so if there is a large enough change in price, your indicator will still calculate
    • Making sure you are still calculating the indicator for IsFirstTickOfBar to assure OnBarUpdate() iterations for bar closes so plots update as expected


    For the thread's reference, I have included a link to the IsFirstTickOfBar documentation - https://ninjatrader.com/support/help...ttickofbar.htm

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,603 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    8 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    12 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X