# Money Flow

ICE Data Services -

moneyFlow() Built-in Study Functions

The Money Flow Index (MFI) is a momentum indicator that measures the strength of money flowing in and out of a security. It is related to the Relative Strength Index (RSI) but whereas the RSI incorporates only prices, the MFI accounts for volume. Instead of using "up closes" versus "down closes," money flow compares the current interval's average price to the previous interval's average price and then weighs the average price by volume to calculate money flow. The ratio of the summed positive and negative money flows is then normalized to a scale of 0 to 100.

Syntax

moneyFlow( nLength [, sym() | inv() ][, nBarIndex ] )

Parameters

 Parameter: Description: Default: nLength Required. Number of periods to use for calculation. n/a sym() orinv() [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.

Code Examples

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

Retrieve single values:

```function main() {
var nValue_0 = moneyFlow(14, 0); // Current Bar Index
var nValue_1 = moneyFlow(14, -1); // Prior Bar Index
return new Array(nValue_0, nValue_1);
}```

Initialize a Series Object:
```var xStudy = null;
function main() {
if (xStudy == null) {
xStudy = moneyFlow(14);
} // 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 = moneyFlow(14, 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 = moneyFlow(14, 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
}```