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 cmtjoancolmenero, Yesterday, 03:58 PM
    11 responses
    39 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by FrazMann, Today, 11:21 AM
    0 responses
    5 views
    0 likes
    Last Post FrazMann  
    Started by geddyisodin, Yesterday, 05:20 AM
    8 responses
    52 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by DayTradingDEMON, Today, 09:28 AM
    4 responses
    26 views
    0 likes
    Last Post DayTradingDEMON  
    Started by George21, Today, 10:07 AM
    1 response
    22 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X