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

One indicator as an input for another indicator.

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

    One indicator as an input for another indicator.

    Hi Guys,

    i want to try a combination of indicators,when i want to use one indicator as an input for another indicator.Now,how do i get next this combination into a strategy?

    Thank you!

    #2
    Hello outsource,

    Thanks for your post.

    You would code the in the strategy in the same way as you would for a single indicator.

    For example if you need a 20 period SMA of the input dataseries in the strategy you would write something like:

    if (SMA(20)[0] > something) // This is the SMA 20 of price

    If you wanted the 20 period SMA of volume, you would use the VOL as the input series, like this:

    if (SMA(VOL(), 20)[0] > something) // this is the SMA 20 of Volume

    Another example, getting the 20 period SMA of a 14 period ATR (no idea why but just to show example)

    if (SMA (ATR(14), 20)[0] > something) // this is the SMA 20 of ATR(14)

    You can code this directly in NinjaScript and/or the strategy wizard.

    Please let me know if I can be of further assistance.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello outsource,

      Thanks for your post.

      You would code the in the strategy in the same way as you would for a single indicator.

      For example if you need a 20 period SMA of the input dataseries in the strategy you would write something like:

      if (SMA(20)[0] > something) // This is the SMA 20 of price

      If you wanted the 20 period SMA of volume, you would use the VOL as the input series, like this:

      if (SMA(VOL(), 20)[0] > something) // this is the SMA 20 of Volume

      Another example, getting the 20 period SMA of a 14 period ATR (no idea why but just to show example)

      if (SMA (ATR(14), 20)[0] > something) // this is the SMA 20 of ATR(14)

      You can code this directly in NinjaScript and/or the strategy wizard.

      Please let me know if I can be of further assistance.

      Hi Paul,

      What about if one of the indie exposed as Boolseries and another uses Values DataSeries.

      Example:

      Indicator A exposed as (this.Values[1][0]);
      Indicator B exposed as (this.supadupa.BuyLow[0] == true)

      Indicator A - is an input for B

      How`d i connect them in a strategy?

      Comment


        #4
        Hello outsource,

        Thanks for your reply.

        Using your example:

        IndicatorB(IndicatorA).BuyLow[0]

        In the strategy you could write:

        if (IndicatorB(IndicatorA).BuyLow[0] == true)
        {
        // do something
        }
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          Hello outsource,

          Thanks for your reply.

          Using your example:

          IndicatorB(IndicatorA).BuyLow[0]

          In the strategy you could write:

          if (IndicatorB(IndicatorA).BuyLow[0] == true)
          {
          // do something
          }

          I try this,it doesn`t work.

          Comment


            #6
            Hello outsource,

            Thanks for your reply.

            To investigate then:

            Does it compile without error? If so when you implement the strategy is any error generated in the "Log" tab of the control center?

            If no evidence of external errors then does that mean that the logic does not work? If it is a logic error have you tested the conditions?
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Paul View Post
              Hello outsource,

              Thanks for your reply.

              To investigate then:

              Does it compile without error? If so when you implement the strategy is any error generated in the "Log" tab of the control center?

              If no evidence of external errors then does that mean that the logic does not work? If it is a logic error have you tested the conditions?
              No,it doesn`t compile without errors,

              the error is:

              "Non-invocable member Ninjatrader.Indicator.''B'' cannot be used as method''.

              Comment


                #8
                The rest - the logic and conditions are fine.I can compile(A and B) and use them separately.

                Here is how i try it:

                1)this.pssc(this.mcd.Values[1][0]).DownTrend[0] == -1;

                2)this.pssc.DownTrend(this.mcd.Values[1][0])[0] == -1


                both do not compile.

                Thoughts?

                Comment


                  #9
                  Hello outsource,

                  Thanks for your reply.

                  I created a short video to show another way you might approach this using the condition builder directly in your strategy code: http://screencast.com/t/fgX8vTkGGh7b
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Paul View Post
                    Hello outsource,

                    Thanks for your reply.

                    I created a short video to show another way you might approach this using the condition builder directly in your strategy code: http://screencast.com/t/fgX8vTkGGh7b
                    Thanks for that,Paul.But it still doesn`t compile.

                    Comment


                      #11
                      Ooopss...Sorry,just did that.

                      I think i got it,thanks Paul!Appreciate your help,Paul.You`ve been very helpful!
                      Last edited by outsource; 04-16-2015, 05:27 PM.

                      Comment


                        #12
                        Hi Paul,

                        the thing is,even though i`ve compilled the strategy succesfully,and ran it and saw the signal markers it left on the chart,- positions hadn`t been opened.I think the indicator still doesn`t see another indicator as an input.

                        Any futher ideas?

                        Thank you

                        Comment


                          #13
                          Just curious,why an indicator cannot be accessed directly via strategy input menu?

                          Comment


                            #14
                            Hello outsource,

                            Thanks for your replies.

                            Glad to hear you could compile successfully.

                            At this point you would want to using debugging techniques to help understand what inputs are driving what outputs. Here is a great reference: http://www.ninjatrader.com/support/f...ead.php?t=3418
                            Paul H.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by DJ888, 04-16-2024, 06:09 PM
                            6 responses
                            18 views
                            0 likes
                            Last Post DJ888
                            by DJ888
                             
                            Started by Jon17, Today, 04:33 PM
                            0 responses
                            1 view
                            0 likes
                            Last Post Jon17
                            by Jon17
                             
                            Started by Javierw.ok, Today, 04:12 PM
                            0 responses
                            6 views
                            0 likes
                            Last Post Javierw.ok  
                            Started by timmbbo, Today, 08:59 AM
                            2 responses
                            10 views
                            0 likes
                            Last Post bltdavid  
                            Started by alifarahani, Today, 09:40 AM
                            6 responses
                            41 views
                            0 likes
                            Last Post alifarahani  
                            Working...
                            X