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 PhillT, 04-19-2024, 02:16 PM
    4 responses
    31 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by ageeholdings, 05-01-2024, 05:22 AM
    5 responses
    36 views
    0 likes
    Last Post ageeholdings  
    Started by reynoldsn, Today, 02:34 PM
    0 responses
    9 views
    0 likes
    Last Post reynoldsn  
    Started by nightstalker, Today, 02:05 PM
    0 responses
    16 views
    0 likes
    Last Post nightstalker  
    Started by llanqui, Yesterday, 09:59 AM
    8 responses
    30 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Working...
    X