External indicator parameters

In order to be able to change one or another parameter in the indicator, it should be realized in the form of a property:

public int Period {get;set;}

In order for the indicator to recalculate when the property changes, it is necessary to call the RecalculateValues() method.

private int _size = 10;
public int Size
   {
       get { return _size; }
       set
       {
           _size = value;
           RecalculateValues();
       }
   }

The Display attribute, where the displayed name and category and the property sequence number are specified, could be set for every property. This attribute is located in System.ComponentModel.DataAnnotations.

public class SampleIndicator : Indicator
{
    [Display(GroupName = "GroupName", Name = "PropertyName", Order = 10)]
    public int Type { get; set; }
   
    protected override void OnCalculate(int bar, decimal value)
    {
    }
}

This article was helpful for 1 person. Is this article helpful for you?