It looks like you're new here. If you want to get involved, click one of these buttons!
public double getVwap(double[] close, long[] volume){
double vwap = 0.0;
long totVol = 0;
try{
for(int i=close.length-2 ; i>(close.length-22); i--){
double closePr = close[i];
long vol = volume[i];
totVol=totVol+vol;
vwap = vwap+(closePr*vol);
}
vwap = vwap/totVol;
}catch(Exception e){
e.printStackTrace();
}
return vwap;
}
Ur calculation need to start from first candle of the day ..