Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Loading lots of bars without going overboard

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

    Loading lots of bars without going overboard

    Hi, I have a strategy that uses 4 timeframes:

    0: 1-minute
    1: 1-day
    2: 1-minute for symbol DIA
    3: 3-minute

    I need the following number of bars for this strategy:

    0: 31
    1: 11
    2: 31
    3: 21

    So, until now I have just enabled the strategy using Days To Load set to 20. That's completely overkill and loads about 4000+ minute bars and 1000+ 3-minute bars, and, oddly enough, only 12-14 days, which has been good enough. It's not trying to load Saturdays and Sundays, is it?

    Anyway, I want to now add a 200-day moving average to the strategy but I don't want to load 200 days' worth of 1-minute and 3-minute bars. It already takes about 3 minutes to enable the strategy for 100 symbols and I don't want to increase that to 30 minutes.

    How can I get the strategy to load 200 days of daily bars but only a reasonable number of 1-minute and 3-minute bars?

    #2
    egan857, the bars back mode would go by Calendar days and not trading days so the difference you see would be the weekends.

    Unfortuntately the strategy loading bars behavior would be dictated by the primary series you run on and further the script's OnBarUpdate() would only be called if the BarsRequried are satisfied for all series used - we have an enhanced Add() method that would let you specify the bars loaded amount on our feedback list for future consideration.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      I'm not completely sure I understood the last comment. Are you saying that a future release will have the ability to define 200 daily like this: "Add(PeriodType, Day, 1, 200);" ? If so, that's a very nice solution.

      I can't be the only person who looks at 200-day moving averages. Is there a way to just make an indicator for that common average? It would keep me (and others) from adding many unnecessary bars. If a 200MA indicator requires me to load up 200 daily bars, then it's not worth the effort to build the indicator.

      Comment


        #4
        Originally posted by egan857 View Post
        Hi Bertrand,

        I'm not completely sure I understood the last comment. Are you saying that a future release will have the ability to define 200 daily like this: "Add(PeriodType, Day, 1, 200);" ? If so, that's a very nice solution.
        [BW] : Correct offering an enhanced overload for the Add() is on our suggestion list for future consideration.

        I can't be the only person who looks at 200-day moving averages. Is there a way to just make an indicator for that common average? It would keep me (and others) from adding many unnecessary bars. If a 200MA indicator requires me to load up 200 daily bars, then it's not worth the effort to build the indicator.
        [BW] : You could create a MultiSeries indicator to build that 200 day MA for you, yes, but this indicator as well would need to load enough bars for all series to calculate the MA then, so you're looking at the same limitation then.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hey, sorry for seeming impatient, but what's the status on getting an enhanced overload to Add()?

          On a more generic note, is there some way we can find out what features are being considered for future releases and rough time estimates for those future releases? For that matter, a list of past releases and their features would be helpful. I'm currently running release 7.0.1000.10, and I don't even know if that's the most recent release available.

          Thanks, and you guys are going a great job. NT works like a charm.

          Comment


            #6
            Originally posted by egan857 View Post
            .... It would keep me (and others) from adding many unnecessary bars. If a 200MA indicator requires me to load up 200 daily bars, then it's not worth the effort to build the indicator.
            Some things are impossible in an absolute sense. If you have a calculation that REQUIRES 200 data points, then you must use 200 data points for accuracy. Now, the EMA on the other hand, requires just 2 data points to calculate the next, so ...

            Comment


              #7
              Originally posted by egan857 View Post
              I can't be the only person who looks at 200-day moving averages. Is there a way to just make an indicator for that common average?
              Probably. Can you come close on a weekly avg?

              Comment


                #8
                Hi Koganam,

                OK, we'll see if that works. I just added "MA200 = EMA(Closes[3],200)[0];" and that might just do the trick. Won't know for a couple of days because the market's closed tomorrow. Thanks!

                BTW, I know you help everybody out, but maybe you'll remember that I had some memory problems a few months ago. One of the issues was using indicators like MIN and MAX in my strategy code because they just didn't release the space. I expect that even if EMA does work, it will have a similar memory issue. My earlier solution was to just remove references to MIN and MAX. This time the solution would probably be to edit the EMA function and add an OnTermination section to release the memory. I don't really use indicators much, so if you have any words of wisdom on releasing memory in an indicator that's called from a strategy, I'm all ears.

                Comment


                  #9
                  Hi Sledge,

                  Yes, I've found that 50-week moving averages are usually close enough to 200-day moving averages. I don't need precision, just a good guesstimate. Do you have a recommendation other than EMA?

                  Comment


                    #10
                    Originally posted by egan857 View Post
                    Hi Koganam,

                    OK, we'll see if that works. I just added "MA200 = EMA(Closes[3],200)[0];" and that might just do the trick. Won't know for a couple of days because the market's closed tomorrow. Thanks!

                    BTW, I know you help everybody out, but maybe you'll remember that I had some memory problems a few months ago. One of the issues was using indicators like MIN and MAX in my strategy code because they just didn't release the space. I expect that even if EMA does work, it will have a similar memory issue. My earlier solution was to just remove references to MIN and MAX. This time the solution would probably be to edit the EMA function and add an OnTermination section to release the memory. I don't really use indicators much, so if you have any words of wisdom on releasing memory in an indicator that's called from a strategy, I'm all ears.
                    You can always use the OnTermination() event handler to explicitly dispose of the indicator.
                    Code:
                    IndicatorInstance.Dispose();
                    Last edited by koganam; 01-02-2013, 09:02 AM.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by ghoul, Today, 06:02 PM
                    3 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    44 views
                    0 likes
                    Last Post jeronymite  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    7 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    10 responses
                    180 views
                    0 likes
                    Last Post jeronymite  
                    Started by DanielSanMartin, Yesterday, 02:37 PM
                    2 responses
                    13 views
                    0 likes
                    Last Post DanielSanMartin  
                    Working...
                    X