Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator does not plot with if statement

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

    Indicator does not plot with if statement

    Building an indicator the indicator does sometimes not plot. To me it's unclear why. Below code for example does not plot. if I comment out the if line it does plot. Anyone an explanation for this?


    protected override void OnBarUpdate()
    {
    BullDiv[0] = 0;
    for (int i = MinPeriod; i <= MaxPeriod; i++)
    {
    if (Low[0] > Low[i])
    {
    BullDiv[0] = i;
    }
    }
    }

    #2
    Originally posted by Silent View Post
    Building an indicator the indicator does sometimes not plot. To me it's unclear why. Below code for example does not plot. if I comment out the if line it does plot. Anyone an explanation for this?


    protected override void OnBarUpdate()
    {
    BullDiv[0] = 0;
    for (int i = MinPeriod; i <= MaxPeriod; i++)
    {
    if (Low[0] > Low[i])
    {
    BullDiv[0] = i;
    }
    }
    }
    The first place to look is in your log, for logged errors. In your case, it is because that line is trying to access bars that do not yet exist at the time.

    cf: http://ninjatrader.com/support/forum...03&postcount=7

    ref: https://www.google.com/search?q="You...injatrader.com

    Comment


      #3
      Where do I find the log with logged errors? I don't really see it in the gui helpfiles and googling result in a lot of references to a log or login rather then locating the log.

      If I read the linked material that sounds logical and does fix the issue. Thanks!

      Comment


        #4
        Originally posted by Silent View Post
        Where do I find the log with logged errors? I don't really see it in the gui helpfiles and googling result in a lot of references to a log or login rather then locating the log.

        If I read the linked material that sounds logical and does fix the issue. Thanks!
        NinjaTrader Control Center, your main window that opens first, has a tab called "Log".

        It is positively detailed in the NT Help file.

        ref: http://ninjatrader.com/support/helpG...7/log_tab2.htm

        Comment


          #5
          Thanks again!

          The info indeed is there...

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 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
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X