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 tsantospinto, 04-12-2024, 07:04 PM
                    6 responses
                    98 views
                    0 likes
                    Last Post tsantospinto  
                    Started by rocketman7, Today, 02:12 AM
                    5 responses
                    25 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by ZenCortexReal, Today, 08:54 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post ZenCortexReal  
                    Started by ZenCortexReal, Today, 08:52 AM
                    0 responses
                    0 views
                    0 likes
                    Last Post ZenCortexReal  
                    Started by trilliantrader, 04-18-2024, 08:16 AM
                    7 responses
                    28 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Working...
                    X