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 generate party3.cs for party3.dll indi, add to NinjaTrader.Custom.csproj ?

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

    how to generate party3.cs for party3.dll indi, add to NinjaTrader.Custom.csproj ?

    I would like to use 2 third-party (closed source) indicators in my strategy. I have the two .dll for these indicators in my Documents/NinjaTrader 8/bin/Custom folder. Let us call the A.DLL and B.DLL.

    In my strategy code, I can reference one of the indicators (A), but not the other (B). The B indicator reference gives me a type not found error in the NinjaScript editor when trying to compile; even when the reference is generated by the strategy builder. B is not found in the Indicators namespace.

    I notice that there are two differences between A.DLL and B.DLL:

    1) somehow (but I don't know how and this question is the understand how) I managed to get NinjaTrader to generate A.cs that corresponds to A.DLL. The A.cs boilerplate has these lines in it, that I think adds A to the Indicator namespace.

    #region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {

    private NameOfIndicatorA ...

    In contrast, while I have bin/Custom/B.DLL, I do not have bin/Custom/B.cs that contains that boilerplate to add B to the Indicators namespace. How would I get NinjaTrader to generate it?

    2) I notice that the C:\Users\me\Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Custom.dll has a dependency on the A.dll, and that the NinjaTrader.Custom.csproj file has a reference to the name of A, its DLL, and its generated boilerplate, like this:

    NinjaTrader.Custom.csproj: <Reference Include="A">
    NinjaTrader.Custom.csproj: <HintPath>C:\Users\jaten\Documents\NinjaTrader 8\bin\Custom\A.dll</HintPath>
    NinjaTrader.Custom.csproj: <Compile Include="A.cs" />


    Conclusion and Question: Correct me if I'm wrong, but I'm assuming that both 1) and 2) need to happen for B as well, in order to allow me to reference B in my strategy ninjascript code.

    The question is, how do I generate the boilerplate for B, and get it added to the .csproj file?

    Thank you.

    p.s. I have tried running the StrategyBuilder and referencing B in the decision rules. While the StrategyBuilder seems to reflect/introspect the B.DLL and generate a call to instantiate B, the code will not compile because it seems to be missing, at the very least, the B.cs boilerplate.

    #2
    Hi yodaler, thanks for writing in. The .cs code that is generated for DLL files is created by the CodeDOM upon compiling/building of the DLL. You would need the source code of indicator B to expose any properties or methods that are not currently exposed. If the developer has not made this DLL available by means of public properties or public methods it will not be possible unless the developer changes the source code and re-distributes the DLL file.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      The third party did not supply A.cs; I generated that somehow, but I don't how, using NinjaTrader. I just want to do the same for B.cs. The needed call to B() is clearly already public since the StrategyBuilder can reflect and find it. where is the CodeDOM located? -- I haven't heard of that before.

      Can you or anyone else advise on part (2): How do I get B added to the NinjaTrader.Custom.csproj? I tried manually edited the .csproj file, but NinjaTrader took out my edit on my next build attempt.

      Comment


        #4
        Hi yodaler, thanks for your reply. The CodeDOM is a module in the NinjaTrader core that takes care of compiling and generating DLL files. There is no access to this module. I am afraid adding anything to the custom project is not possible, or if it is, it's not supported and we have no documentation on the subject. That file is generated automatically by the CodeDOM as well.

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Aha. I located my mistake. It appears the vendor did supply the .cs files. They were in a separate folder.

          Comment


            #6
            For any other newb like me who stumbles across this looking for answers: The Tools -> Import -> NinjaScript Add-On operation is what updates the bin/Custom/NinjaTrader.Custom.csproj file for you. You cannot just copy .cs files into bin/Custom like I was doing. They have to be imported from inside a .zip file, maybe with an Info.xml alongside the .cs and .dll.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DavidHP, Today, 07:56 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by kujista, Today, 06:23 AM
            3 responses
            6 views
            0 likes
            Last Post kujista
            by kujista
             
            Started by Mindset, Yesterday, 02:04 AM
            2 responses
            17 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Started by f.saeidi, Today, 08:03 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by samish18, 04-17-2024, 08:57 AM
            15 responses
            52 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X