Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Minimum 3 bars...

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

    Minimum 3 bars...

    Hello to all,

    This code does not work.

    Where am I wrong?

    Hello,
    Vy61
    Attached Files

    #2
    Hello Vy61cm,

    Thank you for your post and welcome to the Forums!

    You will need to add a CurrentBar check in the beginning the OnBarUpdate() to ensure that enough data has been loaded for the script to check for its calculations. The reason for this is because you are checking back 2 bars ago for Low. When the script starts it will be with the first bar and since there is no data to request for 2 bars ago it will not work.

    Code:
    if(CurrentBar < 2)
    return;
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Cal,

      Just one thing.
      How do I plot, not on the Bar[0] but on Bar[1]?

      Thank you,
      VY
      Attached Files

      Comment


        #4
        vy61cm,

        Just out of curiosity, why would you want to plot this one bar ago? The signal would have happened on that bar and then plotted there.

        You can do this by changing your .Set() to this

        Code:
        Plotto1.Set(1,1);
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Cal,

          It 's the first time I write code for NT7. It 'an exercise to see how it works. They are basic building blocks.

          I'm interested to see graphically the object at that point. But it may be useful for other things.

          Thank you,
          VY

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X