# Accumulation/Distribution

ICE Data Services -

accDist() Built-in Study Functions

The Accumulation/Distribution study looks at both price and volume action to try and determine if more people are buying than selling or vice versa. When there are more buyers than sellers the stock is under accumulation, but when there are more sellers than buyers the stock is under distribution.

Syntax

accDist( [ sym() | inv() ][, nBarIndex ] )

Parameters

 Parameter: Description: Default: sym() or inv() [Optional]  Function of sym() or inv() to determine symbol/interval source for the study. Chart's sym/inv nBarIndex [Optional]   Bar index of series to retrieve . n/a

Return Value(s)

Returns a Series Object when nBarIndex is not specified.

Returns a single value when nBarIndex is specified.

Notes

Only available in versions 7.9 or later.

The accDist() built-in study function does not accept another built-in series or custom series as the source other than sym() or inv().

Code Examples

Single Line Indicator:
```function main() {
return accDist();
}```

Retrieve single values:
```function main() {
var nValue_0 = accDist(0); // Current Bar Index
var nValue_1 = accDist(-1); // Prior Bar Index
return new Array(nValue_0, nValue_1);
}```

Initialize a Series Object:
```var xStudy = null;
function main() {
if (xStudy == null) {
xStudy = accDist();
} // retrieve single values for conditional statements
var nValue_0 = xStudy.getValue(0); // Current Bar Index value
var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value
return nValue_0; // Plot Current Bar Index Value
}```

Initialize a Series Object based on an external interval:
```var xStudy = null;
var bInit = false; // Initialization flag
function main() {
if (bInit == false) {
xStudy = accDist(inv(20)); // 20-min interval
bInit = true;
} // retrieve single values for conditional statements
var nValue_0 = xStudy.getValue(0); // Current Bar Index value
var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value
return getSeries(xStudy); // Synchronized Series plot
}```

Initialize a Series Object based on an external symbol and interval:
```var xStudy = null;
var bInit = false; // Initialization flag
function main() {
if (bInit == false) {
xStudy = accDist(sym("IBM,20")); // IBM 20-min interval
bInit = true;
} // retrieve single values for conditional statements
var nValue_0 = xStudy.getValue(0); // Current Bar Index value
var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value
return getSeries(xStudy); // Synchronized Series plot
}```