// Downloaded From https://www.WiseStockTrader.com
/* eVWMA - Elastic Volume Weighted Moving Average */

/* Elastic Volume Weighted Moving Average by Christian B. Fries */
function eVWMA(array, N)
{
  result[0] = array[0];
  for (i = 1; i < BarCount; i++) 
  {
    result[i] = ((N - Volume[i]) * result[i - 1] + Volume[i] * array[i]) / N;
  }
  return result;
}

P = ParamField("Price field", -1);
N = Param("Number of shares mult", 1, -100, 100, 0.1, 10);
Plot(eVWMA(P, 10^(N / 100) * LastValue(Highest(Volume))), _DEFAULT_NAME(), ParamColor("Color", colorCycle), ParamStyle("Style"));