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

Load only limited amount of data via setting in strategy?

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

    Load only limited amount of data via setting in strategy?

    Hey guys - I have a strategy that uses 360-min and daily bars for price patterns. However for the EXECUTION I'm also loading single tick data as series 1. That's the one on which I execute after which a price pattern on the big candles materializes.

    Now I have my strategy coded in a fashion that loads the tick data automatically and if I load a month of daily bars for instance then I also need to load a month of tick data. It's nice to see all the price patterns of the past months but I don't need to see all EXECUTIONS. For instance only seeing the executions in the last week or so would be in many cases sufficient.

    So here's the key question - is there a way to only load one week of tick data programmatically (I know you can do it on equi-distant charts) in a strategy running for instance on a 1-month chart of daily bars? I hope this makes sense.

    Thanks in advance

    #2
    Hi molecool, it makes sense and is already on our feedback list in product management for consideration for our next major platform update, but currently the amout of data loaded would be determined solely by the primary series in your script, so you could not custom tally per series.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by molecool View Post
      Hey guys - I have a strategy that uses 360-min and daily bars for price patterns. However for the EXECUTION I'm also loading single tick data as series 1. That's the one on which I execute after which a price pattern on the big candles materializes.

      Now I have my strategy coded in a fashion that loads the tick data automatically and if I load a month of daily bars for instance then I also need to load a month of tick data. It's nice to see all the price patterns of the past months but I don't need to see all EXECUTIONS. For instance only seeing the executions in the last week or so would be in many cases sufficient.

      So here's the key question - is there a way to only load one week of tick data programmatically (I know you can do it on equi-distant charts) in a strategy running for instance on a 1-month chart of daily bars? I hope this makes sense.

      Thanks in advance
      Code:
      BarsArray[1].BarsData.DaysBack = 5;

      Comment


        #4
        Originally posted by koganam View Post
        Code:
        BarsArray[1].BarsData.DaysBack = 5;

        Comment


          #5
          Actually it doesn't seem to make a difference. A particular place I should put that?

          Comment


            #6
            Originally posted by molecool View Post
            Actually it doesn't seem to make a difference. A particular place I should put that?
            If I remember right, that only sets that parameter. Cross-check by loading onto a chart. You then have to refresh the chart. You may have to use the kludgy SendKeys.SendWait to send F5 to relaod the chart, or maybe just send a Ctrl+Shift+R ?

            Comment


              #7
              Originally posted by koganam View Post
              If I remember right, that only sets that parameter. Cross-check by loading onto a chart. You then have to refresh the chart. You may have to use the kludgy SendKeys.SendWait to send F5 to relaod the chart, or maybe just send a Ctrl+Shift+R ?
              Nope - didn't do anything. It seemed to load all the tick data on the chart although I only set it to 1 day.

              Comment


                #8
                Originally posted by molecool View Post
                Nope - didn't do anything. It seemed to load all the tick data on the chart although I only set it to 1 day.
                Doing preMarket work now. I will take another look after market close.

                Comment


                  #9
                  Originally posted by koganam View Post
                  Doing preMarket work now. I will take another look after market close.
                  Koganam - have you ever had a chance to test this one again? I am still trying to limit the amount of tick data my strategy loads. I want to use it in the context of this line in my BarUpdate() method:

                  Code:
                  if (CurrentBar < ((CalculateOnBarClose ? Count - 2 : Count - 1) - ExecutionBars)) return;
                  This basically sets my range of executions to however long I want to execute historically, irrespective of the amount of chart data. This way I can load a 360 bar chart depending on a long ass SMA without having to waste cycles/time on executing hundreds of back trades. This works just peachy but if I could now set the amount of TICKS (which is the series I execute on) then I'd be super happy.

                  By the way - when I attempt to set your code in the Initialize method I get this:

                  6/30/2013 12:40:23 PM Strategy Failed to call method 'Initialize' for strategy 'MyStrategy/b7256e97965c4150848004a7d9568f9f': 'BarsArray' property can't be accessed from within 'Initialize' method
                  And when I put it anywhere else it gets ignored. I even created a StartUp() method and it's in there but more than a day of tick data (my setting) is currently being loaded. Frustrating...

                  Thanks in advance...
                  Last edited by molecool; 06-30-2013, 10:49 AM.

                  Comment


                    #10
                    Originally posted by molecool View Post
                    Koganam - have you ever had a chance to test this one again? I am still trying to limit the amount of tick data my strategy loads. I want to use it in the context of this line in my BarUpdate() method:

                    Code:
                    if (CurrentBar < ((CalculateOnBarClose ? Count - 2 : Count - 1) - ExecutionBars)) return;
                    This basically sets my range of executions to however long I want to execute historically, irrespective of the amount of chart data. This way I can load a 360 bar chart depending on a long ass SMA without having to waste cycles/time on executing hundreds of back trades. This works just peachy but if I could now set the amount of TICKS (which is the series I execute on) then I'd be super happy.

                    By the way - when I attempt to set your code in the Initialize method I get this:



                    And when I put it anywhere else it gets ignored.

                    Thanks in advance...
                    Molecool, I have been rather a bit tied up lately, and have not taken more than a cursory glance at this. It seems that what I wrote only sets the number. One then has to reload the chart to actually get the data. Sounds like using SendKeys.Sendwait so send a reload command may be required.

                    That having been said, when I look at the command that you have shown, it looks like it does what you want in a more elegant and controlled manner, as you can load any number of bars, but control Historical execution directly using the ExecutionBars, no? It would seem to me that you merely need to tie the command to the BarSeries on which you want to work.
                    Code:
                    if (CurrentBars[1] < ((CalculateOnBarClose ? BarsArray[1].Count - 2 : BarsArray[1].Count - 1) - ExecutionBars)) return;
                    Would you mind testing that?

                    Comment


                      #11
                      Originally posted by koganam View Post
                      Molecool, I have been rather a bit tied up lately, and have not taken more than a cursory glance at this. It seems that what I wrote only sets the number. One then has to reload the chart to actually get the data. Sounds like using SendKeys.Sendwait so send a reload command may be required.

                      That having been said, when I look at the command that you have shown, it looks like it does what you want in a more elegant and controlled manner, as you can load any number of bars, but control Historical execution directly using the ExecutionBars, no? It would seem to me that you merely need to tie the command to the BarSeries on which you want to work.
                      Code:
                      if (CurrentBars[1] < ((CalculateOnBarClose ? BarsArray[1].Count - 2 : BarsArray[1].Count - 1) - ExecutionBars)) return;
                      Would you mind testing that?
                      Thank you for the kind words but that line only limits my executions - which isn't a bad approach. But my strategy is going to run on a 360 minute chart and relies on an SMA that requires it to load a minimum of 200 bars. So you do the math - that's a truckload of TICK data that's being pulled, most of which I don't use.

                      So this is why I want to limit the amount of ticks that are being pulled down. FYI - my CHART does not show any tick data - it's only used under the hood in my strategy. I have pulled several FX contracts which I have not tested recently (thus nothing has been buffered) and it's clearly loading all the tick data. Frustrating... if there's anything you can think of that may work please let me know.

                      FYI - the code you suggest would be difficult to implement as the ExecutionBars property would be an unknown for a tick series. In other words you never know how many ticks you'll get in an hour, so you cannot set that property reliably (i.e. translate it into minutes).
                      Last edited by molecool; 06-30-2013, 11:18 AM.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by StockTrader88, 03-06-2021, 08:58 AM
                      45 responses
                      3,992 views
                      3 likes
                      Last Post johntraderuser2  
                      Started by TAJTrades, Today, 09:46 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post TAJTrades  
                      Started by rhyminkevin, Yesterday, 04:58 PM
                      5 responses
                      62 views
                      0 likes
                      Last Post dp8282
                      by dp8282
                       
                      Started by realblubb, Today, 09:28 AM
                      0 responses
                      8 views
                      0 likes
                      Last Post realblubb  
                      Started by AaronKoRn, Yesterday, 09:49 PM
                      1 response
                      19 views
                      0 likes
                      Last Post Rikazkhan007  
                      Working...
                      X