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

AddOn Development in Visual Studio

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

    AddOn Development in Visual Studio

    I am starting the process of porting my custom charttrader enhancements scripts from NT7 to NT8. Although I am an experienced programmer, I have not worked with WPF (just switched from MFC to WinForms a few years ago ).

    My NT7 scripts are somewhat complex so I want to be able to do the development in Visual Studio rather than the NT8 editor.

    To help get me started is there the possibility of getting the steps involved in setting up a new AddOn script in a VS project where all the editing and compiling of the XAML and CodeBehind files is done in Visual Studio. A blank AddOn script in a VS project would be Ideal.

    I have played around with doing this myself but VS seems to want to edit NT files I have not created so I am afraid I will break NT8, as I said I am a WPF newbie.

    Seems to me this is something a lot of people would be interested in.

    Thanks

    #2
    Hello seahn,

    Using Visual Studio is not officially supported by NinjaTrader Support, however, NinjaTrader 8 does attempt to make this easier to use.
    • Close all instances of Visual Studio.
    • Open the NinjaScript Editor from the NinjaTrader 8 Control Center New menu.
    • Click the Visual Studio icon on the Title bar of the NinjaScript Editor.


    This will open the NinjaTrader solution in VS.
    Save scripts individually.
    As you save a script with the NinjaScript Editor open, NinjaTrader will detect the change and auto-compile.
    Do not attempt to compile or run from VS.

    Below is a link to the help guide. Look near the 2 in the screenshot.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      By the way, I saw the NinjaTraderAddOnProject.zip referenced in another post and in the NT8 documentation under "AddOn Development Overview" but I cannot import it because it says that the import file was created with an incompatible version.

      If it could be converted to NT8.0.2.0 version it seems its just what I am looking for.
      Last edited by seahn; 01-08-2017, 08:18 PM.

      Comment


        #4
        Hello seahn,

        Are you referring to the AddOn Framework Example found at the link below?


        If so, I am able to import this on my end without error using the latest public version of NinjaTrader 8 (8.0.2.0).

        If this is not the script in question, can you provide me with a link to the script you are referring to?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Here is the link:



          It is located in the NT8 documentation under "Ninjascript/Educational Resources/AddOn development Overview".

          Comment


            #6
            Hello seahn,

            Are you referring to the link Download Visual Studio Solution for AddOn Development?

            This is not an indicator or an addon.

            This is a Visual Studio project solution.

            It cannot be imported into NinjaTrader. It must be opened in Visual Studio.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Ok, I see, my mistake, Thanks

              Comment


                #8
                The guide says: "If you use this setup and build a DLL with your IDE, the IDE will automatically place it where it needs to be and immediately launch the platform for testing any changes," after opening and building the DLL in VS, what is the next step to import the AddOn? How do I make use of the DLL just created in support of this AddOn example?

                Comment


                  #9
                  On my end, after compiling the DLL in VS, there is no Start Action (my installation path matches C:\Program Files (x86)\NinjaTrader 8\bin64\NinjaTrader.exe. So after starting NinjaTrader manually, it detected the AddOn. And now that the AddOn has been added (I cannot find the reference to the DLL, how do I remove the AddOn from NT since it's not under the AddOns folder in the NinjaScript Explorer?
                  Last edited by pedromoy; 08-20-2017, 12:07 PM.

                  Comment


                    #10
                    Alright, so I removed the .dll, .pdb, and .dat reference files manually and was able to remove the AddOn. Is there a more elegant less hacky way of doing this? That is, to remove the AddOn without having to resort to chasing reference files of the VS project?

                    Comment


                      #11
                      Hello,

                      Thank you for the reply.

                      NinjaTrader will automatically load this dll as it understands that it is an addon, so there is no need to reference the files. This is also partly because this gets loaded at startup like a BarsType rather than being dynamically compiled like an Indicator or source code you have imported.

                      In the case of completely removing the built addon, you have correctly done this my manually removing the files. You can also use the Remove NinjaScript Assembly menu in the future as this is an Assembly.

                      The process of building the external addon project does require that the platform is restarted between each build in Visual Studio, this is due to how the dll is being loaded. Unlike scripts that you develop in NinjaTrader, this dll is not dynamically generated when NinjaTrader compiles so it cannot be reloaded once it changes in this case.

                      So long as you exit the platform in between builds, you should be able to have visual studio replace the old dll file with the newly compiled version, then when you load NinjaTrader it could utilize the new code.

                      If this process is tedious for development, I would suggest to split your work into smaller tasks and use NinjaTrader instead of the external VS project for development. Once you have a firm code base, migrate it into the external project and retest to catch any problems with the change. This would really just aid in having to not close the platform between each test while you are developing.


                      I look forward to being of further assistance.
                      JesseNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      168 responses
                      2,261 views
                      0 likes
                      Last Post sidlercom80  
                      Started by Barry Milan, Yesterday, 10:35 PM
                      3 responses
                      10 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by WeyldFalcon, 12-10-2020, 06:48 PM
                      14 responses
                      1,428 views
                      0 likes
                      Last Post Handclap0241  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      41 views
                      0 likes
                      Last Post jeronymite  
                      Working...
                      X