ParameterAttribute


Summary

The Parameter Attribute class.

Remarks

Marks a property as input parameter.

Syntax

public class ParameterAttribute : Attribute

Members

NameTypeSummary
DefaultValue PropertyGets or sets the default value of this Parameter property.
Group PropertyGroups parameters in UI.
MaxValue PropertyGets or sets the maximum value of this Parameter property. It is used for validating user input.
MinValue PropertyGets or sets the minimum value of this Parameter property. It is used for validating user input.
Name PropertyThe input parameter name.
ParameterAttribute MethodInitializes a new ParameterAttribute instance and sets the name.
Step PropertyGets 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)
        {
        }
    }
}
Reference