Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBar and BarsRequiredToTrade

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

    CurrentBar and BarsRequiredToTrade

    Hi, I had a strange issue today
    I have a strategy running which has BarsRequiredToTrade set to 50. I have this Strategy running from the Control Center and not from the Chart. The TimeFrame is Daily and Calculate set to OnPriceChange. Though the condition to go Long/Short was satisfied, the Strategy was not triggering the trades. Analysing it, I noticed that CurrentBar of the Daily Candle is 35 so obviously the strategy was not going past if( CurrentBar < BarsRequiredToTrade) return; condition(First line of the strategy). So would like to know why was CurrentBar not going past 35 ? If I manually load up a chart , I can load more than 100 Historical Bars.


    Thanking you,
    SurenForex



    #2
    Hello SurenForex,

    Thanks for your post.

    After replying to your post I will be moving this thread to the NinjaTrader8 strategy Forum.

    If I understand correctly you directly installed the strategy in the Strategies tab of the NinjaTrader8 Control center. When you install the strategy in this manner, you need to specify not just the bar type (day) but also the "Days to load". Please check the parameter Days to load and adjust if/as needed.

    When you add a strategy to the chart, the strategy adopts the chart's primary series so you do not have to set that when applying to a chart that already has data.



    Comment


      #3
      Sorry could not get back to you on this. After your feedback, I set the Days to Load to 100 but still the CurrentBar count stops at 35 and that is the reason it doesn't go past the CurrentBar < BarsRequiredToTrade condition. I have tried to enable the strategy from the chart and it works without any issues since its able to load more than 100 Bars on the Chart.

      So not able to figure out what is the issue running it from the Control Center . Need your help.

      Comment


        #4
        Hello SurenForex,

        Thanks for your reply, no worries.

        I would add a print statement that is just above your current bars check to print out the date-time of the bar along with the current bar number: Print (Time[0] + "CurrentBar = "+CurrentBar);

        Placing it above the current bar check should show all of the bars that the script has access to.

        Comment


          #5
          Thank you for your response. I exactly did what you have suggested when I mentioned the count stops at 35. The good news is I increased the Days To Load from 100 to 500 and it auto magically started working.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          65 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X