Summary
The Parameter Attribute class.
Remarks
Marks a property as input parameter.
Syntax
public class ParameterAttribute : Attribute
Members
Name | Type | Summary |
---|---|---|
DefaultValue | Property | Gets or sets the default value of this Parameter property. |
Group | Property | Groups parameters in UI. |
MaxValue | Property | Gets or sets the maximum value of this Parameter property. It is used for validating user input. |
MinValue | Property | Gets or sets the minimum value of this Parameter property. It is used for validating user input. |
Name | Property | The input parameter name. |
ParameterAttribute | Method | Initializes a new ParameterAttribute instance and sets the name. |
Step | Property | Gets or sets the step of this Parameter. Step is used in NumericUpDown controls in parameter editors. |
Example 1
using cAlgo.API; namespace cAlgo { // This sample indicator shows how to define different types of parameters for your indicators [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class ParameterAttributreSample : Indicator { [Parameter("First Parameter Name", DefaultValue = 0.0, MinValue = 0, MaxValue = 10, Step = 1, Group = "Numeric Group")] public double FirstNumericParameter { get; set; } [Parameter("Second Parameter Name", DefaultValue = 0.0, MinValue = 0, MaxValue = 100, Step = 1, Group = "Numeric Group")] public int SecondNumericParameter { get; set; } [Parameter("First Parameter Name", DefaultValue = "Default value", Group = "String Group")] public string FirstStringParameter { get; set; } [Parameter("Second Parameter Name", DefaultValue = "Default value", Group = "String Group")] public string SecondStringParameter { get; set; } [Parameter("First Parameter Name", DefaultValue = TradeType.Buy, Group = "Enum Group")] public TradeType FirstEnumParameter { get; set; } [Parameter("Second Parameter Name", DefaultValue = TradeType.Sell, Group = "Enum Group")] public TradeType SecondEnumParameter { get; set; } protected override void Initialize() { } public override void Calculate(int index) { } } }