Use Summation function to count them up.
It should be in your version if not here is the script , it's a general function.
'*******************************************************************
' TradersStudio(r) 2004-2007 , All rights reserved
'Description: Summation
' Adds all the values passed to in, also takes the [] syntax.
'********************************************************************
Function Summation(Price As BarArray, Length) as bararray
Dim Counter
Dim CSum As BarArray
Counter = 0
CSum = 0
CSum = 0
For Counter = 0 To Length - 1
CSum = CSum + Price[Counter]
Next
Summation = CSum
End Function