Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to get breakpoint hit in Visual studio

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

    Unable to get breakpoint hit in Visual studio

    I have experience creating a custom indicator that could be hit by the break point in visual studio. Now I take most of the code in the indicator to create a strategy. I added the strategy to the chart. The breakpoint in Visual studio is not being hit in the onBarUpdate method.
    I am using a demo account and the chart has delayed data. I wonder I have to open an account to have live data in order to have the strategy working? I did check "Enable" when I add the strategy to the chart.
    Click image for larger version

Name:	image.png
Views:	119
Size:	364.6 KB
ID:	1319562

    #2
    Hello zehua,

    In visual studio is the breakpoint shown as red or a hollow red ring?

    This may depend on where the breakpoint is, you should be able to still hit historical bar breakpoints during historical processing, in realtime you would need live data to have the strategy process normally and place orders.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello zehua,

      In visual studio is the breakpoint shown as red or a hollow red ring?

      This may depend on where the breakpoint is, you should be able to still hit historical bar breakpoints during historical processing, in realtime you would need live data to have the strategy process normally and place orders.
      Hi Jesse,
      I am using the demo account that has delayed data. I don't need real time order placement at this moment. i just would like to use historical data to backtest my strategy. The breakpoint was initially hollow, but after I right clicked, settings, allow breakpoint to be hit even if source code is different, then it turns solid. That was the same setting I used when developing indicators, so it should be fine. The breakpoint I set was at the first line of OnBarUpdate method. When I was developing indicators, that totally worked. I wonder if it didn't work when I applied to the strategy was because my account receives delayed data so it would only work on historical data? If that's the case, how do I let the strategy run for historical data?


      Thanks,
      Zehua

      Comment


        #4
        Hello zehua,

        Debugging strategies works the same as indicators. I just tried setting a breakpoint in the SampleMACrossOver strategy that comes with the platform on the first line of code in OnBarUpdate and that was hit on bar 0. Do you have debug mode enabled in the NinjaScript editor and have you compiled with that enabled?

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello zehua,

          Debugging strategies works the same as indicators. I just tried setting a breakpoint in the SampleMACrossOver strategy that comes with the platform on the first line of code in OnBarUpdate and that was hit on bar 0. Do you have debug mode enabled in the NinjaScript editor and have you compiled with that enabled?
          I try to load the SampleMACrossOver strategy to confirm it works. But this time, somehow the Enabled checkbox is disabled. I cannot enable it.
          Again, I am using the demo account with delayed data. Not sure how much that matters.

          Click image for larger version

Name:	image.png
Views:	87
Size:	439.3 KB
ID:	1319886

          Comment


            #6
            Hello zehua,

            You will need to use the strategy analyzer, playback connection or the simulated data feed in this situation.

            Comment


              #7
              Not sure how much this pop up would affect the strategy being properly backtested?

              Click image for larger version

Name:	image.png
Views:	69
Size:	299.9 KB
ID:	1319890

              Comment


                #8
                hmm.. nvm... I do see the onBarUpdate method being hit right away when I load the strategy of SampleMACrossOver into the chart. I'l retry with my own strategy. Thank you!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                51 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                128 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                69 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                42 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X