void function() { int bar = iBarShift(_Symbol,PERIOD_CURRENT,anchor); for(int i =0;i<bar;i++) { double sumPV=0; double sumVol=0; for(int j=i;j<bar;j++) { double price = (iClose(_Symbol,PERIOD_CURRENT,j)+iHigh(_Symbol,PERIOD_CURRENT,j)+iLow(_Symbol,PERIOD_CURRENT,j))/3; double volume = iTickVolume(_Symbol,PERIOD_CURRENT,j)*1.0; sumPV += price*volume; sumVol+=volume; } vwap[i]= sumPV/sumVol; ChartRedraw(); } for(int i =bars;i<rates_total;i++) { vwap[i]= EMPTY_VALUE; } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello! trying to make a VWAP indicator that will update the data based on a anchor point that is movable. Like a vertical Line will appear on the chart and from that line towards candle 0, prices are updated and calculated corectly. The problem that I have is with printing that VWAP line on the chart. From the vertical line to right, everything is fine, the line is updated and printed correctly. But from that vertical line to the left, there I have a issue. It should not be printed anything on the left side of that vertical line. Please see the attached picture.