Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose = False & CPU use

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CalculateOnBarClose = False & CPU use

    Hi guys

    This may be a difficult one but I'll run it past you anyway.

    I've coded up a trailing stop strategy that would ideally be calculated with each tick rather than on the close of each range bar.

    (This strategy is a bit more intricate than with the usual auto trails. which are, I believe, calculated with each tick but which are not, I would guess, very CPU intensive.)

    My worry is how CPU intensive strategies can be with CalculateOnBarClose = False. I haven't got a very powerful PC: dual core 1.8 with 2GB RAM.

    Is there any way of estimating how CPU intensive a strategy is? I'm worried that my slightly antiquated CPU may go into meltdown!

    It may be imperative for me to upgrade my PC system, of course.

    Any pointers you could give me would be much appreciated.

    #2
    Hello,

    There is no way guessing how CPU intensive a partaular strategy will be. This will ultimatley depend on the number of functions that are being called in OnBarUpdate().

    You will just need to benchmark your strategy. You can open the Windows Task manager--> click on the Processes tab and keep an eye on the "NinjaTrader.exe" process and the CPU column. This will tell you exactly how much of your CPU NinjaTrader is using.

    Keep in mind that your strategies are going to run on a single thread. This means on a Dual Core processor, 50% of the CPU would indicate your maxing out the CPU. On a Quad core, 25% would be maxed out.

    I'd suggest running this on COBC true vs false and try to see how the application responds.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks very much for your advice, Matthew. I'll certainly follow your suggestions.

      I've thought of a way of maybe dealing with this situation unless I've misunderstood something:

      My entry strategy and only my entry strategy depends on range bars and indicators. The exit strategy depends entirely on the stop algorithm (ultimately, in the same way a conventional trailing stop works) and therefore on price alone.

      I know it's possible to have strategies with multi-instrument possibilities (though I've never tried this and I know it can get quite complex). Would I be right in thinking that the following might be feasible?

      1) The entry conditions depend on range bars alone, say, 4 range bars in the ES contract.

      2) A trade is executed.

      3) The exit conditions depend on, say,1 range bars or even time-based bars, say '10 second' bars. These would be less precise than 'COBC=false', depending necessarily on every tick, but the strategy would be far less CPU intensive.

      Could you kindly confirm that this would be possible, at least in theory. Thanks for letting me know.

      Comment


        #4
        I think you will be fine. I have a 2008 laptop with no issues. (T5450 processor@1.66Ghz)



        If it does melt down, then you'll need to upgrade.

        Originally posted by arbuthnot View Post
        Thanks very much for your advice, Matthew. I'll certainly follow your suggestions.

        I've thought of a way of maybe dealing with this situation unless I've misunderstood something:

        My entry strategy and only my entry strategy depends on range bars and indicators. The exit strategy depends entirely on the stop algorithm (ultimately, in the same way a conventional trailing stop works) and therefore on price alone.

        I know it's possible to have strategies with multi-instrument possibilities (though I've never tried this and I know it can get quite complex). Would I be right in thinking that the following might be feasible?

        1) The entry conditions depend on range bars alone, say, 4 range bars in the ES contract.

        2) A trade is executed.

        3) The exit conditions depend on, say,1 range bars or even time-based bars, say '10 second' bars. These would be less precise than 'COBC=false', depending necessarily on every tick, but the strategy would be far less CPU intensive.

        Could you kindly confirm that this would be possible, at least in theory. Thanks for letting me know.

        Comment


          #5
          Thanks, sledge. It's useful to know that the chances are my PC will probably survive the experience.

          The problem is, I do really need something that runs XP (therefore usually something fairly ancient) to run some third-party indicators. That's another factor that's holding me back form upgrading.

          Much obliged for your input.

          Comment


            #6
            Kogaman has a virtual machine set up on a new pc running XP virtually.

            I'll try to search for the post later.

            Why won't these indicators run on anything newer than XP?




            Originally posted by arbuthnot View Post
            Thanks, sledge. It's useful to know that the chances are my PC will probably survive the experience.

            The problem is, I do really need something that runs XP (therefore usually something fairly ancient) to run some third-party indicators. That's another factor that's holding me back form upgrading.

            Much obliged for your input.

            Comment


              #7
              Thanks again, sledge. Re the third party indicators: until very recently, they worked only on XP - even after all this time! They just couldn't adapt them for post-XP environments. They say they now do work for Vista and 7 but I had problems getting them to work for Vista, but it may just be my other PC playing up.

              Thanks for any information about that virtual machine.

              Comment


                #8
                Originally posted by arbuthnot View Post
                Thanks very much for your advice, Matthew. I'll certainly follow your suggestions.

                I've thought of a way of maybe dealing with this situation unless I've misunderstood something:

                My entry strategy and only my entry strategy depends on range bars and indicators. The exit strategy depends entirely on the stop algorithm (ultimately, in the same way a conventional trailing stop works) and therefore on price alone.

                I know it's possible to have strategies with multi-instrument possibilities (though I've never tried this and I know it can get quite complex). Would I be right in thinking that the following might be feasible?

                1) The entry conditions depend on range bars alone, say, 4 range bars in the ES contract.

                2) A trade is executed.

                3) The exit conditions depend on, say,1 range bars or even time-based bars, say '10 second' bars. These would be less precise than 'COBC=false', depending necessarily on every tick, but the strategy would be far less CPU intensive.

                Could you kindly confirm that this would be possible, at least in theory. Thanks for letting me know.
                Adding a second data series would be more CPU intensive. However what you're looking to do is possible.

                Please see our Reference Sample on Entering on one time frame and exiting on another:

                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Thanks again, Matthew, I'm guessing that adding a second series (although as you pointed out, it would be more CPU intensive than a strategy with only one series) would be less CPU intensive than running one series with 'COBC=false'. What I need to do is complete the strategy, run it in Sim and keep a steady eye on NinjaTrader.exe in Processes as you suggested.

                  Much obliged to you, Matthew, for your assistance with this.

                  Comment


                    #10
                    Just to add, sledge, that the indicators in question are the Jurik UT set. I'd recommend anyone to have a look at them at:

                    Comment


                      #11
                      Originally posted by arbuthnot View Post
                      Thanks again, sledge. Re the third party indicators: until very recently, they worked only on XP - even after all this time! They just couldn't adapt them for post-XP environments. They say they now do work for Vista and 7 but I had problems getting them to work for Vista, but it may just be my other PC playing up.

                      Thanks for any information about that virtual machine.
                      Here is the thread

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      648 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      369 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      108 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      572 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      573 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X