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


Simple Indicator seems to be a Resource Hog

  • Filter
  • Time
  • Show
Clear All
new posts

    Simple Indicator seems to be a Resource Hog

    Hello, can someone look at this simple indicator and tell me why it is such a resource hog? And how to improve it? Are 6 plots too many? It is using almost as many resources as the Volume Profile.
    Attached Files

    It seems probable you're applying this to too small/fast of a time frame or on too many symbols and charts at a time. Is it running as a column in Market Analyzer? Or, is it on 20 charts all of which are small bars?

    Or, after adding it to the chart, are you changing it from its default OnBarClose to OnEachTick or OnPriceChange?
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey


      Actually, this is on only one 30 minute MES chart, and not on Market Analyzer. I should have mentioned that.
      Last edited by JohnS52; 12-03-2023, 07:33 AM.


        Just out of curiosity, how many days have you been running NT? I use 2-3 NQ range charts and I have almost never seen any indicator have more than 1 million ms of CPU time.


          Hello JohnS52,

          Thanks for your post.

          I do not see anything specific in the code you shared that would cause the indicator to use a large number of resources.

          Do you have Tick Replay enabled?

          As Leeroy_Jenkins stated, how many days have you been running NinjaTrader?

          For best performance, we suggest resetting NinjaTrader daily as noted in the help guide page below.

          Performance Tips:

          As a test, please restart NinjaTrader, then close any workspaces you have open, create a New > Chart window in the blank workspace, add the indicator to the chart, open the NinjaScript Utilization Monitor, and note the number of resources being used.

          Do you see the same behavior occur after running this test?

          Further, you could find performance tips from our help guide linked above. These tips will help optimize the performance of your platform.
          Brandon H.NinjaTrader Customer Service


            Thanks for your interest and your replies. That was about 24 hours of NT data. No Tick Replay enabled. It's doing it again today. Already 400,000+ms in about 2 hours, running On Price Change on two 30 minute charts. I usually do restarts of NT8 and my computer everyday. I will try and delete the cache and see if that helps.
            Last edited by JohnS52; 12-04-2023, 09:10 AM.


              Do you call this indicator within other indicators/strategies? It seems like it recalculates for all bars on each price change. It happened to me once with my own indicator.


                Hello Leeroy, I will have to look into that with a Print function. That could possibly be what's happening. But why would it do that?

                But no, I am not using it in any strategies, just the two 30 minute charts. I originally made it because the Lizard amaMacdBB indicator seemed to not work properly with the Markers Plus system: I was trying to simplify it.


                  Hello JohnS52,

                  Thanks for your notes.

                  When working with any issue, it is important to take steps to isolate the issue so that the exact line causing the behavior can be found.

                  This is a process of elimination and a process of debugging by adding prints.​

                  To see what section of code in the script is causing a large number of resources to be used you could reduce the code of the script and debug by adding prints.

                  Comment out one section of code at a time and test the script in a blank workspace on a single blank chart with no other indicators, strategies, or custom bar types applied to the chart. If at some point you comment out a section of code and see the behavior stopped, you could debug the script further by adding prints and uncommenting lines of code from the commented out section of code to narrow in on the offending code.
                  Brandon H.NinjaTrader Customer Service


                  Latest Posts


                  Topics Statistics Last Post
                  Started by osmanigarces, Today, 02:34 PM
                  2 responses
                  Last Post osmanigarces  
                  Started by Joseph Connors, 12-23-2020, 10:33 AM
                  12 responses
                  Last Post NinjaTrader_BrandonH  
                  Started by plenamar27, 02-21-2022, 08:40 AM
                  13 responses
                  Last Post waltFX
                  by waltFX
                  Started by Back2thefutures, Today, 04:34 PM
                  0 responses
                  Last Post Back2thefutures  
                  Started by stephan06, 03-01-2024, 03:56 PM
                  2 responses
                  Last Post stephan06