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

Calling another indicator, constructor issue

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

    Calling another indicator, constructor issue

    Hi,

    my script calls another indicator but I always get the error that there was no constructor that takes this number of arguments. Many properties of the called indicator don't have the NinjaCcriptPropertyAttribute, I fear this might be the problem. I attached a screenshot.
    Any suggestion?

    Greetings
    Seykool
    Attached Files

    #2
    Hello seykool,

    Yes that is the problem, if you want those to be a parameter of the constructor they need to be marked with NinjaScriptProperty.

    You also dont need the new keyword, indicators are called without new:

    EMA myEma = EMA(12);


    https://ninjatrader.com/support/help...criptAttribute
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Cheese,

      thanks for your reply and advice. I am calling the indicator in DataLoaded, therefore the new keyword.
      With regard to the constructor, that is a misunderstanding. It does what it is supposed to do. The problem is I can't call the indicator. I get the error that 'there wasn't a constructor with that number of arguments'. But as you can see on the screenshot, I am calling the exact same number of arguments that there are. This is the problem.

      Greetings

      Comment


        #4
        Hello seykool,

        You never use the new keyword on indicators, that is not required due to how indicators work. Calling new will not allow the indicator to work correctly. If you want to see how to call indicators correctly and set them up from OnStateChange you can use the strategy builder. To generate the code for your specific indicator you can use it in a condition and then click View Code.



        JesseNinjaTrader Customer Service

        Comment


          #5
          Hi Jesse,
          back to basics. That easy. Now it works. Thank you for the support!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Carolscogginsi, Yesterday, 10:45 PM
          0 responses
          6 views
          0 likes
          Last Post Carolscogginsi  
          Started by RaddiFX, Yesterday, 10:15 AM
          2 responses
          15 views
          0 likes
          Last Post RaddiFX
          by RaddiFX
           
          Started by patrickmlee007, Yesterday, 09:33 AM
          2 responses
          18 views
          0 likes
          Last Post patrickmlee007  
          Started by magnatauren, 08-15-2020, 02:12 PM
          5 responses
          208 views
          0 likes
          Last Post RaddiFX
          by RaddiFX
           
          Started by rene69851, 05-02-2024, 03:25 PM
          1 response
          24 views
          0 likes
          Last Post rene69851  
          Working...
          X