The Parameter class represents a configurable parameter, and it most often used in C# Coded Models and custom indicators (derived from IndicatorBase). Each Parameter instance has a Name, a Type (see ParameterTypes in the Enums reference) and a default Value.
In C# Coded Models, Parameters are used to optimize a model. In these cases, the Parameter instances have their MinValue, MaxValue and StepValue properties defined to specify the optimization range.
In custom indicator development, the Parameters are used when an indicator is drag and dropped onto a chart or in a Building Block Model. The user can change the value of the Parameter using the user interface in Quantacula Studio or on the web site.
Returns the Parameter's Value as a BarHistory instance. This assumes the Parameter's Type is ParameterTypes.BarHistory.
Returns the Parameter's Value as a bool. This assumes the Parameter's Type is ParameterTypes.Boolean.
Returns the Parameter's Value as a System.Drawing.Color instance. This assumes the Parameter's Type is ParameterTypes.Color.
Returns the Parameter's Value as a System.Windows.Media.Color instance. This assumes the Parameter's Type is ParameterTypes.ColorWpf.
Returns the Parameter's Value as a floating point double. This assumes the Parameter's Type is ParameterTypes.Double.
Returns the Parameter's Value as a System.Drawing.Font instance. This assumes the Parameter's Type is ParameterTypes.Font.
Returns the Parameter's Value as a HistoryScale instance. This assumes the Parameter's Type is ParameterTypes.HistoryScale.
Returns the Parameter's Value as an int. This assumes the Parameter's Type is ParameterTypes.Int32.
Returns the Parameter's Value as a LineStylesV2 value (see Enums reference). This assumes the Parameter's Type is ParameterTypes.LineStyleV2.
Returns the Parameter's Value as a PriceComponents value (see Enums reference). This assumes the Parameter's Type is ParameterTypes.PriceComponent.
Returns the Parameter's Value as an string. This assumes the Parameter's Type is ParameterTypes.String.
Returns the Parameter's Value as a TimeSeries instance. This assumes the Parameter's Type is ParameterTypes.TimeSeries.
The Parameter class has two constructors. Both provide parameters to establish the Parameter's name, type, and initial value. The second constructor allows you to also specify a minValue and maxValue.
In a C# Coded Model, you generally do not have to create a Parameter instance directly using a constructor. Rather, use the AddParameter method provided by UserModelBase. Likewise, when coding custom indicators (descended from IndicatorBase), you can also use the AddParameter method rather than calling the constructor directly. These methods create the Parameter instance and then add it to appropriate list.
A list of strings that contains the possible values the Parameter can assume. This comes into play of the Parameter Type is ParameterTypes.StringChoice. When using this parameter type, add the desired string values to the Parameter instance's Choices property.
The DefaultValue property contains the initial value that was established when the Parameter instance was created. The Value property, on the other hand, can be changed either via optimization, or by a change from a user in the user interface.
Contains the Parameter's maximum value, for optimization purposes.
Contains the Parameter's minimum value, for optimization purposes.
The descriptive name of the Parameter.
Contains the Parameter's increment, or step, value, for optimization purposes. An optimization will test parameter values starting at MinValue, going to MaxValue, in increments of StepValue.
The type of data that the Parameter's Value property contains. See the Enums reference for a list of possible ParameterTypes.
The current value of the Parameter. See the Enums reference for a list of possible ParameterTypes.