Skip to content

ParameterAttribute

Summary

The Parameter Attribute class.

Remarks

Marks a property as input parameter.

Signature

1
public class ParameterAttribute : Attribute

Namespace

cAlgo.API

Properties

Name Description
Name { get; } The input parameter name.
DefaultValue { get; set; } Gets or sets the default value of this Parameter property.
MinValue { get; set; } Gets or sets the minimum value of this Parameter property. It is used for validating user input.
MaxValue { get; set; } Gets or sets the maximum value of this Parameter property. It is used for validating user input.
Step { get; set; } Gets or sets the step of this Parameter. Step is used in NumericUpDown controls in parameter editors.
Group { get; set; } Groups parameters in UI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 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)
         {
         }
     }
 }

Last update: July 1, 2022

Comments