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

Debugging NinjaScript w/ MS Visual Studio

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

    Debugging NinjaScript w/ MS Visual Studio

    I've been looking at the latest MS VS products as I need some help debugging my scripts. Searching the forum, I see this:



    It appears someone was having a bit of trouble debugging scripts that were not part of the set of core indicators that come with NT.
    While I'd probably debug some of the core indicators it would be for educational purposes. I would not continue to evaluate MS VS if scripts I write could not be debugged.
    Q1: Is it possible to debug ALL scripts? (core and those that I write -- provided they compile... of course)

    I see there is a way to use VS Express to debug but the setup looks complicated (based on my skill set). Perhaps I haven't found the best thread, ie the most straight forward instruction list..
    Q2: For those that have gone this route.. would you mind pasting a link to the directions you used? any tips appreciated

    If the VS Express doesn't pan out for me, I'd be interested in which of the current versions (or past if still available) others make use of for debugging. I see the following 2012 currently available:
    • Ultimate
    • Premium
    • Test Pro
    • Professional

    Q3: Of those of you that use MS VS for debugging, what is your app of choice? (I just need this for NS debugging, so least expensive that contains debugging capabilities)


    Thanks in advance!!

    #2
    Hello wishbone,
    Welcome to the forum and I am happy to assist you.

    1. By core do you mean the system NinjaScript codes which comes natively with NinjaTrader (like SMA, EMA, RSI etc). If so then you debug the code, however you cannot modify the system codes (modifications wont be saved). You can however free to make copy of the code and further edit/modify it.

    2. Yes, you can use Express edition. You can refer to this post for further details however nothing we would officially support.


    In Visual Studio 2012 Express Edition you can attach a process, so you can also try VS 2012 Express Edition.

    3. I will leave this for our forum members who can further share their experience.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Originally posted by wishbone View Post
      I've been looking at the latest MS VS products as I need some help debugging my scripts. Searching the forum, I see this:



      It appears someone was having a bit of trouble debugging scripts that were not part of the set of core indicators that come with NT.
      While I'd probably debug some of the core indicators it would be for educational purposes. I would not continue to evaluate MS VS if scripts I write could not be debugged.
      Q1: Is it possible to debug ALL scripts? (core and those that I write -- provided they compile... of course)

      I see there is a way to use VS Express to debug but the setup looks complicated (based on my skill set). Perhaps I haven't found the best thread, ie the most straight forward instruction list..
      Q2: For those that have gone this route.. would you mind pasting a link to the directions you used? any tips appreciated

      If the VS Express doesn't pan out for me, I'd be interested in which of the current versions (or past if still available) others make use of for debugging. I see the following 2012 currently available:
      • Ultimate
      • Premium
      • Test Pro
      • Professional

      Q3: Of those of you that use MS VS for debugging, what is your app of choice? (I just need this for NS debugging, so least expensive that contains debugging capabilities)


      Thanks in advance!!
      VS2012 Express will finally allow you to attach a process, so you can use that. It is free.

      Just follow the instruction in NT Help. ref: http://www.ninjatrader.com/support/h..._debugging.htm

      Comment


        #4
        Thanks again.. so new I just realized I don't know how to close a thread.. ?

        You'd think it would be right here EDIT QUOTE REPLY "CLOSE" :>O)

        Comment


          #5
          Originally posted by wishbone View Post
          Thanks again.. so new I just realized I don't know how to close a thread.. ?

          You'd think it would be right here EDIT QUOTE REPLY "CLOSE" :>O)
          Only board admins can close threads.

          Comment


            #6
            1) right click on my code and enabled debug mode
            2) opened MS VS 2012 express --> DEBUG --> Attach to process
            selected NinjaTrader.exe Control Center - Untitled1
            attach to: Automatic: Managed (v3.5, v3.0, v2.0) code
            Clicked ATTACH
            File | Open -- opened my script but RUN / STEP INTO etc, is not enabled..

            3) Stopped debugger and opened my script in NT
            opened MS VS 2012 express --> DEBUG --> Attach to process
            selected NinjaTrader.exe Control Center - MYSCRIPT (so it sees the script..)
            attach to: Automatic: Managed (v3.5, v3.0, v2.0) code
            Clicked ATTACH
            script appears, able to set a breakpoint.. so that's progress.
            still no run/step commands available..

            Appreciate if anyone can point out what I've missed in the instructions

            Thanks in advance!

            Comment


              #7
              Hello wishbone,
              Please make sure to compile the code via the NinjaScript Editor after you have attached NinjaTrader to the debugger.

              Attached Files
              JoydeepNinjaTrader Customer Service

              Comment


                #8
                Joydeep -- Thanks for the reply. I'm still unable to debug. F5, F11, etc are disabled in MS VS. Here are the steps I took on this attempt:

                (reboot)
                Start Ninja Trader
                Tools | Edit Ninja Script | Indicator ---> selected MYSCRIPT
                Right click --> Debug mode (right click again to verify.. yep.. still debug mode..)

                Start MS VS 2012 express --> DEBUG --> Attach to process
                Selected NinjaTrader.exe Control Center - Untitled1
                Attach to: Automatic: Managed (v3.5, v3.0, v2.0) code
                Clicked ATTACH button (dialog closes..)
                MS VS screen is now blank (but the "PROCESS" dropdown = NinjaTrader.exe)

                Toggled back to NT and F5 to compile MYSCRIPT.

                Is there where MYSCRIPT should appear on the MS VS screen?

                Now, if I select DETACH ALL and reattach, the MS VS Attach line looks like this:
                Selected NinjaTrader.exe Indicator - MYSCRIPT
                Toggle back to NT and F5 to compile (again.. message about being in debug mode...)

                MS VS screen is still blank ("PROCESS" dropdown = NinjaTrader.exe)

                I tried opening MYSCRIPT from within MS VS. While breakpoints are available, nothing else is.

                My apologies for being a slow poke at understanding how to get MYSCRIPT recoginzed in the MS VS debugger!. Just need to get thru it once..1

                Thanks for an additional help..

                Comment


                  #9
                  Originally posted by koganam View Post
                  Only board admins can close threads.
                  I've never seen that here..

                  I'm must be a newb still...

                  Comment


                    #10
                    Originally posted by sledge View Post
                    I've never seen that here..

                    I'm must be a newb still...
                    Apparently, the users here are so well behaved that we have had no flame wars, so there has been no need to close threads often. In fact, I do not think that anyone has even ever been banned. I believe that I have seen maybe one thread closed to posts in all my time here, most likely by NInjaTrader_Dierck and I am not sure even of that.

                    However, a lot of Ray's earlier announcement threads have been closed.
                    Last edited by koganam; 01-08-2013, 12:00 AM.

                    Comment


                      #11
                      Hello wishbone,
                      Please refer to this video which demonstrates how to debug a NinjaScript code using VS Express 2012.
                      JoydeepNinjaTrader Customer Service

                      Comment


                        #12
                        Visual Studio 2012 Express

                        Hello

                        I'm getting the following error after launching VS 2012 Express and selecting Debug -> Attach to Process....

                        Microsoft Visual Studio Express 2012 for Windows Desktop
                        Processes cannot be displayed. Operation not supported. Unknown error: 0x8ede000e

                        Appreciate any help on this

                        Thanks

                        Al

                        Comment


                          #13
                          Originally posted by koganam View Post
                          Apparently, the users here are so well behaved that we have had no flame wars, so there has been no need to close threads often. In fact, I do not think that anyone has even ever been banned. I believe that I have seen maybe one thread closed to posts in all my time here, most likely by NInjaTrader_Dierck and I am not sure even of that.

                          However, a lot of Ray's earlier announcement threads have been closed.
                          I have a deleted post regarding TDA

                          Comment


                            #14
                            Originally posted by aguison View Post
                            Hello

                            I'm getting the following error after launching VS 2012 Express and selecting Debug -> Attach to Process....

                            Microsoft Visual Studio Express 2012 for Windows Desktop
                            Processes cannot be displayed. Operation not supported. Unknown error: 0x8ede000e

                            Appreciate any help on this

                            Thanks

                            Al
                            I'm not quite sure why you'd be hitting this and I cannot reproduce trying various mis-settings.

                            Can you give me specific steps on what you're doing that is triggering this?
                            MatthewNinjaTrader Product Management

                            Comment


                              #15
                              Which VS 2012 Express ?

                              Looking over the MS VS download page I see two variations of Visual Studio 2012 Express:
                              • for Windows 8
                              • for Windows Desktop
                              Does anyone know whether the Win8 version works as a debugger, or if there's any performance improvement from using it?

                              Thanks in advance.

                              dwt__

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RookieTrader, Today, 09:37 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by alifarahani, Today, 09:40 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post alifarahani  
                              Started by Gerik, Today, 09:40 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post Gerik
                              by Gerik
                               
                              Started by KennyK, 05-29-2017, 02:02 AM
                              3 responses
                              1,283 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              11 responses
                              185 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X