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

Using Third-Party Assembly that Computes Indicator Values

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

    Using Third-Party Assembly that Computes Indicator Values

    Hi,

    I would like to call static methods from a third-party .NET 3.5 assembly that compute and return indicator values. I found instructions for adding references to dlls and that all works fine. I have created a new NinjaScript Indicator and added the required 'using' statement.

    An example method signature is,

    public static double[,] Compute(int period, int startRow, int endRow, double[,] data,
    int columnId, bool sizeToData = false)

    I am the developer of the third-party assembly so I can modify it if need be. I've searched, but cannot find any examples of using a third-party library like this within a NinjaScript indicator. Examples that simply return a constant value etc are not useful.

    If someone could post a link to an example or provide an example then I would appreciate it.

    Thanks,

    James

    #2
    Hello,

    Welcome to the NinjaTrader support forums!

    We don't have many (if any) examples or samples on developing your own external DLL since the majority of our customers wont be doing this. Its totally possible though and and I don't see any blockers on why would you would run into issues. What your talking about is just standard c# loading in an assembly and calling code from it. You would call the method from inside of OnBarUpdate() of the indicator that you build inside of NInjaTrader.

    If your running into a specific problem doing that or need a quick hand to get over the hill let me know what your having issue with and would be happy to comment further.

    -Brett

    Comment


      #3
      Hi Brett,

      Thank you for replying. I don't need help developing the external assembly. I've only just started using NinjaTrader hence my confusion.

      I'm not sure what NinjaTrader data I would pass to the external library and what format it is in. At the moment my library accepts multidimensional arrays of doubles. Is there an array of doubles, multidimensional or not, that I can use? I searched for an example of an external assembly being used like this, but the only example was one that returned the value 3. No examples of passing data to an external assembly.

      I was thinking that I could maintain my own private field that is a multidimensional array of doubles and has as many elements as is required by the indicators that I'm using. When data for a new bar comes in, I could shuffle the values back and add the new input value before calling the external assembly passing a reference to the input data. The external assembly has methods that compute and return the minimum number of rows required by each indicator function.

      Thanks,

      James
      Last edited by jalsck; 02-29-2016, 10:51 PM.

      Comment


        #4
        Looks like all is well using the approach I described in the previous post.

        Thanks,

        James

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junkone, Today, 11:37 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by frankthearm, Yesterday, 09:08 AM
        11 responses
        42 views
        0 likes
        Last Post frankthearm  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X