Skip to content

ParameterAttribute

class cAlgo.API

DesktopCLICloud

The Parameter Attribute class.

Definition

public class ParameterAttribute : Attribute

Namespace: cAlgo.API · Group: Attributes

Remarks

Marks a property as input parameter.

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to define different types of parameters for your indicators
    public partial class ParameterAttributeSample : Indicator
    {
        protected override void Initialize()
        {
            Print("Periods: {0}, Multiplier: {1}, Label: {2}, Direction: {3}", Periods, Multiplier, Label, Direction);
        }

        public override void Calculate(int index)
        {
        }
    }
}
class ParameterAttributeSample():
    def initialize(self):
        api.Print(f"Periods: {api.Periods}, Multiplier: {api.Multiplier}, Label: {api.Label}, Direction: {api.Direction}")
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "Periods",
      "Type": "Integer",
      "DefaultValue": 14,
      "MinValue": 2,
      "MaxValue": 100,
      "Step": 1,
      "Group": "Numeric Group"
    },
    {
      "Name": "Multiplier",
      "Type": "Double",
      "DefaultValue": 1.5,
      "MinValue": 0.1,
      "MaxValue": 10,
      "Step": 0.1,
      "Group": "Numeric Group"
    },
    {
      "Name": "Label",
      "Type": "String",
      "DefaultValue": "myLabel",
      "Group": "String Group"
    },
    {
      "Name": "Direction",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.TradeType",
      "DefaultValue": "Buy",
      "Group": "Enum Group"
    }
  ]
}

Constructors

Name Description
ParameterAttribute 2 overloadsDesktopCLICloud Initializes a new ParameterAttribute instance and sets the name.

Properties

Name Description
DefaultValueDesktopCLICloudobject Gets or sets the default value of this Parameter property.
DescriptionDesktopCLICloudstring Gets or sets description for input parameter that will be shown in UI.
GroupDesktopCLICloudstring Groups parameters in UI.
IsValueVisibleInTitleDesktopCLICloudbool Gets or sets whether parameter value should be visible or not in instance title (default: true).
MaxValueDesktopCLICloudobject Gets or sets the maximum value of this Parameter property. It is used for validating user input.
MinValueDesktopCLICloudobject Gets or sets the minimum value of this Parameter property. It is used for validating user input.
NameDesktopCLICloudstring The input parameter name.
StepDesktopCLIClouddouble Gets or sets the step of this Parameter. Step is used in NumericUpDown controls in parameter editors.