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

referencing an indicator in an indicator

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

    referencing an indicator in an indicator

    Does anyone know how to reference an indicator in a different indicator. For example suppose I have an oscillator indicator "A" that is rising and falling above and below the zero line.

    I would like to reference that indicators value on each bar in indicator "B" and if it is above zero I want it to do xyz and if below zero I want it to do abc.

    Indicator "B": if (Close[0] of Indicator "A" > 0 then ... xyz) else abc


    Any thoughts on this.

    Thanks

    #2
    You can reference any indicator in any other indicator. For examples please check out the Help Guide. Search up any indicator for the syntax. Search for maybe SMA or EMA or RSI. They will show you what to type to use them.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      I searched under help and did not find anything of value. Could you give me a little more guidance.

      thanks.

      Comment


        #4


        Here is the link for SMA. There is an example of how you can use it in coding. This is available in both NinjaScript Indicators and NinjaScript Strategies.

        To fit along with your pseudocode would be something like the following:
        Code:
        if (Close[0] > SMA(20)[0])
        {
             // Do something;
        }
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I understand what you are saying. However, MyCustom Indicator has 10 different Plot values and I am trying to reference one of the plot values in a different indicator.

          How do I do that without recreating the indicator?

          thanks

          Comment


            #6
            When you created the plots you gave it a name. You access the plots by their names.

            Take a look at the MACD indicator. It has several plots and you can see how it is accessed via the example in the Help Guide. http://www.ninjatrader-support.com/H...deV6/MACD.html

            Notice the Avg and Diff plots being accessed.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Just looking at this thread, I think the question was this:

              If there are two indicators, one in panel 2 and the other in panel 3, how would they interact? Is it possible?
              eDanny
              NinjaTrader Ecosystem Vendor - Integrity Traders

              Comment


                #8
                Indicators interact however you program them to interact. You don't need them in any panel for them to interact. When you code if you wanted your Moving Average indicator to interact with the MACD indicator you would just call the MACD indicator in the MA indicator itself. You would reference whichever plot you are interested in for whatever calculation you are trying to run.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by f.saeidi, Today, 12:14 PM
                7 responses
                16 views
                0 likes
                Last Post f.saeidi  
                Started by Russ Moreland, Today, 12:54 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by philmg, Today, 12:55 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by TradeForge, 04-19-2024, 02:09 AM
                2 responses
                32 views
                0 likes
                Last Post TradeForge  
                Started by aprilfool, 12-03-2022, 03:01 PM
                3 responses
                329 views
                0 likes
                Last Post NinjaTrader_Adrian  
                Working...
                X