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

Adding NT references to Visual Studio

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

    Adding NT references to Visual Studio

    Hi Ninjas,

    which DLL files would I need to add to the VS project references in order to get all Classes etc correct?
    So far I have added the onces from the screenshot, although I am not sure whether I really need all of them, and obviously there are missing some.

    Cheers

    #2
    Hello seykool,

    While we wouldn't be able to advise that we can suggest using the visual studio project from the help guide which already is configured for the correct .net version and references/build events.



    For active development you can simply click the visual studio button in the NinjaScript editor toolbar to open the custom project. That would allow for editing code and seeing changes in the platform using the reload NinjaScript feature. The visual studio development solution linked above would require restarting the platform between changes so its best for final builds of complex projects.

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      that's nice. I was searching for something like that. But it doesn't fully solve the issue. And I believe it is a BIG ISSUE!

      Using this premade VS project does the trick but the issue is that you would have to move the files back and forth between development and testing, right? Because if I add it to the indiactors folder in bin\custom\indicators NT can't compile anymore.

      Watch this video
      HTML Code:
      https://www.youtube.com/watch?v=OR5rZHtvlbQ&t=153s
      just the first 5 minutes or so and maybe the end. He has a very simple script that imports the DLLs to VS and has therefore the advantage of NT editor and VS at the same time. It even deployes the VS debug feature automatically by attaching NT automatically. But it also does all the rest that is lacking.
      Honestly, what he did, is what you guys should really do! I can't imagine anyone doesn't use VS who is serious about it, and that are many many people. His scripts are a few lines of code and eliminate all those tedious difficulties.

      Truth is I haven't digged far into VS and how it interacts with NT yet. So if it already is possible, it would be great you could advise me how to set this up.


      Greetings,
      Seykool

      Comment


        #4
        Hello seykool,

        Using this premade VS project does the trick but the issue is that you would have to move the files back and forth between development and testing, right?
        If you plan to use an external visual studio project that is really only intended for final releases/addons and not development. It would be extremely difficult to develop in an external project as the platform needs restarted for every change.

        Because if I add it to the indicators folder in bin\custom\indicators NT can't compile anymore.
        The visual studio project builds a dll and moves that file to the bin/custom folder. That would be the only supported use case for external visual studio projects.

        I couldn't comment on the video, if the video presents some information which can help connect visual studio in a different way you could reach out to the author for help in that area. We can only suggest using the default custom project for development (click the toolbar button in the NS editor) and for final or WPF development use the external VS solution. That solution is not a good candidate for indicator or strategy development and is mainly used for advanced WPF addon development. The platform has the ability to export items as dlls so really visual studio is mainly used as a text editor with syntax highlighting and can be used for debugging purposes. Outside of that it wont be used for much. It does have the ability to produce dlls which NinjaTrader can read but you need to restart the platform to reload those so it is not suited for use for all development.

        Please let me know if I may be of further assistance.





        JesseNinjaTrader Customer Service

        Comment


          #5
          Hi Jesse and everyone else,

          all I want is to get the code suggestions and references in VS, that it recognizes Brushes and OnBarUpdate for example, and that when I hit the save button, that NT compiles all changes. If I open VS via the VS button in the NS editor, though, it deletes with every restart all bookmarks and other settings.
          If I open the indicator folder directly through VS, it keeps the bookmarks and settings but doesn't have the references set.

          Nevertheless, I have found now a SOLUTION: I opened the VS once via the NS editor VS button and then renamed the .csproj file and when closing VS saved the .sln file under a different name as well. Now I simply open this .sln file and there it all is. My settings, bookmarks, the references and the option to let NT compile when I hit save in VS.

          And still, I insist on that you should watch the video and implement this to NT as standard. Maybe by loading similar files like those from Jason into the .sln file when pressing the VS button in the NS editor. It would not be much work for you, and save tons of work and complications for all coding users.
          Jason, the guy from the video coded a project and solution file for VS that does all the lifting with references, attaching the NT process for debugging and for building the script in VS, and some more features.


          Greetings

          Comment


            #6


            all I want is to get the code suggestions and references in VS, that it recognizes Brushes and OnBarUpdate for example, and that when I hit the save button, that NT compiles all changes. If I open VS via the VS button in the NS editor, though, it deletes with every restart all bookmarks and other settings.
            Then you would just use the toolbar button in the NS editor to open the custom project. You don't need to make a solution or do anything outside of the platform to get code highlighting for NinjaScript in visual studio.

            If I open VS via the VS button in the NS editor, though, it deletes with every restart all bookmarks and other settings.
            Right, VS is a text editor in this case. You are not developing a whole solution yourself and the project is regenerated a lot by the platform so visual studio can only be used in a limited capacity.

            Nevertheless, I have found now a SOLUTION: I opened the VS once via the NS editor VS button and then renamed the .csproj file and when closing VS saved the .sln file under a different name as well. Now I simply open this .sln file and there it all is. My settings, bookmarks, the references and the option to let NT compile when I hit save in VS.
            I couldn't recommend this, the .csproj file is managed by NinjaTrader and if you make that not editable in some way you will have problems in the platform later down the line.



            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rocketman7, Today, 09:41 AM
            4 responses
            15 views
            0 likes
            Last Post rocketman7  
            Started by selu72, Today, 02:01 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by WHICKED, Today, 02:02 PM
            2 responses
            13 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Started by Mikey_, 03-23-2024, 05:59 PM
            3 responses
            56 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Working...
            X