Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 burtoninlondon, Today, 12:38 AM
          0 responses
          5 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          14 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          13 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,983 views
          3 likes
          Last Post jhudas88  
          Working...
          X