Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Debug?

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

    Debug?

    Hi,

    I'm having some trouble debugging using VS. I'm able to attach Visual Studio to the NT process and get all of the breakpoints that are located in code initialization to hit. However, OnBarUpdate breakpoints never get hit. In fact, I placed a breakpoint on OnBarUpdate and it never got hit.

    Can someone explain why or how this is happening?

    thanks!

    #2
    Jon, did you follow all those steps including using a non express VS version and enabling Debug Mode in the NinjaScript editor?

    Comment


      #3
      Bertrand,

      Yes. As I said, I was able to get some of my breakpoints to run (those set in the initialize section of my code within VS), however none of the event-code was ever hit (OnBarUpdate, OnExecution, OnOrderUpdate, etc).

      thanks-
      Azmat

      Originally posted by NinjaTrader_Bertrand View Post
      Jon, did you follow all those steps including using a non express VS version and enabling Debug Mode in the NinjaScript editor?

      http://www.ninjatrader-support.com/H...ualStudio.html

      Comment


        #4
        Instead of using VS, please add a simple print statement within OnBarUpdate() and see if you can get that printed into the NT Output Window.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          Yes. I have Print statements all over my code.
          None of them get printed at all.

          Some background. This is a tick-by-tick strategy. I am under the impression that OnBarUpdate gets called with every tick, is this correct?

          Completely confused. Any ideas?

          Originally posted by NinjaTrader_Josh View Post
          Instead of using VS, please add a simple print statement within OnBarUpdate() and see if you can get that printed into the NT Output Window.

          Comment


            #6
            Only when running in real-time do ticks get processed every tick. Otherwise it is processing once at the end of each bar. I suggest you try using SampleMACrossOver or any standard indicator to test. You likely have some programming mistakes with your particular script.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Don't strategies run in 'real-time' by default?

              I have a Historical check condition since my strategy is a real-time strategy. The ES (the product I'm testing this code with) is ticking live currently.

              Let me check the sample strategy and see how that goes.

              thanks
              jon

              Originally posted by NinjaTrader_Josh View Post
              Only when running in real-time do ticks get processed every tick. Otherwise it is processing once at the end of each bar. I suggest you try using SampleMACrossOver or any standard indicator to test. You likely have some programming mistakes with your particular script.
              Last edited by jonmoron; 03-08-2010, 05:35 PM.

              Comment


                #8
                Strategies run in real-time only when you actually run it on real-time data. There is no "default" behavior in this regard.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  No dice. I've placed breakpoints in VS 2010 in the Initialize and OnBarUpdate methods. The Initialize breakpoint gets hit every time I load the strategy in the Strategy selector within the Chart.

                  I'm running the strategies via the Chart. Is there another way for me to be running strategies against a real-time feed?

                  thanks!
                  jon

                  Comment


                    #10
                    Jon,

                    Please do not be testing Visual Studio at this point in time. You should only be testing regular scripts and ensuring your regular scripts work within the confines of NinjaTrader. Any print statements should show up in the Output Window.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Josh,

                      Ok. I'm connected to a real-time feed. I can see the product ticking in the SuperDom. This means that it is in fact a real time feed, correct? And that the strategy (SampleMACrossOver and my custom strategy) are using this feed, correct?

                      thanks!
                      jon

                      Originally posted by NinjaTrader_Josh View Post
                      Strategies run in real-time only when you actually run it on real-time data. There is no "default" behavior in this regard.

                      Comment


                        #12
                        Very well. But I cannot modify the SampleMACrossOver strategy, right?

                        Originally posted by NinjaTrader_Josh View Post
                        Jon,


                        Please do not be testing Visual Studio at this point in time. You should only be testing regular scripts and ensuring your regular scripts work within the confines of NinjaTrader. Any print statements should show up in the Output Window.

                        Comment


                          #13
                          Please open it up via the NinjaScript Editor, right click > Save As, use a new name, add some Print()s, compile, run the variant on a chart.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Josh,

                            I modified the sample cancel order strategy and added:

                            Print("in OnBarUpdate");

                            as the first line in the OnBarUpdate method.

                            This is the code I've modified:
                            When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until


                            As expected, there is nothing printed to the output window.



                            Originally posted by NinjaTrader_Josh View Post
                            Jon,

                            Please do not be testing Visual Studio at this point in time. You should only be testing regular scripts and ensuring your regular scripts work within the confines of NinjaTrader. Any print statements should show up in the Output Window.

                            Comment


                              #15
                              jonmoron,

                              How many bars are on the chart you are trying to run the strategy on?
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              649 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              370 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              576 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X