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

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)
         {
         }
     }
 }

Properties

Name

Summary

The input parameter name.

Signature

1
public string Name {get;}

Return Value

string

Examples

1
2
3
4
5
 //...
 //The input parameter name is MaPeriod
 [Parameter("MaPeriod")]
 public int Period { get; set; }
 //...

DefaultValue

Summary

Gets or sets the default value of this Parameter property.

Signature

1
public object DefaultValue {get; set;}

Return Value

object

Examples

1
2
3
4
5
 //...
 //The value for Periods is fourteen
 [Parameter(DefaultValue = 14)]
 public int Periods { get; set; }
 //...

MinValue

Summary

Gets or sets the minimum value of this Parameter property. It is used for validating user input.

Signature

1
public object MinValue {get; set;}

Return Value

object

Examples

1
2
3
4
5
 //...
 //The minimum value the user can set Periods is five.
 [Parameter(DefaultValue = 14, MinValue = 5)]
 public int Periods { get; set; }
 //...

MaxValue

Summary

Gets or sets the maximum value of this Parameter property. It is used for validating user input.

Signature

1
public object MaxValue {get; set;}

Return Value

object

Examples

1
2
3
4
5
 //...
 //The maximum value the user can set Periods is twenty
 [Parameter(DefaultValue = 14, MaxValue = 20)]
 public int Periods { get; set; }
 //...

Step

Summary

Gets or sets the step of this Parameter. Step is used in NumericUpDown controls in parameter editors.

Signature

1
public double Step {get; set;}

Return Value

double

Group

Summary

Groups parameters in UI.

Signature

1
public string Group {get; set;}

Return Value

string