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 call an indicator which uses 2 frequencies into a strategy?

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

    How to call an indicator which uses 2 frequencies into a strategy?

    Ninjas,
    I have an indicator which uses 2 frequencies; that is, BarsArray[0] and BarsArray[1]. How do I call this indicator into a strategy? When I put the indicator in the strategy I'm only able to reference a single BarsArray, not the 2 frequencies that are require for the indicator to function properly.

    Do I have to separate the charting and strategy tasks and use the indicator for charting only and rewrite the function used in the indicator directly into the strategy?

    #2
    Hello Bluelou,

    Thank you for your post.

    You can access indicator values from a strategy if they're plots, or following the principles in the reference sample on exposing indicator values that are not plots.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan,
      That's not what I was asking. I have an indicator that requires 2 frequencies; i.e., 2 BarsArrays. How do I call an indicator which requires 2 BarsArray into a strategy?

      When writing the code in the strategy I get an error message which reads "No overload for method 'EEUP4' takes 3 arguments". So, how do I get the 2nd BarsArray into the indicator call while in a strategy?




      Originally posted by NinjaTrader_RyanM View Post
      Hello Bluelou,

      Thank you for your post.

      You can access indicator values from a strategy if they're plots, or following the principles in the reference sample on exposing indicator values that are not plots.

      Comment


        #4
        Hi bluelou,

        I don't follow what it is you're trying to do. Please share the files or the code you're trying to call from the strategy.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,
          This is what I want to do:

          I have an indicator named EEUP4. It requires 2 frequencies so this is how I want to call it in my strategy:

          EEUP4(BarsArray[2], BarsArray[4], 0)[0] > 0

          ...But, I can't do this b/c of the error message: "No overload method"... So, how do I get 2 BarsArray into 1 indicator?

          Comment


            #6
            Can you attach the indicator you're trying to call from the strategy? It should be in My Documents\NinjaTrader\bin\custom\indicator
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Nevermind. Since the indicator didn't work within the strategy I just wrote it as a function within a strategy. Works fine that way. Sounds like a limitation of the way indicators can be used in NinjaTrader.

              Comment


                #8
                There's too little information to tell if there is any limitation here. I'm still willing to look at your indicator to see how it would be called from a strategy. You can also email [email protected] if you do not want to share it on the forums.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Ryan,
                  Try creating any indicator which calls 2 BarsArrays. My guess is that it won't work. I'll try it on my own to confirm - but it will have to wait until tomorrow. Thx for your interest though.

                  Lou

                  Comment


                    #10
                    bluelou,

                    as I understand it the 2 frequencies are never accessible at the same time but only consecutively.
                    The variable BarsInProgress is accessible from OnBarsUpdate() tells you which frequency is currenty active.
                    You do not need to pass the primary data series for an indicator, so call just EE4P(0)[0]
                    your strategy must also define the 2 frequencies, so that OnBarsUpadate() is called for both possible BarsInProgress values.

                    andreas
                    www.zweisteintrading.eu

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by mjairg, 07-20-2023, 11:57 PM
                    3 responses
                    213 views
                    1 like
                    Last Post PaulMohn  
                    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                    4 responses
                    544 views
                    0 likes
                    Last Post PaulMohn  
                    Started by GLFX005, Today, 03:23 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post GLFX005
                    by GLFX005
                     
                    Started by XXtrader, Yesterday, 11:30 PM
                    2 responses
                    12 views
                    0 likes
                    Last Post XXtrader  
                    Started by Waxavi, Today, 02:10 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post Waxavi
                    by Waxavi
                     
                    Working...
                    X