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 do I Use Indicators like EMA in another Class

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

    How do I Use Indicators like EMA in another Class

    Hi,

    I have a strategy class and calling another Class that is passing this during initialization. In below syntax it is _Base. When I tried below syntax, I am getting error CS1955: Non-invocable member 'EMA' cannot be used like a method. How do I fix this? Thank you.

    double myEMA = EMA(_Base.BarsArray[barsInProgress], 9)[0];

    #2
    Hello kezyclaire,

    Thanks for your post.

    We are currently researching this inquiry and we will follow up with more information as soon as we are done looking into this inquiry.

    Thanks for your patience; I look forward to assisting further.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello kezyclaire,

      Thanks for your patience.

      EMA is a property of your strategy class, not the custom class.

      You would likely need to pass in the EMA indicator as a parameter in your custom C# class. Or, you could consider using your '_Base' object that you have shown to access NinjaScript-related properties in the script.

      Please let me know if I may assist further.
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        Hi Brandon,

        Great. I pass the indicator as a parameter, now it is working.

        Thanks!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by marcus2300, 05-10-2024, 10:21 AM
        7 responses
        25 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by ETFVoyageur, Today, 05:50 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by thumper57, 05-11-2024, 04:30 PM
        10 responses
        33 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Ludwik, Today, 03:52 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by ETFVoyageur, 05-11-2024, 12:52 AM
        4 responses
        41 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X