Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conditions regarding n/a Plot Results

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

    Conditions regarding n/a Plot Results

    I would think this has been ask before, however I cannot find by searching.

    When Using an indicator with plots that sometimes in the data box display "n/a" and other times a value

    Is there a way to create a condition that is aware of that n/a value

    Also I have tried with a plot that when NOT in the n/a State to use a condition that state the (Plot > -100) when a plot is a range of -100 to +100 to attempt to see something other that n/a is currently being plotted, but it is not accurate
    Last edited by DTSSTS; 06-08-2022, 07:03 AM.

    #2
    Hello DTSSTS,

    the N/A value generally means a plot value was not set for that bar, if that is the situation for that indicator then you should be able to use IsValidDataPoint to know the N/A bars.



    If the value is a very small or very large number that becomes notational then you would also see that, only for this case would a condition checking greater/lesser would work to find the N/A.

    For this type of indicator you generally would need to Print the value or IsValidDataPoint from NinjaScript to see if values are being set. Based on that observation you would know which solution to use.


    Comment


      #3
      in this case "If the value is a very small or very large number that becomes notational then you would also see that, only for this case would a condition checking greater/lesser would work to find the N/A."

      Means the value is NOT N/A?

      if correct and I am looking for condition (Plot > -100) and this is true, why would I get incorrect results

      Comment


        #4
        Hello DTSSTS,

        You would need to print out the indicator values to know more about it and how that specific indicator works. N/A just means the UI cant display that value for a variety of reasons.

        To know how to deal with that indicator and the values it plots you need to check it using a Print or IsValidDataPoint so you see the unformatted value.

        If the indicator is just not plotting a value on some bars that's the best case scenario because you can just use the valid data point method to find those bars.




        Comment


          #5
          Example

          protected override void OnBarUpdate()
          {
          // only set plot value if hosted indicator is not reset
          if(SMA(20).IsValidDataPoint(0))
          MyPlot[0] = SMA(20)[0];
          }

          IS THERE A WAY TO SEE IF "TRUE" OR "FALSE" as a condition


          && (SMA(20).IsValidDataPoint(0) == true)


          Thanks for the help

          Comment


            #6
            Hello DTSSTS,

            You can use IsValidDataPoint just like you did for any series, its a method that returns a bool which is true/false.

            You can use also a Print like the following to observe what the indicators values are:

            Code:
            Print(CurrentBar + " " + SMA(20)[0] + " " + SMA(20).IsValidDataPoint(0));




            Comment


              #7
              OK to confirm I am testing with the LBR310 Indicator, below is on of the plots that varies between a value or N/A

              NOT sure I have the syntax correct

              LBR310P <--- the Indicator

              HPLineUp[0] <--- the selected Plot we are interested in < --- Do I need the [0] here

              IsValidDataPoint(0) == true)

              if I use

              && (LBR310P.HPLineUp[0].IsValidDataPoint(0) == true)

              true will mean it has a value

              and if I use

              && (LBR310P.HPLineUp[0].IsValidDataPoint(0) == false)

              that should indicate I have a state of N/A


              Thanks again

              Comment


                #8
                Hello DTSSTS,

                With the code HPLineUp[0] you are getting a value from a series by using [0], to work with the series directly you just use the variable HPLineUp.

                Your other assumptions are correct in how you would compare it however you need to remove the [0] from that code.

                LBR310P.HPLineUp.IsValidDataPoint(0) == true

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                630 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                566 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X