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 sjsj2732, 03-23-2026, 04:31 AM
          0 responses
          78 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          313 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          315 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          149 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          115 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X