Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I encountered a problem to debug with Visual Studio 2022

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

    I encountered a problem to debug with Visual Studio 2022

    I installed the Visual Studio Community 2022 version. I checked C# development during the installation.
    After I right click in ninjascript editor- debug mode, I recompiled, and clicked the Visual Studio icon. Then in Visual Studio, I clicked debug-attach to process, and attached to ninjatrader.exe. When I set a break point, it shows the symbol is different, and won't hit.
    Can someone please give me advice?

    Click image for larger version

Name:	image.png
Views:	128
Size:	513.6 KB
ID:	1316273

    #2
    After a close look, I find that the indicator name was different, also the icon is different from the other indicators in the indicator explorer. This one is the correct one.
    Click image for larger version

Name:	image.png
Views:	109
Size:	233.7 KB
ID:	1316275

    But in the chart, when I try to add an indicator, this is the one shown up. That was the old one I deleted. The correct one never showed up here. "LastHourBox" is a test one that I created and deleted. It showed up here. The correct one I coded is "LastHourTradeZone" in Ninjascript Editor, but it never shows up in the indicators section in the chart. Can anyone please help?
    Click image for larger version

Name:	image.png
Views:	103
Size:	367.7 KB
ID:	1316276​​

    Comment


      #3
      Hello zehua,

      See the forum post below about allowing the source code to be different than the original


      The icon is different for this script as it is not a locked system script.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post
        Hello zehua,

        See the forum post below about allowing the source code to be different than the original


        The icon is different for this script as it is not a locked system script.
        Thank you. This is not my main concern here. My main concern is that after I created the custom indicator, it did not show up in the available list of indicators below. "LastHourBox" is the indicator that I created and deleted in Ninjascript editor. I later created an indicator called "LastHourTradeZone", and compiled properly, but that did not show up as available here. Can you please let me know if there is a temp folder that I should go to and clean up?

        Click image for larger version

Name:	image.png
Views:	104
Size:	507.9 KB
ID:	1316409

        Comment


          #5
          Hello zehua,

          There wouldn't be a temp folder to clean up for scripts..

          If an indicator is not appearing in the Indicators list after being compiled without errors, this could mean there is a run-time logic error in OnStateChange() which would appear on the Log tab of the Control Center when the Indicators window is open, or could mean the Name property in State.SetDefaults has been assigned a different string, or could mean the script was not created in the NinjaScript Editor as an indicator.

          Are you seeing errors appearing on the Log tab of the Control Center?

          What is the Name property set to in State.SetDefaults?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello zehua,

            There wouldn't be a temp folder to clean up for scripts..

            If an indicator is not appearing in the Indicators list after being compiled without errors, this could mean there is a run-time logic error in OnStateChange() which would appear on the Log tab of the Control Center when the Indicators window is open, or could mean the Name property in State.SetDefaults has been assigned a different string, or could mean the script was not created in the NinjaScript Editor as an indicator.

            Are you seeing errors appearing on the Log tab of the Control Center?

            What is the Name property set to in State.SetDefaults?
            Thank you! This is definitely helpful! I notice that in the SetDefaults, I set the Name to "LastHourBox", which was why that name showed up. I corrected that part to "LastHourTradeZone".


            Could you tell me where is the Log tab? I took a screenshot below that has the Indicators window launched from the chart. I don't see the Log tab here.
            Click image for larger version

Name:	image.png
Views:	97
Size:	702.5 KB
ID:	1316452
            Attached Files

            Comment


              #7
              Hello zehua,

              The Log tab is on the Control Center.

              The Control Center is the main window for the NinjaTrader Platform. This the window that has the New menu, Tools menu, Workspaces menu, etc.
              On the bottom of the window are the tabs. There is Orders tab, Executions tab, Strategies tab, Positions tab, Accounts, tab, and the Log tab.

              Below is a link to the help guide.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                One more question, why does Visual Studio show the source code is different from original? I've been doing C# development for years on other applications, and they are always the same. If they are different, it normally means I forgot to compile the updated source code. But in here, the source code should be the same as I just compiled. Can you please let me know why it still says source code is different from original, and if that's totally fine?

                Comment


                  #9
                  Hello zehua,

                  This was due to a change to the rosyln compiler to enable C# 8 features.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  671 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  379 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  575 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  582 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X