• 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

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 saltminer, Today, 05:19 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post saltminer  
                    Started by martyn73, Today, 04:18 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post martyn73  
                    Started by aprendiz, Today, 03:42 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post aprendiz  
                    Started by 1001111, Today, 09:10 AM
                    1 response
                    18 views
                    0 likes
                    Last Post NinjaTrader_ChrisL  
                    Started by usero86, Today, 06:02 AM
                    1 response
                    12 views
                    0 likes
                    Last Post NinjaTrader_ChrisL  
                    Working...
                    X