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

Can not lauch VS2019 form NinjaTrader Script Editor

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

    Can not lauch VS2019 form NinjaTrader Script Editor

    I try to use Visual Studio to edit NinjaScropt. So I clicked the Visual Studio icon on UI of NinjaTrader Script Editor. Then show me a message that means can not find Visual Studio. But I installed VS2019 and version is 16.11.1. How to solve this problem?

    Thanks

    #2
    Hello UMLer,

    Thank you for your post.

    What is the full text of the error message you receive when attempting to launch Visual Studio from the NinjaScript Editor? Can you confirm that it's Visual Studio and not Visual Studio Code that you have installed?

    Thanks in advance; I look forward to assisting you further.

    Kate W.NinjaTrader Customer Service

    Comment


      #3
      To see message please open file1
      file2 is the VS i installed.
      Attached Files

      Comment


        #4
        Hello UMLer,

        Thank you for your reply.

        NinjaTrader uses vswhere.exe to find Visual Studio. NinjaTrader expects this file to be located in the following folder: %ProgramFiles(x86)%\Microsoft Visual Studio\Installer. You can open your Windows command prompt and cd to this directory and run the application to check the path assigned.

        cd C:\Program Files (x86)\Microsoft Visual Studio\Installer\
        vswhere.exe


        This will show where Visual Studio is installed. For example:

        productPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe

        Issues that could cause Visual Studio not to come up would include:

        a) vswhere is not in the proper location
        b) the IDE is not located in the designated folder.

        You can take a look at the following resource for further direction on customizing Visual Studio's location. This resource is publicly available.

        https://docs.microsoft.com/en-us/vis...s?view=vs-2019

        Please let us know if we can be of further assistance.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hi
          Thanks for your reply.
          vswhere.exe is at the proper folder that is as same as you mentioned. i do believe it is the default directory.
          the productPath is not the default directory. because when i installed my VS 2019, i choosed a specific directory that is better to me.
          so now it looks NT8 did not find the vswhere.exe at default directory? or did not get the information from vswhere.exe?

          is there an option to set the value of where VS installation directory is manually?

          Comment


            #6
            Hello UMLer,

            Does vswhere's productPath point to your Visual Studio location and not the default install path? Can you confirm Visual Studio is in the location returned when you run vswhere?

            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              vswhere's productPath points to my Visual Studio location that is not default directory.

              Comment


                #8
                Hello UMLer,

                Thank you for your reply.

                Can you provide a screenshot of what you get when you run vswhere.exe?

                I've attached an example of what it should look like.

                Thanks in advance; I look forward to assisting you further.
                Attached Files
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  here you are
                  Attached Files

                  Comment


                    #10
                    Hello UMLer,

                    Thank you for your reply.

                    NinjaTrader checks for 'Microsoft Visual Studio' - you've got it in a folder just called "Visual Studio" If you rename the folder to 'Microsoft Visual Studio' and then move everything inside under a new folder '2019' within that Microsoft Visual Studio folder I believe it should work.

                    Please let us know if we may be of further assistance to you.
                    Kate W.NinjaTrader Customer Service

                    Comment


                      #11
                      No, it does not work

                      Comment


                        #12
                        Hello UMLer,

                        Thank you for your reply.

                        We do not officially support VIsual Studio, so I am limited on what I can offer here. What I would recommend at this point is uninstalling Visual Studio and reinstalling in the default directory and then trying again to launch it as it may be an issue with having it installed in the custom location on the D drive.

                        Please let us know if we may be of further assistance to you.
                        Kate W.NinjaTrader Customer Service

                        Comment


                          #13
                          OK.
                          1. Is it possible to open ninja script file manually?
                          2. Is there project template to create a Ninja Script project in VS 2019 ? and any Add-ins for VS 2019?
                          3. how debug ninja script code? such as set a break point, watch value of a variable
                          4. How to do unit test in Ninja Script Editor or in VS 2019?

                          Thanks

                          Comment


                            #14
                            Hello UMLer,

                            Thank you for your reply.

                            Yes, you may open NinjaScript files manually. They are just .cs files and may be opened in any text editor you like.

                            Generally for NinjaScript items you would create the initial file within NinjaTrader using the NinjaScript Editor and then you can edit and debug within Visual Studio if you so wish. If you are creating an external program to interface with NinjaTrader via the DLL interface, an example project may be found on this forum post:



                            A basic overview of debugging using Visual Studio may be found in our help guide here:


                            For further information on debugging using Visual Studio please refer to their documentation.

                            We do not have any examples of unit testing NinjaScript files. From my knowledge of unit testing, it would likely be possible to access NinjaScript objects from the test. However, in contrast to how unit testing works, it may not be directly possible to recreate accurately what the platform does with the objects you would be testing (indicator, strategy). There are many steps required in correctly instantiating a NinajScript object that happens internally so that portion of this concept would not easily be recreated in a test.

                            Please let us know if we may be of further assistance to you.
                            Kate W.NinjaTrader Customer Service

                            Comment


                              #15
                              Thanks
                              Finally I found this Custom project in "..Documents\NinjaTrader 8\bin\Custom" folder. So i just use VS open it directly by myself.
                              looks it works then:

                              Q1:
                              I read this webpage at https://ninjatrader.com/support/help..._debugging.htm
                              there is a step 5 paragraph:
                              5. Run your NinjaScript object in NinjaTrader and it should stop at your break points and all the debugging tools and information should be available to inspect the current state of the code.

                              I do not understand "Run your NinjaScript object in NinjaTrader". what i do is
                              a. right click on a chart
                              b. click "indicators" menu item
                              c. choose my indicaot and add to chart
                              but it did not stop at my break points. did i do something wrong?

                              Q2:
                              After opne the Custom project, i notice i can compile it in VS. but there are some warnings, please open attachement.
                              Is it possible to eliminate those warnings? lt looks ugly

                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by quantismo, 04-17-2024, 05:13 PM
                              5 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by proptrade13, Today, 11:06 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              34 views
                              0 likes
                              Last Post love2code2trade  
                              Started by cls71, Today, 04:45 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post eDanny
                              by eDanny
                               
                              Started by kulwinder73, Today, 10:31 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X