Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Memory Issue with OHL?

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

    Memory Issue with OHL?

    I have a few strats, the one i run daily in live is fairly complex compared to the others, has multiple series and instruments and runs fairly well on my machine, performance wise on a list of 100 equities.

    Yesterday, however, I created a similar strategy but added a High and Low measurement.

    As part of the new condition, I used

    double todaysHigh = CurrentDayOHL().CurrentHigh[0];
    double todaysLow = CurrentDayOHL().CurrentLow[0];

    and the performance hit to my machine was unbelievable. The strategies failed to even process all 100 names and load into a Market Replay or Live Market with any success.

    So as a test, I wrote a very simple toy NinjaScript Strategy incorporating these methods and suffered the same miserable performance result.

    Is this a known issue, perhaps (and hopefully) with a known fix?

    Thanks in advance and best regards,

    Andrew

    #2
    Hello Andrew,

    Thank you for your post.

    You can see performance dip if you are running calculations on a large number of instruments in your code. With that said there are also some additional items to take into consideration.

    Do you use Log() or Print() in your strategy?
    Please also ensure you do not have Debug Mode enabled as it can lead to lower performance. To disable, right mouse click in any NinjaScript Editor and uncheck the "Debug Mode" menu item. After doing so, press F5 to recompile.

    You can view all of the Performance Tips to improve the overall performance of NinjaTrader at the following link: http://www.ninjatrader.com/support/h...ance_tips2.htm

    Please let me know if you have any questions.

    Comment


      #3
      The 100 instruments run well on a daily basis. This is not the issue.

      I am not logging, and printing very minimally for the exact reasons you stated.

      Debug Mode, not using, not an issue.

      My question is specifically about

      Code:
      double todaysHigh = CurrentDayOHL().CurrentHigh[0];
      double todaysLow = CurrentDayOHL().CurrentLow[0];

      I have tried several ways to implement these and I am convinced that these methods, when added to a strategy, cause an enormous hit to performance...my entire machine freezes and I have yet to successfully load the list of stocks by adding this simple check of two intraday values.

      That is my exact and specific concern.

      Keep in mind that even a much simpler strategy than my primary strategy, when using these two calculations, will not load into Market Replay or LiveTrading, due to what I perceive to be memory/resource issues.



      Regards,

      Andrew

      Comment


        #4
        Hello Andrew,

        Thank you for that information.

        In the simple strategy we are still using 100+ instruments, correct?

        I look forward to your response.

        Comment


          #5
          Yes, I can run it with about 4-5 instruments before it begins to bog down.

          Compare this to my daily live strategy, much longer, more calculation, more dataseries, etc. It runs 100 with very little noticeable impact to performance.

          Comment


            #6
            Hello Andrew,

            Thank you for your response.

            Do you have a toy version of your simplified CurrentDayOHL() strategy that I may test on my end?

            Comment


              #7
              I do and I will send it now to [email protected] att: Patrick

              Comment


                #8
                code has been sent

                Comment


                  #9
                  Hello Andrew,

                  Thank you for your response,

                  I can confirm I have received the file and I will begin testing this item on my end.

                  I will follow up with you on my findings.

                  Comment


                    #10
                    Hello Andrew,

                    Thank you for your patience.

                    I was able to recreate this item with and without the CurrentCayOHL() code in your strategy.

                    I beleive the cause of the not responding is simply the amoun of data being request here.

                    Take a look at the following code:
                    Code:
                    if (Bars.BarsSinceSession < 300)
                    {fiveMinuteConcept = Bars.BarsSinceSession;}
                    else
                    {fiveMinuteConcept = 300;}
                    BarsSinceSession is being checked back to 300 bars for each instrument and period type in your strategy. This could likely be the cause of this item. However, we do not have the resources to debug users NinjaScript code. Please review the tips at the following link for debugging your NinjaScript code: http://www.ninjatrader.com/support/f...ead.php?t=3418

                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      Patrick:

                      in my normal everyday strategy (what I sent you was a toy for a simpler strategy) there is no 300 bar request. and adding the OHL calc creates the same instability and lack of responsiveness in that strategy as well.

                      This is my entire question: what is it about the OHL request that is causing this?

                      Comment


                        #12
                        Hello Andrew,

                        Thank you for your response.

                        I removed the CurrenDayOHL() code from your strategy that you sent me and it still sent NinjaTrader into a Not Responding mode.

                        Please review the tips at the following link for debugging your NinjaScript code: http://www.ninjatrader.com/support/f...ead.php?t=3418

                        Please let me know if I may be of further assistance.
                        Last edited by NinjaTrader_PatrickH; 02-07-2013, 02:43 PM.

                        Comment


                          #13
                          So basically the response is no response, and that is fine, but please allow me to clarify one issue:

                          What good would debugging the code do? There is no bug; it compiles, and with one stock alone, it works fine.

                          Wouldn't this be a case of "checking for the current 5 minute once per second is too taxing for:

                          -- 64 bit NinjaTrader and my technology setup, and also

                          -- 64 bit NinjaTrader and your technology setup ?

                          What would I be debugging exactly?

                          Comment


                            #14
                            Hello Andrew,

                            Thank you for your response.

                            There are no compile errors, but the code you provided causes NinjaTrader to go into a non-responsive mode for a few minutes while it loads the strategy. You need to determine the cause of this item.

                            As I mentioned the code still caused this item on my end, but you have mentioned if you remvoe the CurrentDayOHL() that it works properly on your end. Try to reduce the amount of period types and instruments added to your chart.

                            You can break apart your code into sections and test it section on it's own in different strategies or comment out certain sections or logic to try to determine the cause of this item.

                            Please let me know if I may be of further assistance.

                            Comment


                              #15
                              Originally posted by alabell View Post
                              So basically the response is no response, and that is fine, but please allow me to clarify one issue:

                              What good would debugging the code do? There is no bug; it compiles, and with one stock alone, it works fine.

                              Wouldn't this be a case of "checking for the current 5 minute once per second is too taxing for:

                              -- 64 bit NinjaTrader and my technology setup, and also

                              -- 64 bit NinjaTrader and your technology setup ?

                              What would I be debugging exactly?
                              Looking at the code of the indicator shows that on each BarUpdate, it is running 3 for loops over the entire length of the chart.

                              That means NT has to iterate through the domain to find the correct instance of the indicator, then run 3 for loops. If you are using COBC = false, then it must do this for every tick. (Remember the magic wrapper code that NT places at the bottom of the indicators, and warns you not to even glance at?) A nasty "fine how do you do" right there.

                              One way to reduce the load, especially if using COBC = false, is to use a named instance of the indicator class. That way, NT knows exactly which code location to call, without having to go look for it.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              16 responses
                              3,281 views
                              0 likes
                              Last Post Leafcutter  
                              Started by WHICKED, Today, 12:45 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by Tim-c, Today, 02:10 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Taddypole, Today, 02:47 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post Taddypole  
                              Started by chbruno, 04-24-2024, 04:10 PM
                              4 responses
                              53 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Working...
                              X