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

Problem with Visual Studio Intellisense only in strategies

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

    Problem with Visual Studio Intellisense only in strategies

    Good afternoon. All of my strategies are exhibiting a strange behavior when I dev in VS 2022. The following only occurs in strategies (all, including ones built in Strat Builder), however, my indicators are fine. The strategies compile without issue. Am I missing a reference? Could this be something else with my environment or configuration?

    Thanks,
    Frank

    #2
    Another example.
    Attached Files

    Comment


      #3
      Hello qwiksilver96,

      Thank you for your post.

      Although Visual Studio may be used as a text editor, it may not have intelliprompt available for everything unless you manually include the NinjaTrader.Vendor.cs file in the Visual Studio solution. There is a caveat, as it iwll be removed for every change that is made in the NinjaScript project and you would have to add it again. If you require the intelliprompt or do not want to see those errors in your scripts, you would need to work in the NinjaScript Editor directly which does constantly have access to the NinjaTrader.Vendor.cs file.

      Please let us know if we may be of further assistance.
      Emily C.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Emily View Post
        Hello qwiksilver96,

        Thank you for your post.

        Although Visual Studio may be used as a text editor, it may not have intelliprompt available for everything unless you manually include the NinjaTrader.Vendor.cs file in the Visual Studio solution. There is a caveat, as it iwll be removed for every change that is made in the NinjaScript project and you would have to add it again. If you require the intelliprompt or do not want to see those errors in your scripts, you would need to work in the NinjaScript Editor directly which does constantly have access to the NinjaTrader.Vendor.cs file.

        Please let us know if we may be of further assistance.
        How does one go about including that file in the solution? Is the attached image correct? Added the file to both the solution and the project as shown in the image. Is this documented somewhere?
        Attached Files
        Last edited by qwiksilver96; 10-31-2023, 07:01 PM.

        Comment


          #5
          Additionally, see the attached image for a screen grab I did from one of Ninjatrader's Youtube videos that clearly shows during a video about the 10 benefits of using visual studio with Ninjatrader that the presenter's strategy does not show ANY intellisense errors or issues. How is that so? If I recall correctly, I recently was able to devlop strategies with fully functioning intellisense / intelliprompt (whatever you call it) and had no errors. The referenced video is: https://www.youtube.com/watch?v=CCPP5RC7fxU
          Attached Files

          Comment


            #6
            Hello qwiksilver96,

            Thank you for your reply.

            Manually including the NinjaTrader.Vendor.cs file in the Visual Studio solution is not documented, as it is not a NinjaTrader-specific item and is more specific to Visual Studio itself. With that said, it has come to my attention that with the latest version of NinjaTrader, 8.1.2.0, when you edit in Visual Studio the language version is set to "Latest" and not specifically to C# 8, so that is another cause for intellisense errors within Visual Studio. One client found a workaround for this in the following thread, and it has also been reported to the development team:
            The latest LangVersion in my VS2022 installation is C#11, not C#8. This is an issue b/c the little Intellisense tips that show up in my code are constantly telling me to use Target-typed new expressions, which is a C#9 feature and prevent my code from compiling. You can see this behavior by searching in NinjaTrader.Custom


            Thank you for your time and patience.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Emily View Post
              Hello qwiksilver96,

              Thank you for your reply.

              Manually including the NinjaTrader.Vendor.cs file in the Visual Studio solution is not documented, as it is not a NinjaTrader-specific item and is more specific to Visual Studio itself. With that said, it has come to my attention that with the latest version of NinjaTrader, 8.1.2.0, when you edit in Visual Studio the language version is set to "Latest" and not specifically to C# 8, so that is another cause for intellisense errors within Visual Studio. One client found a workaround for this in the following thread, and it has also been reported to the development team:
              https://forum.ninjatrader.com/forum/...dfaking-vs2022

              Thank you for your time and patience.
              The version number isn't the issue in my case. I created a new VM, installed VS and NT and am having no issue with the intellisense working correctly. There's something in my main machine's environment that has gotten fubared that is causing this issue.

              In the new system, I noticed that ninjascriptbase is inherited for this line ( protected override void OnStateChange()
              ​) while it is not inherited on my main machine with the issue.
              Last edited by qwiksilver96; 11-05-2023, 12:26 AM.

              Comment


                #8
                Originally posted by qwiksilver96 View Post

                The version number isn't the issue in my case. I created a new VM, installed VS and NT and am having no issue with the intellisense working correctly. There's something in my main machine's environment that has gotten fubared that is causing this issue.

                In the new system, I noticed that ninjascriptbase is inherited for this line ( protected override void OnStateChange()
                ​) while it is not inherited on my main machine with the issue.
                What are the results after repairing your NinjaTrader installation on the main machine?
                • Shut down NinjaTrader
                • Go to your computer's Control Panel > Programs & Features (Note: search for 'Control Panel' to find it within the Windows Start Menu. This will be a different window than the Settings page)
                • Left-click once on NinjaTrader > select 'Repair' above the list of available programs
                • Restart the platform after it finishes repairing, and test for this behavior again.
                ​I look forward to hearing the results.
                Emily C.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by burtoninlondon, Today, 12:38 AM
                0 responses
                4 views
                0 likes
                Last Post burtoninlondon  
                Started by AaronKoRn, Yesterday, 09:49 PM
                0 responses
                12 views
                0 likes
                Last Post AaronKoRn  
                Started by carnitron, Yesterday, 08:42 PM
                0 responses
                11 views
                0 likes
                Last Post carnitron  
                Started by strategist007, Yesterday, 07:51 PM
                0 responses
                13 views
                0 likes
                Last Post strategist007  
                Started by StockTrader88, 03-06-2021, 08:58 AM
                44 responses
                3,982 views
                3 likes
                Last Post jhudas88  
                Working...
                X