Announcement

Collapse
No announcement yet.

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

    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.



        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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X