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

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.


    JesseNinjaTrader Customer Service

    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.




        JesseNinjaTrader Customer Service

        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));




            JesseNinjaTrader Customer Service

            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
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by memonic, Yesterday, 01:23 PM
                2 responses
                11 views
                0 likes
                Last Post memonic
                by memonic
                 
                Started by merc410, Today, 03:41 AM
                2 responses
                9 views
                0 likes
                Last Post merc410
                by merc410
                 
                Started by sugalt, 04-30-2024, 04:02 AM
                2 responses
                13 views
                0 likes
                Last Post sugalt
                by sugalt
                 
                Started by Ndakotan1313, 03-14-2024, 05:02 PM
                2 responses
                61 views
                0 likes
                Last Post blaise_code  
                Started by claxxical, 05-30-2017, 12:30 PM
                37 responses
                4,461 views
                0 likes
                Last Post Padan
                by Padan
                 
                Working...
                X