• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
    http://ninjatrader.com/support/helpG...components.htm
    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?
        http://ninjatrader.com/support/forum...php?linkid=763

        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:

          http://ninjatrader.com/support/helpG...dOnProject.zip

          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 uday12, Today, 08:25 AM
                      2 responses
                      11 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by uday12, Today, 09:45 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post uday12
                      by uday12
                       
                      Started by IanC28, Today, 08:47 AM
                      1 response
                      4 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by trdmark, Today, 07:50 AM
                      1 response
                      16 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by PBreen, Today, 07:42 AM
                      2 responses
                      7 views
                      0 likes
                      Last Post PBreen
                      by PBreen
                       
                      Working...
                      X