Пример:
Исходный текст:
Код: Выделить всё
function Initialize()
{
  IndicatorName = "VWMA";   
  PriceStudy = true;   
  AddInput("Input", Inputs.Candle);   
  AddSeries("VWMA", DrawAs.Line, Color.Red);   
  AddParameter("Period", 20, 1);   
}
function Evaluate()
{
// AlfaDirect. 2015. OX
// VWMA (VWMA – Volume-WEIGHTED MOVING AVERAGE) - ВЗВЕШЕННАЯ по объему СКОЛЬЗЯЩАЯ СРЕДНЯЯ  
 var cWMA = 0.0;
 var cZn = 0.0; 
 for ( var i=0; i<Period; i++ )
 {     cWMA = cWMA + Input.Close[-i]*Input.Volume[-i];
     cZn = cZn + Input.Volume[-i];
 } 
 VWMA = cWMA/cZn;
}



