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

NT7 and Visual Studio

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

    NT7 and Visual Studio

    I'd like to view my NT7 strategy in Visual Studio 2017. I'm new to programming. Where are the NT declarations stored?
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;

    #2
    Hello RJBen,

    Thank you for the post.

    If you have not yet configured the NT7 visual studio project, you will need to do that prior to being able to use VS with NT7. If you are asking this question because you are seeing reference errors, that would be expected if you have not fixed the References in the project file.
    Please see the following video on setting up the visual studio project: http://www.screencast.com/t/eH7y5cedlzh

    Additionally, visual studio was not fully supported in NT7. This means that when you are editing files in VS you will also need to keep the ADL indicator open in NinjaTrader. This is so you can compile from NinjaTrader after making changes in VS. Going forward in NT8 visual studio is now fully supported.

    After setting up the visual studio project, you would need to also include your strategy in the solution by using the solution explorer. If you are new to visual studio are are not sure how to do this, I would suggest first reviewing microsofts help information and other tutorials for Visual Studio before starting with NinjaTrader. Here is one tutorial showing how to show all files and include in project which is heavily used for the NT7 vs project: https://blogs.msdn.microsoft.com/ben...how-all-files/

    Regarding your question, the code for these declarations is internal and reside in the various NinjaTrader dlls. Correcting the references in the VS project will allow access to these types for items Included in the VS project.

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

    Comment


      #3
      Thank you for the video Jesse. Does this have to be done every time I want to run either a NinjaScript or Strategy in VS?

      Comment


        #4
        Hello RJBen,

        Thank you for the reply.

        I should have mentioned that the video setup for VS only needs to be done once. If you happen to remove your user data documents/NinajTrader7 folder in the future, you will need to do this again at that point.

        The "include in project" step also needs to be done once per script. If an item is not currently in the solution, you need to add it for breakpoints and intellesense to work. After you include the item in the project, it should stay included making that also a 1 time step per script.


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

        Comment


          #5
          Almost there Jesse!
          The
          using System.Drawing.Drawing2D;

          still has a red squiggly under the Drawing2D part.

          and it is saying
          "The name MAX (and MIN) does not exist in the current context.

          It has already compiled in NT7. I am not looking to change anything in the file. What I really want to do is analyze the file at it's breakpoints.

          Comment


            #6
            Found the MAX and MIN...

            Comment


              #7
              Hello RJBen,

              Thank you for the reply.

              I wanted to check, are you still having difficulty in reaching breakpoints? Have you also enabled debug mode in the NinjaScript editors Right click menu and recompiled?

              There is a short guide to debugging in the help guide here: https://ninjatrader.com/support/help...isual%2Bstudio

              Using the debugging in Visual Studio is not something I could detail but Microsft has quite a bit of documentation surrounding thier tools and use if more information is needed.

              The red sqigly line under the System.Drawing.2D would indicate that it cannot be found. Do you have the System.Drawing.dll referenced in the project currently?

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

              Comment


                #8
                Yes the System.Drawing is included. The only one with errors is the System.Drawing.Drawing2D

                using System;
                using System.ComponentModel;
                using System.Diagnostics;
                using System.Drawing;
                using System.Drawing.Drawing2D;
                using System.Xml.Serialization;
                using NinjaTrader.Cbi;
                using NinjaTrader.Data;
                using NinjaTrader.Gui.Chart;

                Comment


                  #9
                  OK, So I fixed the drawing issue.

                  Now it is returning errors on Column, Strategy, Indicator, MAX and MIN. I had added these as their respective cs files ie. Column.cs; Strategy.cs; etc.

                  Several errors went away when I added these cs files to the Solution.

                  All the errors were gone until I ran Start. Now I am getting these errors for each of the above.

                  Error CS2011 Error opening response file 'C:\Users\ronal\Documents\Visual Studio 2017\Templates\ProjectTemplates\RBBearsBulls\RBBea rsBulls\Column.cs'

                  Error CS2011 Error opening response file 'C:\Users\ronal\Documents\Visual Studio 2017\Templates\ProjectTemplates\RBBearsBulls\RBBea rsBulls\Strategy.cs'

                  Error CS2011 Error opening response file 'C:\Users\ronal\Documents\Visual Studio 2017\Templates\ProjectTemplates\RBBearsBulls\RBBea rsBulls\Indicator.cs'

                  Error CS2011 Error opening response file 'C:\Users\ronal\Documents\Visual Studio 2017\Templates\ProjectTemplates\RBBearsBulls\RBBea rsBulls\MAX.cs'

                  Error CS2011 Error opening response file 'C:\Users\ronal\Documents\Visual Studio 2017\Templates\ProjectTemplates\RBBearsBulls\RBBea rsBulls\MIN.cs'

                  Comment


                    #10
                    Hello RJBen,

                    You said that all the errors are gone until you run start, are you trying to run the project from visual studio? This would not work if you are trying to build in visual studio, you would need to open the ADL from NinjaTrader and compile inside of NinjaTrader to check for errors. Visual Studio can only be used to attach to NinjaTrader to reach breakpoints, or to be used as a syntax editor with the custom project.

                    I also noted the file paths listed in the messages are not from the NInjaTrader.Custom project, are you currently creating your own project?

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

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by adeelshahzad, Today, 03:54 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by stafe, 04-15-2024, 08:34 PM
                    7 responses
                    32 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by merzo, 06-25-2023, 02:19 AM
                    10 responses
                    823 views
                    1 like
                    Last Post NinjaTrader_ChristopherJ  
                    Started by frankthearm, Today, 09:08 AM
                    5 responses
                    21 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    43 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X