OptimizationSettings
record cAlgo.API Since 5.9
DesktopCLICloud
Represents settings for configuring an optimization process.
Environment behaviour
CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.
Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.
Definition
public class OptimizationSettings
Namespace: cAlgo.API · Group: Optimization
Examples
var criteria = new[] { new OptimizationCriterion(OptimizationCriterionType.NetProfit, OptimizationCriterionDirection.Maximize) };
var settings = new OptimizationSettings(new DateTime(2025, 1, 1), new DateTime(2025, 3, 1), 10000, criteria)
{
DataMode = BacktestingDataMode.M1,
Method = OptimizationMethod.Genetic,
SpreadPips = 1,
Cores = 4,
AutoSelectBest = true
};
Print("Optimizing {0} to {1} with {2} cores", settings.StartTimeUtc, settings.EndTimeUtc, settings.Cores);
from System import DateTime
criteria = [OptimizationCriterion(OptimizationCriterionType.NetProfit, OptimizationCriterionDirection.Maximize)]
settings = OptimizationSettings(DateTime(2025, 1, 1), DateTime(2025, 3, 1), 10000, criteria)
settings.DataMode = BacktestingDataMode.M1
settings.Method = OptimizationMethod.Genetic
settings.SpreadPips = 1
settings.Cores = 4
settings.AutoSelectBest = True
api.Print(f"Optimizing {settings.StartTimeUtc} to {settings.EndTimeUtc} with {settings.Cores} cores")
Constructors
| Name | Description |
|---|---|
| OptimizationSettings 2 overloadsDesktopCLICloud | Initializes a new instance of the OptimizationSettings record. |
Properties
| Name | Description |
|---|---|
ApplyCommissionAutomaticallyDesktopCLICloudbool | Gets a value that indicates whether the commission type and value of the optimized symbol are applied automatically. When it is set to true the Commission and CommissionType properties are ignored. The default value is false. |
AutoSelectBestDesktopCLICloudbool | Gets a value indicating whether the best pass is auto-selected on completion. |
BalanceDesktopCLIClouddouble | Gets the initial balance for each pass. |
CommissionDesktopCLIClouddouble | Gets the commission value, it is interpreted based on the CommissionType property value. It is ignored when ApplyCommissionAutomatically is set to true. The default value is 0. |
CommissionTypeDesktopCLICloudSymbolCommissionType | Gets the commission type that defines how the Commission property value is interpreted. It is ignored when ApplyCommissionAutomatically is set to true. The default value is SymbolCommissionType.UsdPerMillionUsdVolume. |
CoresDesktopCLICloudint | Gets the number of CPU cores used to run passes in parallel. Must be greater than or equal to 1. Zero will use the platform default which is ProcessorCount / 2 + 1. |
CriteriaDesktopCLICloudIReadOnlyList<OptimizationCriterion> | Gets the standard optimization criteria. Ignored when OptimizationSettings.UseCustomFitness is true. |
DataFileDesktopCLICloudstring | Gets the path to the data file used for the optimization. |
DataModeDesktopCLICloudBacktestingDataMode | Gets the data mode used for the optimization. |
EndTimeUtcDesktopCLICloudDateTime | Gets the end time in UTC for the optimization period. |
MethodDesktopCLICloudOptimizationMethod | Gets the optimization method. Defaults to OptimizationMethod.Genetic. |
PreciseConversionDesktopCLICloudbool | Gets a value indicating whether historical data for additional symbols is downloaded to convert profit and margin into the account deposit currency precisely. When true, real historical exchange rates of the additional symbols are used; when false, the default, approximated rates are used. Enabling it can increase the run time and the amount of downloaded data. |
SpreadPipsDesktopCLIClouddouble | Gets the spread in pips. |
StartTimeUtcDesktopCLICloudDateTime | Gets the start time in UTC for the optimization period. |
UseCustomFitnessDesktopCLICloudbool | Gets a value indicating whether to use the cBot's custom GetFitness instead of OptimizationSettings.Criteria. |
Deprecated members (1)
public double CommissionUsdPerMillionUsd {get; set;}— Use Commission with CommissionType instead