CheckParameters(parameters)
Brief
The request to check the parameters before changing the parameters on the fly.
Details
Since SDK 2.0 the strategy parameters may be changed without the restarting of the strategy instance. In order
to support this feature, the strategy must define two functions: CheckParameters
and
ChangeParameters()
.
The function is called to check whether the new parameter set may be applied.
Name |
Description |
|
The new set of the parameters to be applied. The method is an instance of
the |
The function must check whether the parameters may be applied and either:
error()
or assert()
lua function in case the
parameter set cannot be applied; orThe new parameter set is not applied until the ChangeParameters()
function is called. The current set of the parameters is available via the instance.parameters
property.
The parameters passed must not be stored.
CheckParameter and ChangeParameters example [hide]
function Init() ... strategy.parameters:addInteger("T", "Test", "", 14, 2, 1000); end local T; function Prepare(onlyName) instance:name(CheckParameters(instance.parameters)); T = instance.parameters.T; end function CheckParameters(params) assert(params.T >= 2, "T must be greater than 2"); return profile:id() .. "(" .. params.T .. ")"; end function ChangeParameters() Prepare(false); end function Update() ... end