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 Tin34, Today, 03:30 AM
          2 responses
          18 views
          0 likes
          Last Post Tin34
          by Tin34
           
          Started by sastrades, Yesterday, 09:59 AM
          2 responses
          32 views
          0 likes
          Last Post brucerobinson  
          Started by ETFVoyageur, Today, 12:52 AM
          1 response
          16 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by lollers, Today, 03:26 AM
          0 responses
          12 views
          0 likes
          Last Post lollers
          by lollers
           
          Started by aliyahany, Today, 03:16 AM
          0 responses
          4 views
          0 likes
          Last Post aliyahany  
          Working...
          X