Cumulative sum function missing in mql4? Need help to code it.

 
Since there is no cum() function in mql4, I need help to know how to code a function "cum()" that I can use for my code.

I need it for my cumdelta variable "cum(delta)".

void OnTick()
  {
//---
      tw = High[0] - fmax(Open[0], Close[0]);
      bw = fmin(Open[0], Close[0]) - Low[0];
      body = fabs(Close[0] - Open[0]);
      
      deltaup =  Volume[0] * _rate(Open[0] <= Close[0]);
      deltadown = Volume[0] * _rate(Open[0] > Close[0]);
      delta = Close[0] >= Open[0] ? deltaup : -deltadown;
      cumdelta = cum(delta);
      
      o = cumdelta[1];
      h = max(cumdelta, cumdelta[1]);
      l = min(cumdelta, cumdelta[1]);
      c = cumdelta;
   
  }

I have found something on google and this is what I want but I'm not sure how to transform it into mql4.
I don't know what is series.Length and series[bars] is in mql4. I guess series.Length is total number of bars so I must use "Bars". 

for (int bar = 0; bar < series.Length; bar++)
        {
            cum += series[bar];
            return cum;
        }


 
      cumdelta = cum(delta);
      
      o = cumdelta[1];

Does not look like an array has been declared

 
vetador:
Since there is no cum() function in mql4, I need help to know how to code a function "cum()" that I can use for my code.

I need it for my cumdelta variable "cum(delta)".


I have found something on google and this is what I want but I'm not sure how to transform it into mql4.
I don't know what is series.Length and series[bars] is in mql4. I guess series.Length is total number of bars so I must use "Bars". 



Total cumulative ? 

You could add a + in front of the = 

cumdelta += delta;
 
Lorentzos Roussos #:

Total cumulative ? 

You could add a + in front of the = 

When I do that, it give me EMPTY VALUE since the first value is empty.

I tried that and it work:

if (cumdelta1 <= 214700000)
      {
         cumdelta1 += delta[i];
         cumdelta[i] = cumdelta1;
      }
      else
      {
         cumdelta1 = delta[i];
         cumdelta[i] = cumdelta1;
      }
 
vetador #:

When I do that, it give me EMPTY VALUE since the first value is empty.

I tried that and it work:

Nice work 

Reason: