Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    598 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    557 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    555 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X