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 custom C# classes problem

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

    #31
    Unfortunately we are unable to provide support on managing additional assemblies beyond what would be supported by pressing the F5 key/compile button in the NinjaScript editor (which essentially builds an assembly properly managed under the hood by NT).

    Comment


      #32
      Dierk,

      Thank you for your response.

      Can you please help me understand something? When NT Partners deploy assemblies with custom strategies, how do they do this? I assume using dlls?

      Kind regards,

      Dan

      Comment


        #33
        We would not be able to comment on the installer methods 3rd party developers decide to use, but if you want a compiled assembly please go to File->Utilities->Export NinjaScript->Select "Export compiled assembly".
        Josh P.NinjaTrader Customer Service

        Comment


          #34
          Josh,

          Thank you for the response.

          Why are you not able to comment?

          Kind regards,

          Dan

          Comment


            #35
            Dan,

            They can use whatever they want. We do not control this.
            Josh P.NinjaTrader Customer Service

            Comment


              #36
              Josh,

              Thank you for the response. And thanks for the clarification, let me try to understand from a different angle.

              If a partner came to you and said they wanted to deploy a dll with custom classes in it, what would you advise? What would you suggest is best practice for interfacing with NT’s assemblies?

              To give a specific example, if one was to need to deploy a Position Management class (that included things like stop management) what was not appropriate to be internal to a strategy script, and it wasn’t appropriate for UserDefinedMethod (as it was likely to be exported later), what would you advise?

              Kind regards,

              Dan

              Comment


                #37
                Dan,

                Create a file just like UserDefinedMethod, save it as a different name, export it along with your files and it should work.
                Josh P.NinjaTrader Customer Service

                Comment


                  #38
                  Josh,

                  Thank you again for the reply.

                  Good suggestion, thanks for helping around that particular problem.

                  Unfortunately, I've just implemented a file called PositionManagement with the following code:

                  Code:
                  [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]
                  [SIZE=2][FONT=Courier New][COLOR=#0000ff]#region[/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Using declarations[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] System;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] System.ComponentModel;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] System.Drawing;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] NinjaTrader.Cbi;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] NinjaTrader.Data;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] NinjaTrader.Indicator;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] NinjaTrader.Strategy;[/SIZE][/FONT]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion[/COLOR][/SIZE][/FONT]
                  [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]// This namespace holds all strategies and is required. Do not change it.[/COLOR][/SIZE][/FONT]
                  [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] NinjaTrader.Strategy[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
                  [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>[/COLOR][/SIZE][/FONT]
                  [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000] This file holds all user defined strategy methods.[/COLOR][/SIZE][/FONT]
                  [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>[/COLOR][/SIZE][/FONT]
                  [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]partial[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Strategy[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
                   
                  [SIZE=2][FONT=Courier New]Print([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Test"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                   
                  [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
                  [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
                  [/SIZE][/FONT]
                  Unfortunately, I'm now getting complie errors, something about return types.

                  Did I miss something?

                  Comment


                    #39
                    Please try placing it inside a method like one of these examples: http://www.ninjatrader-support.com/H...6/Sample1.html
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #40
                      Josh,

                      Thank you very much for your help and persistence. That worked a charm. I obviously need to do more reading regarding class components in .Net.

                      Kind regards,

                      Dan

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Waxavi, Today, 02:10 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post Waxavi
                      by Waxavi
                       
                      Started by TradeForge, Today, 02:09 AM
                      0 responses
                      8 views
                      0 likes
                      Last Post TradeForge  
                      Started by Waxavi, Today, 02:00 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post Waxavi
                      by Waxavi
                       
                      Started by elirion, Today, 01:36 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post elirion
                      by elirion
                       
                      Started by gentlebenthebear, Today, 01:30 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post gentlebenthebear  
                      Working...
                      X