Strings and Enumerations. StrategyParameterString.

Strings and Enumerations. StrategyParameterString.

StrategyParameterString is a wrapper for enumerations and string values. We will explore where this parameter is located in OsEngine and how to use it.

Location in the GitHub Repository.

Location in the project when opened on a PC:

The class looks as follows:

Includes the following members:

StrategyParameterString - a public constructor with parameters. Initializes the initial state of the object. It takes a collection of strings that the user can choose from. Takes the following data:

name - the name for the instance;

value - the default value;

collection - a list of allowed values for the parameter;

tabName - the name of the tab where the parameter should be displayed;

StrategyParameterString - a public constructor with parameters. Initializes the initial state of the object. When using this constructor, any value can be entered for the parameter. Takes the following data:

name - the name for the instance;

value - the default value;

tabName - the name of the tab where the parameter should be displayed;

StrategyParameterString - a private parameterless constructor.

GetStringToSave - a public method. Returns a string with the parameter object settings for saving.

LoadParamFromString - a public method. Takes an array of strings with settings for the parameter and initializes the object's state.

Name - a public property of type string. Returns the displayed name of the parameter, which should be unique within the robot.

TabName - a public property of type string. Provides access to the name of the tab where the parameter will be displayed in the parameter window.

Type - a public property of type StrategyParameterType. Returns the value StrategyParameterType.String.

ValueString - a public property of type string. Gets or sets the current core value of the parameter. This is the value to be accessed from the robot code. This value is what the user selected in the interface.

ValuesString - a public property of type List<string>. Returns a list of values available for ValueString.

ValueChange - a public event. Signals a change in the ValueString value.

 

Example of usage.

You can check the technical examples inside the OsEngine project. For example, in CustomParamsUseBotSample:

Here the variable Regime is used to define the trading mode for the robot. It is created in the constructor:

Used as an additional exit point from the trading logic if the user selected Off:

View in interfaces.

In the robot's parameter window, this parameter is visible in a drop-down menu:

In the optimizer, it looks like this:

Successful algorithms!

If you have any difficulties or questions, please write to the support chat. Link