Click or drag to resize

Step2. Create inherited class

Create inherited class

Then you need to choose what will be indicator’s value. There are two major options. Single floating point value (for example, like in moving averages) or number of named values (for example, like Low and High lines in band indicators). If you chose single value, your indicator should be inherited using double like generic parameter:

C#
1public class MyMovingAverage: BaseSimpleIndicator<double>
2{
3}

Else you need to specify custom Slice struct:

C#
1public class MyBandIndicator : BaseBarIndicator<MyBandIndicator.Slice>
2{
3    public struct Slice
4    {
5        public double LowLine;
6        public double HighLine;
7    }
8}

Note: If you want to create your own moving average class, you must choose single value option and add implementation of IAverager interface (just add to inheritance list, you do not need to do anything else), it allows you to use your indicator as averaging method in other indicators like Atr.

C#
1public class MyMovingAverage : BaseSimpleIndicator<double>, IAverager
2{
3
4}