Money Flow |
Top Previous Next |
moneyFlow( length [, source | sym() | inv()] [, barIndex] )
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.
Parameters
To Create a Series
var myStudy = null; var bInit = false;
function main() { var myVar;
if ( bInit == false ) {
myStudy = moneyFlow( 20 ); bInit = true;
}
//retrieve the current value myVar = myStudy.getValue(0);
return( myVar );
}
To Retrieve a Single Value
function main() {
... ... myVar = moneyFlow( 14 );
//do something with the value in myVar
}
Calling Examples
//create a study that uses IBM as the symbol along with whatever bar //interval you are using in the chart where the script is loaded myStudy = moneyFlow( 15, sym( "IBM") );
//create a study that uses the 15-min bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = moneyFlow( 15, inv(15) );
//create a study that uses the Daily bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = moneyFlow( 5, inv("D") );
//create a study that will be based on MSFT 30-min bars, regardless of //the symbol/bar interval of the chart in which the script is loaded myStudy = moneyFlow( 14, sym( "MSFT,30" ) );
//create a study that will be based on the high. myStudy = moneyFlow( 15, high() );
//create a study that will be based on the close, using 15-min bars, regardless of //the bar interval of the chart in which the script is loaded myStudy = moneyFlow( 20, close( inv(15) ) );
|