MoneyFlow

MoneyFlow ( IDataHolder high , IDataHolder close , IDataHolder low , IDataHolder volume , int length );

Default values:

length: 12

Description

Returns the money flow value.

Input parameters

Parameter Default value Description
high - Defines the High price to be used in calculation.
close - Defines the Close price to be used in calculation.
low - Defines the Low price to be used in calculation.
volume - Defines the volume to be used in calculation.
length 12 Defines the period on which the money flow value is calculated.

Example

script moneyflowTS {
input high = high;
input close = close;
input low = low;
input volume = volume;
input length = 14;
def price = high + close + low;
def moneyFlow = price * volume;
def positiveMoneyFlow = Sum(if price >price[1] then MoneyFlow else 0, length);
def totalMoneyFlow = Sum(MoneyFlow, length);
plot moneyflowTS = if totalMoneyFlow != 0 then 100 * positiveMoneyFlow / totalMoneyFlow else 0;
}

declare lower;
input length = 14;
plot moneyflow1 = MoneyFlow(high, close, low, volume, length);
plot moneyflow2 = MoneyFlowTS(high, close, low, volume, length);

In this example the money flow is calculated and plotted based on two different implementations that have equal results. The first implementation is based on the moneflowTS function, the second one is based on the built-in MoneyFlow function.