Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compiles but doesn't show when applied...

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

    Compiles but doesn't show when applied...

    I have added a simple line for testing purposes to an indicator that was working just fine.

    DrawText("tester" + CurrentBar, "here" + Low[1], 0, Low[0]-(High[0] - Low[0])*.5, Color.Blue);

    This should simply write "here" and the low of 1 bar ago under the current low.

    It works perfectly fine when it's Low[0], but for some reason when it's Low[1], it compiles, but when applied it not only doesn't show, but the rest of the indicator doesn't show either. I'm sure I'm missing something simple, but if someone could tell me what that something simple is, I would appreciate it very much.

    Thanks.

    #2
    8DTK8, I actually answered this very same question just a few hours ago, so this is a copy + paste - please add this line to the very beginning of your OnBarUpdate() section:
    Code:
    protected override void OnBarUpdate()
    {
            if (CurrentBar < 2)
                   return;
        
             // all your other code goes here
    }
    I believe you are running into an issue where there actually aren't enough bars on the chart, and if so, there should be an error in the logs (right-most tab of Control Center) about accessing an invalid index.
    Last edited by NinjaTrader_Austin; 08-26-2010, 04:54 PM.
    AustinNinjaTrader Customer Service

    Comment


      #3
      I knew it was something simple.
      Sorry about that. If you changed your "hours" to "days", it very well could have been the same problem I was having elsewhere that was resolved in the forum using the same solution.

      Thank you again.

      Comment


        #4
        Not a problem, 8DTK8. We run into this "error" all the time. There is actually a little tip page that goes over when this code is necessary.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Not to nitpick, but on the off chance that this is someones first encounter with this, it should be:

          if (CurrentBar < 2) NOT if (CurrentBar > 2)

          where 2 can be replaced by as many bars back as needed for the calculations.

          Comment


            #6
            Thank you for pointing that out - not sure how that crept in. I've corrected my post.
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            581 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            338 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X