/* Reset variables - new Session */
if (isNewTradingSession() = true)
{
weightedPriceSum = 0;
volumeSum = 0;
}
/* The running intraday summations */
volumeSum = volumeSum + getVolume();
weightedPriceSum = weightedPriceSum + getPrice() * getVolume();
/* The main calc */
if (volumeSum != 0)
{
VWAP = weightedPriceSum / volumeSum;
}