cumsum

Category: Instructions

The cumsum function in ProBuilder language is used to calculate the cumulative sum of a given price or data series over the entire range of data loaded in the chart. This function is particularly useful for analyzing the total accumulated value of a data series up to each point in time.

Syntax:

cumsum(price)

Example:

Suppose you want to calculate the cumulative sum of the closing prices of a stock. You can use the cumsum function as follows:

cumulativeClose = cumsum(close)

This code will create a new variable cumulativeClose that stores the cumulative sum of the closing prices from the start of the data to the current bar.

Additional Information:

  • The cumsum function is essential for creating running totals, which can be useful in various financial analysis scenarios, such as calculating running costs, revenues, or other cumulative metrics over time.
  • It is important to note that the cumulative sum will reset if the data series is restarted or if there is a break in the data.

Understanding the use of the cumsum function can help in creating more dynamic and informative financial indicators and models within the ProBuilder environment.

Logo Logo
Loading...