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

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 AaronKoRn, Today, 09:49 PM
          0 responses
          5 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          8 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          9 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,975 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X