Debugging in VS 2022

Video manual about debugging

Debugging setup

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.

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.

Start debugging

  1. 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.

In case you haven't opened the Backtest & Optimize panel yet, Quantower will remind you to do so and select your strategy.

  1. 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.

  1. Locate the specific line in your Visual Studio editor where the algorithm needs to be paused and set a breakpoint there.

Stop debugging

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.

Last updated