In order to begin debugging, it is necessary to have both a running Quantower terminal and an open strategy project in Visual Studio. Prior to starting, debugging must be configured by accessing the Quantower Algo settings in the VS Tools menu and navigating to the Algo tab within the Quantower terminal general settings screen.
Quantower Algo settings in Studio (left) and Algo settings in Quantower terminal (right)
To connect Visual Studio with Quantower Algo, we need to enable the "Allow connection from Visual Studio" option in the terminal settings and ensure that the connection port matches the one in the Quantower Algo settings.
Enabling this option might trigger a firewall or antivirus warning, which you should allow to establish the connection.
Press the Debug mode launch button and wait for Visual Studio to establish the debugging environment. One of the critical elements of this environment is a specialized console process (black background application) that connects your code editor and Quantower terminal.
Debug mode launch button
In case you haven't opened the Backtest & Optimize panel yet, Quantower will remind you to do so and select your strategy.
Configure the backtesting environment and locate the "Start in debug mode" button at the bottom of the sidebar. Click on this button to begin debugging your strategy.
Start in debug mode button
Locate the specific line in your Visual Studio editor where the algorithm needs to be paused and set a breakpoint there.
Visual Studio Community 2022 editor with an active Breakpoint halt
To exit Debug mode, simply click on the Stop button - a red square icon located to the right of the Continue button on the Visual Studio debug toolbar. This will close the binding console process and disconnect Visual Studio from the Quantower terminal.