Custom Averaging |
Some indicators take the input parameter of type IAverager. These indicators are Atr, Envelope, ForceIndex, Keltner, PriceOscillator, Rsi, and Stochastic. Each of these indicators uses averaging. If you want to use an averaging different from the default type, you can use these types of constructors.
We can, for instance, create an Atr indicator with custom averaging. By default, modified moving average (Mma) indicator is used for calculating Atr (see Atr formula). But we can assign a simple moving average (Sma) to it.
1// Create new instance with custom average 2Atr atr = new Atr(new Sma(10));
The following indicators can be used as averagers: Sma, Cma, Ema, Kama, Mma, Lsma.