Logging

[logging] groups the options that control logs during backtests, including where they are written and how much detail to keep. A strategy can declare only one [logging] block.

Note: When the CLI runs with --json, console logs are disabled automatically so stdout remains dedicated to the JSON payload. The CLI override takes precedence over the [logging] settings.

Example

[logging]
file_logging_enabled    = true
console_logging_enabled = true
objective_limit         = 1
include_trades          = true

Block parameters

ParameterDescription
file_logging_enabled
 Boolean
 Optional
Enables writing to a log file.
Default value: false
console_logging_enabled
 Boolean
 Optional
Enables console message output.
Default value: true
timestamp_enabled
 Boolean
 Optional
Enables the timestamp prefix at the beginning of each log line. When false, each line starts directly with the message level, for example [info] ....
Default value: true
estimated_time_display_minutes
 Integer
 Optional
Interval, in minutes, between estimated time remaining updates in grid progress logs; set 0 to disable.
Default value: 5
logs_directory
 Text
 Optional
Absolute path to the directory where log files will be stored. The directory is created if it does not exist.
Default value: <results_directory>/<strategy name>
log_file_name
 Text
 Optional
Name of the log file.
Default value: If not provided, a name is generated from the strategy name and the execution date.
objective_limit
 Integer
 Optional
Maximum number of backtests to display for each objective.
Default value: 1
include_trades
 Boolean
 Optional
Displays the list of trades at the end of each backtest.
Default value: false
include_all_grid_parameters
 Boolean
 Optional
Logs every grid parameter, even when its range does not vary. When false, only grid parameters that vary are logged.
Default value: false
include_all_hyperparameters
 Boolean
 Optional
Logs every hyperparameter, even when its range does not vary. When false, only hyperparameters that vary are logged.
Default value: false
include_block_usage
 Boolean
 Optional
Includes the number of times each conditional block is executed. The counts are displayed in the final log.
Default value: false
trades_oldest_first
 Boolean
 Optional
Orders the “List of trades” table from the oldest to the newest when true. When false, orders it from the newest to the oldest to match TradingView ordering. This option only has an effect when include_trades is set to true.
Default value: false
include_strategy_toml
 Boolean
 Optional
When true, appends a verbatim copy of the loaded strategy TOML at the very end of the logs. Useful for archiving or reproducing runs. When false, the TOML is not printed.
Default value: false