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 check for "TRUE" condition (for an indicator)?

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

    How to check for "TRUE" condition (for an indicator)?

    I have a RSi divergence indicator I would like to incorporate in my strategy/Alert. How do I check if RSI divergence is"True''?

    For example:
    If there is RSI Divergence (i.e. Divergence = True) >> Do the following... and Alert.

    See attached screenshot for the options available.

    Some trading platform i have used in the past like ThinkorSwim have the option to check for True or False condition for an indicator.

    Assuming, I can check for TRUE conditions. Is it possible to check for TRUE condition within the last X bars (example10 bars)?
    Attached Files
    Last edited by cryfgg; 09-07-2021, 08:08 PM.

    #2
    Misc True
    Attached Files

    Comment


      #3
      Hello cryfgg,

      Thanks for your post.

      As this is a third party script, I cannot say what exactly it outputs. You would want to understand the output of the indicator to create logic with it. Checking a boolean value from an Indicator output as JMont1 mentions would be irregular, so I may suggest the following:

      Alerts and strategies can read plots from indicators, and you can test reading the output of an indicator by creating a print with that indicator using the Strategy Builder.

      I.E. You can create a strategy where it only adds an action for Misc > Print that prints the value of the indicator as you have it set up. You can then apply the strategy to a chart with the NinjaScript Output window open, and you can see the values that come out of the indicator to see how you can build logic with it in an Alert or Strategy.

      If you do not see meaningful values, you may wish to consult the developer of that indicator to ask if it can be used with Alerts and Strategies and to ask for an example condition.

      For additional reference, I have included our Conditions Examples from the Help Guide:



      We look forward to assisting.
      Last edited by NinjaTrader_Jim; 09-08-2021, 06:40 AM.
      JimNinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Jim View Post
        Hello cryfgg,

        Thanks for your post.

        As this is a third party script, I cannot say what exactly it outputs. You would want to understand the output of the indicator to create logic with it. Checking a boolean value from an Indicator output as JMont1 mentions would be irregular, so I may suggest the following:

        Alerts and strategies can read plots from indicators, and you can test reading the output of an indicator by creating a print with that indicator using the Strategy Builder.

        I.E. You can create a strategy where it only adds an action for Misc > Print that prints the value of the indicator as you have it set up. You can then apply the strategy to a chart with the NinjaScript Output window open, and you can see the values that come out of the indicator to see how you can build logic with it in an Alert or Strategy.

        If you do not see meaningful values, you may wish to consult the developer of that indicator to ask if it can be used with Alerts and Strategies and to ask for an example condition.

        For additional reference, I have included our Conditions Examples from the Help Guide:



        We look forward to assisting.


        I can't find the option to print the indicator output (Misc). See screenshot below. "JMont1" suggestion above didn't work (you were right about that).

        Attached Files

        Comment


          #5
          Hello cryfgg,

          You are looking at the Condition Builder. To make a print, please create a new Action, and then navigate to Misc > Print.
          JimNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Jim View Post
            Hello cryfgg,

            You are looking at the Condition Builder. To make a print, please create a new Action, and then navigate to Misc > Print.
            How do I use Print() to print the value of the indicator? See my screenshots.
            Attached Files

            Comment


              #7
              Hello cryfgg,

              Similar to setting the Y value in Draw.ArrowDown, you would click the set button within the Message Text Box of the Print. From there we will be met with a String Builder, which we can click the set button within a string to select values to be displayed in that string.
              Attached Files
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Waxavi, Today, 02:10 AM
              0 responses
              5 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              11 views
              0 likes
              Last Post TradeForge  
              Started by Waxavi, Today, 02:00 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by elirion, Today, 01:36 AM
              0 responses
              4 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by gentlebenthebear, Today, 01:30 AM
              0 responses
              5 views
              0 likes
              Last Post gentlebenthebear  
              Working...
              X