Accumulation Function - ACC()

Author: Optuma Team Last updated: Jul 2, 2021 14:06

This Accumulation function ACC() can be used to sum values over a specified period. It can also be used to count the number of times a true/false boolean signal has occurred. For example, to calculate the cumulative volume over the last 10 days nest the VOL() function within the ACC(). Click on the ACC() script text to set the lookback type and amount - in this case 10 bars.


ACC(VOL(), RANGE=Look Back Period, BARS=10)

In the following example, variable H1 calculates new highest highs over the last 52 weeks, which is then nested in the ACC() function to count the number of new highs over the last 6 months:

ACC(H1, RANGE=Look Back Period, BACKTYPE=Months, BARS=6)

Here’s the formula added to a Show View and a Watchlist column, showing that WWE has had 55 new highs over the last months.


Accumulation from a Specific Date

From Optuma 2.0 and later, the ACC() function includes the option of setting a specific date to start the accumulation count from.

In the following example the script is looking for each 25EMA crossing above a 50EMA since the 1st of January 2008.

V1 = MA(BARS=25, STYLE=Exponential) ;  
V2 = MA(BARS=50, STYLE=Exponential) ;  
V3 = V1 CrossesAbove V2 ;  
ACC(V3,RANGE=Look Back Period, BACKTYPE=Date, STARTDATE=2008-01-01)

Here is how it would look on a chart:


You can see the accumulation count only begins once it has passed the 1st of January 2008.