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 pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    382 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X