Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars required..multi-time frame

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

    Bars required..multi-time frame

    When Backtesting, if I have 5min chosen in the strategy analyzer window for the dataseries Value but in my script I have a condition that's looking at a Daily 7period simple moving average as far as 3days back, what should my minimum bars required be set to? Is it based off 5min bars or daily bars?

    If it's off 5min bars I'm calculating there is 78 - 5min bars/day x 9 days = 702 min bars required? But if I put this many bars required it comes up with 0 trades so there must be something wrong.

    #2
    Hello zachj,

    Your BarsRequired or Minimum bars is going to effect all of your Multiscripts in your Strategy/Indicator.

    So with that said, you may not want to use the BarsRequired or Minimum bars, but check each series manually to make sure you have enough data so that you can define one for each of them.

    For example:

    Code:
    protected override void OnBarUpdate()
    {
        // Checks to make sure we have at least 30 or more bars in the Primary Bars objects before continuing and 10 bars for the secondary series.
        if (CurrentBars[0] < 30 || CurrentBars[1] <  10)
            return;
     
        // Script logic calculation code...
    }
    JCNinjaTrader Customer Service

    Comment


      #3
      Ok so I will have a condition for..
      if (CurrentBars[0] >= 1 && CurrentBars[1] >= 9)

      And then for the min bars required there has to be a value in strategy analyzer, do I put in as zero or leave at default of 20 or does it matter?

      Comment


        #4
        Hello zachj,

        If you are using very small values like 1 and 9, you may want to change min bars required in the strategy analyzer to 0.
        JCNinjaTrader Customer Service

        Comment


          #5
          Set to 0 no trades come through, so I guess ill stick with 1. This whole bars thing seems dicey to me though, I don't trust it. I feel like it's throwing things off.

          Comment


            #6
            Hello zachj,

            Do you get trades to come through on min bars 1 but not 0? If so, do you see an error inside of the Log tab or the Output window?

            Happy to be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              Yes that is correct. I don't know if that 1 bar is for the 5min or Day period though in the strategy analyzer.

              And I'm not receiving any errors, that I can see at least, because I keep getting the maximum threshold of the output window reached message.

              Would the min bar effect any intraday calculations of trades that do take place or would it just simply stop trades from occurring until the min bars is reached? If I'm just missing a few trades because it's not ready yet I can deal with that but if anything further than that makes me nervous.

              Comment


                #8
                Hello zachj,

                My guess would be that there is an error that is causing your strategy not to calculate, but could you send me your log and trace files for today so that I may look into what occurred.

                You can do this by going to the Control Center-> Help-> Mail to Support.

                In the subject line put "ATTN: JC" and in the body reference this thread: http://www.ninjatrader.com/support/f...ad.php?t=62161
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Wait do you mean not calculating on the min bar of 0 setting? Because it does calculate if I set it to 1 bar, when I say calcuate I mean trigger trades.

                  Comment


                    #10
                    Hello zachj,

                    Correct, using min bar 0 most likely is producing an error which is why no trades are triggered, but having min bar set to 1 does not get this error which is why your strategy is producing trades.
                    JCNinjaTrader Customer Service

                    Comment


                      #11
                      I had the same trouble with one of my indicators and could not determine what results I needed to start calculating from, specially when computing larger time frames like say 80 minutes or more, and given the entry points were random each time.

                      My work around was a
                      try
                      {
                      <code>
                      }
                      catch
                      {}

                      This stopped it failed simply caught the exception and di nothing with it and continued on its merry way.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by DayTradingDEMON, Today, 09:28 AM
                      4 responses
                      21 views
                      0 likes
                      Last Post DayTradingDEMON  
                      Started by geddyisodin, Yesterday, 05:20 AM
                      9 responses
                      50 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by George21, Today, 10:07 AM
                      1 response
                      11 views
                      0 likes
                      Last Post NinjaTrader_ChristopherJ  
                      Started by Stanfillirenfro, Today, 07:23 AM
                      9 responses
                      24 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by navyguy06, Today, 09:28 AM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Working...
                      X