1. Home
  2. Docs
  3. Knowledge Base
  4. MT University
  5. Logging and Debugging

Logging and Debugging

Algorithms can output log, debug and error messages to the “Log” tab of your backtest “Results” interfacelog files for later analysis. The pattern Log(string message) applies.
					Log("Hello from CSharp");

If multiple identical log messages are sent, they are filtered out. You can intentionally bypass this by adding a timestamp to your log messages.
					Log(Time.ToString("o") + " Buying BTCUSD: " + data["BTCUSD"].Price);

Debug messages are capped at 200 characters long. If multiple identical messages are sent within 1 second, we rate limit the messages to avoid crashing your browser.

					Debug($"my variable value = {myVar}");

Like debug messages, error messages are rate limited to avoid flooding your browser. If several error messages are received in quick succession then your algorithm will produce a Runtime error and stop executing. You should use error messages sparingly and, typically, reserve error messages for conditions that force script execution.

					Error("Volatility too high, terminating algorithm.");
Quit();  //Optional: Instruct algorithm to stop.

During backtesting you can view log, debug and error messages in the "Logs" tab of your backtest's "Results" page.

backtest logging
Was this article helpful to you? Yes No

How can we help?

Close Menu