Download MetaTrader 5

Adding volume

To add comments, please log in or register
Abraham
89
Abraham  

I'm trying to add volume in a function like this:

double vol(int o,int k,const long &tick_volume2[])
{

   for(int i=0;i<o;i++)
   {
   Buffer3[k] += (double) tick_volume2[k-o];
  
   }
   return(Buffer3[k]);
}


This works but the problem is that "+=" means that the active candle goes crazy. With every tick, the volume adds itself so the graph goes crazy rather than count all the ticks at the end of the candle.

Does anybody have any idea how to stabilize the live section of the graph?

Ilyas
1213
Ilyas  

Hint, you can write your function easier:)

return(Buffer3[k] += (double) tick_volume2[k-o] * o);
To add comments, please log in or register