Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Month bars in strategy problem

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

    Month bars in strategy problem

    Hello,

    I need in my strategy several timeframes (monthly too).

    If Initialize includes "Add( PeriodType.Month, 1 );" doesn't run OnBarUpdate.

    If I block this line all is OK.

    Could you help?

    Thanks

    #2
    Hello ToLight,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    You would need a CurrentBars check for each bar series and would need to ensure that in the chart or the Strategy menu of the Strategies tab that the DaysToLoad provides each bar series enough bars to load for the required data.

    For information on CurrentBars please visit the following link: http://www.ninjatrader.com/support/h...urrentbars.htm
    Information on ensuring you have enough bars loaded can be found at the following link: http://www.ninjatrader.com/support/f...ead.php?t=3170

    Comment


      #3
      specifying

      Hello Patrick,

      I'm sorry I was too brief.

      In chart is this OK. Problem is in Strategy Analyzer. I now make some simple test strategy. Is as attachment.
      Strategy Analyzer setting:
      - ES ##-##
      - Daily, 1
      - from 1.1.2014 to 31.12.2014
      --------------
      protected override void Initialize()
      {
      Print( "TAM-Initialize" );
      CalculateOnBarClose = true;
      BarsRequired = 40;

      Add( PeriodType.Month, 1 );
      Add( PeriodType.Week, 1 );
      Add( PeriodType.Day, 1 );
      Add( PeriodType.Minute, 1 );
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      Print( "TAM-OnBarUdate" );
      }
      --------------
      During backtest is in output window only:
      TAM-Initialize
      TAM-Initialize
      No one TAM-OnBarUdate.

      If I block line Add( ....Month .. is in output window a lot of TAM-OnBarUdate.

      I have NT 7.0.1000.26.
      Attached Files
      Last edited by ToLight; 01-05-2015, 09:52 AM.

      Comment


        #4
        ToLight, you set BarsRequired here to 40 - this will apply to all series, so each series would need to have seen at least 40 bars (also the monthly) before OnBarUpdate() is then called. You very likely just load to less data to satisfy this requirement. Either load more data or use a lower BarsRequired please.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          1) Chart load all needed bars. Strategy Analyzer don't. Why?

          2) How can I compel Strategy Analyzer to load all needed bars?

          3) I use bars form one minute to one month. One parameter BarsRequired is not good.
          It should be better one parameter for every one Bars.

          Comment


            #6
            ToLight, thanks for the feedback - if you specify to just load / test over a year worth of data - the 40 monthly bars would very likely not be present then due to holidays / the non trading days. Would would need to expand the backtest range here, so setting an earlier startDate while connected to a feed that would be able to offer the backfill for historical data if needed.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Max238, Today, 01:28 AM
            1 response
            23 views
            0 likes
            Last Post CactusMan  
            Started by giulyko00, Yesterday, 12:03 PM
            2 responses
            10 views
            0 likes
            Last Post giulyko00  
            Started by r68cervera, Today, 05:29 AM
            0 responses
            4 views
            0 likes
            Last Post r68cervera  
            Started by geddyisodin, Today, 05:20 AM
            0 responses
            7 views
            0 likes
            Last Post geddyisodin  
            Started by JonesJoker, 04-22-2024, 12:23 PM
            6 responses
            38 views
            0 likes
            Last Post JonesJoker  
            Working...
            X