Skip to content

VariableIndexDynamicAverage

interface cAlgo.API.Indicators

DesktopCLICloud

The Variable Index Dynamic Average (VIDYA) indicator is a type of moving average that dynamically adjusts its smoothing period based on market volatility.

Definition

public interface VariableIndexDynamicAverage

Namespace: cAlgo.API.Indicators · Group: Indicators · Implements: MovingAverage, StandardIndicator

Examples

private VariableIndexDynamicAverage _vidya;

protected override void OnStart()
{
    _vidya = Indicators.VariableIndexDynamicAverage(Bars.ClosePrices, 9, 12);
}

protected override void OnBar()
{
    if (Bars.ClosePrices.Last(1) > _vidya.Result.Last(1))
        Print("Close is above VIDYA: {0}", _vidya.Result.Last(1));
}
def on_start(self):
    self.vidya = api.Indicators.VariableIndexDynamicAverage(api.Bars.ClosePrices, 9, 12)

def on_bar(self):
    if api.Bars.ClosePrices.Last(1) > self.vidya.Result.Last(1):
        api.Print(f"Close is above VIDYA: {self.vidya.Result.Last(1)}")

Inherited members

From MovingAverage: Result

From StandardIndicator: AddToChart, Symbol, TimeFrame, Bars