Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to tell if indicator has a value or is empty

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

    how to tell if indicator has a value or is empty

    Hi there. When I'm using an indicator that has two bins, such as AO with it's positive and negative, how do I reference the following idea:

    when the AO(Positive) bin has a value, *do this*

    when the AO(Negative) bin has a value, *do that*

    I seem to remember coming across a NT script command to accomplish this for me, but I can't find it now. Any ideas?

    thanks,
    Dwayne

    #2
    You want to call the individual plots separately.

    So for instance let us pretend the plot names are A and B.

    Code:
    if (AO(some parameters).A[0] > someValue)
         // Do something;
    
    if (AO(some parameters).B[0] > someOtherValue)
         // Do something else;
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,
      Thanks for the reply. Here is what I have now:

      if (AO().AOPos[0] >= AO().AONeg[0])...do something.

      But this isn't quit it. AOPos and AONeg can either:

      1. have some value
      2. be empty and not contain any value at all

      I want to reference the condition where AO().AOPos[0] is not empty (condition #1). It can be any value. I simply want to know if it has a number in there.

      Reason being, if I am in a short position, AO().AONeg will have values. At some point, when the Falling() condition reverses, AO().AOPos[0] will get a value, even though it may be a negative value at first.

      How do I test for the condition "when AOPos gets a value"....?

      Comment


        #4
        You have 3 plots. AOPos, AONeg, and AOValue. AOValue being a whole series with both pos and neg values. You can just compare AOPos against AOValue and AONeg against AOValue. Whichever one has the match is the one that has the value set.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Bingo! Thanks very much for the insight. Works perfectly.

          Enjoy your holidays,
          D

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          87 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          131 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          106 views
          0 likes
          Last Post CarlTrading  
          Working...
          X