Sum ( IDataHolder data , int length );
Default values:
length: 12
Description
Returns the sum of values for the specified number of bars. The default value of length
is 12
.
Input parameters
Parameter | Default value | Description |
---|---|---|
data | - | Defines values to be summed. |
length | 12 | Defines number of bars for which the values are summed. |
Example 1
declare lower;
plot data = Sum(close, 20);
The example displays a line that is the sum of the last 20 days' closing prices.
Example 2
plot data = Sum(close, 20)/20;
This example returns the sum of the last 20 days' closing prices divided by 20
. This value is called 20 day moving average.