Your interactive trading laboratory!
 • 
30 users online

Quantacula Help

How-To
C# API Reference
Extensions
Development Blog
API-Extensions
Indicator Spotlights

QCommunity Extensions
The open-source GitHub repository of source code for the QCommunity Extensions library. Contains indicators and other extensions submitted by the Quantacula Community. Look for QCommunity indicators when you create a Building Block model, mark the "QCommunity" library check box to expose them.

TASC-Extensions
The open-source GitHub repository of source code for the TASCExtensions Quantacula extension. Contains indicators and other extensions adapted from the Traders' Tips articles in Technical Analysis of Stocks & Commodities magazine.
Parameter
Namespace: Quantacula.Core
Parent: Object

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.

AsType Helper Properties

AsBarHistory
public BarHistory AsBarHistory

Returns the Parameter's Value as a BarHistory instance. This assumes the Parameter's Type is ParameterTypes.BarHistory.


AsBoolean
public bool AsBoolean

Returns the Parameter's Value as a bool. This assumes the Parameter's Type is ParameterTypes.Boolean.


AsColor
public Color AsColor

Returns the Parameter's Value as a System.Drawing.Color instance. This assumes the Parameter's Type is ParameterTypes.Color.


AsColorWpf
public System.Windows.Media.Color AsColorWpf

Returns the Parameter's Value as a System.Windows.Media.Color instance. This assumes the Parameter's Type is ParameterTypes.ColorWpf.


AsDouble
public double AsDouble

Returns the Parameter's Value as a floating point double. This assumes the Parameter's Type is ParameterTypes.Double.


AsFont
public Font AsFont

Returns the Parameter's Value as a System.Drawing.Font instance. This assumes the Parameter's Type is ParameterTypes.Font.


AsHistoryScale
public HistoryScale AsHistoryScale

Returns the Parameter's Value as a HistoryScale instance. This assumes the Parameter's Type is ParameterTypes.HistoryScale.


AsInt
public int AsInt

Returns the Parameter's Value as an int. This assumes the Parameter's Type is ParameterTypes.Int32.


AsLineStyleV2
public LineStylesV2 AsLineStyleV2

Returns the Parameter's Value as a LineStylesV2 value (see Enums reference). This assumes the Parameter's Type is ParameterTypes.LineStyleV2.


AsPriceComponent
public PriceComponents AsPriceComponent

Returns the Parameter's Value as a PriceComponents value (see Enums reference). This assumes the Parameter's Type is ParameterTypes.PriceComponent.


AsString
public string AsString

Returns the Parameter's Value as an string. This assumes the Parameter's Type is ParameterTypes.String.


AsTimeSeries
public TimeSeries AsTimeSeries

Returns the Parameter's Value as a TimeSeries instance. This assumes the Parameter's Type is ParameterTypes.TimeSeries.



Constructor

Parameter
public Parameter(string name, ParameterTypes type, object value)
public Parameter(string name, ParameterTypes type, object value, double minValue, double maxValue)

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.



Members

Choices
public List<string> Choices

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.


DefaultValue
public object DefaultValue

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.


MaxValue
public double MaxValue

Contains the Parameter's maximum value, for optimization purposes.


MinValue
public double MinValue

Contains the Parameter's minimum value, for optimization purposes.


Name
public string Name

The descriptive name of the Parameter.


StepValue
public double StepValue

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.


Type
public ParameterTypes Type

The type of data that the Parameter's Value property contains. See the Enums reference for a list of possible ParameterTypes.


Value
public object Value

The current value of the Parameter. See the Enums reference for a list of possible ParameterTypes.