/// Calculation entry point. This function is called when a price data updates.
protected override void OnUpdate(UpdateArgs args)
// Checking, if current amount of bars
// more, than period of moving average. If it is true
// then the calculation is possible
double sum = 0.0; // Sum of prices
for (int i = 0; i < Period; i++)
// Adding bar's price to the sum
sum += GetPrice(PriceType.Close, i);
// Set value to the "SMA" line buffer.