April 10

# Unlock the Power of the Money Flow Indicator

By Jeff Swanson

April 10, 2023

EasyLanguage

The Money Flow Indicator is a technical analysis tool used in trading that is available on the TradeStation platform. It's a momentum oscillator that compares negative and positive money flow values to create an output ratio between 0 and 100. The MFI is calculated using a formula considering price and volume data.

Money Flow is a way to measure whether people are buying or selling a stock, or other investment. It looks at the investment's price and how much was purchased (volume) or sold in a certain period. If the price increases, the Money Flow is considered positive. But if the price goes down, the Money Flow is considered negative.

Using both price and volume provides a different perspective from price or volume alone. The Money Flow indicator shows dramatic oscillations and can help identify overbought and oversold conditions.

## How is It Calculated?

Money Flow is a technical indicator used in trading to measure the strength of buying or selling pressure in a security.

Money flow uses the average price, derived from the high, low, and closing prices divided by three. This is also known as the typical price (TP).

TP = ( High + Low + Close )

Positive Money Flow (PMF) is calculated and summed for each of the last X number of bars with an average price greater than the previous bar and then divided by the Money Flow for all the bars specified in Length.

if ( TP > TP[1] ) then
MyMFSum = MyMFSum + ( TP * Volume )
AllMFSum = AllMFSum + ( TP * Volume )

Suppose the typical price of the current period is higher than that of the previous period. In that case, the resulting Money Flow value is considered positive and added to a sum (MyMFSum).

Conversely, suppose the typical price of the current period is lower than that of the previous period. In that case, the resulting Money Flow value is considered negative. In this case, the value is not added to the MyMFSum.

In other words, Money Flow compares the current period's typical price to the previous period's typical price to determine whether money flows into or out of the security has increased or decreased.

## Building the Ratio

Once we have the sum of all the positive money flow values (MyMFSum), we create a ratio using the sum of all money flows in the denominator.

Money Flow Indicator = MyMFSum / AllMFSum * 100

So if we use the money flow index with a 10-period setting, we'll first get the sum of all positive money flow values for the past 10 days and divide it by the sum of all money flow values for the past 10 days.

Traders can use Money Flow with other technical indicators and analysis tools to identify potential trading opportunities and confirm price trends. By monitoring changes in the Money Flow, traders can gain insight into the sentiment of other market participants and adjust their strategies accordingly.

## Using Money Flow to Generate Trading Signals

Traditionally, you can use Money Flow values above 80 and below 20 as a trigger.

For example, if the Money Flow falls below 80, you may take this as a short signal. If the Money Flow rises below 20, you may take this as a long signal. See the image below.

But this is one interpretation. Here is another way to think about it. Go long when the Money Flow rises above 80 and short when it falls below 20. See the image below.

However, these are not all possibilities. If you think about it, you can have various combinations of entry signals based on the upper and lower thresholds of the Money Flow Indicator. We could also introduce a midpoint value (50) that can act as a trigger.

• buy entering the overbought region
• buy leaving the overbought region
• buy crossing above the midpoint (50)

I would classify these signals as momentum trades. The Money Flow is at the higher end of its range, and we're going long.

On the other hand, we could fade these values.

• buy entering the oversold region
• buy leaving the oversold region
• buy crossing below Midline (5)

How do we know which triggers to test? The answer is we don't. Thus we code up all of these into a switch statement using EasyLanguage. We then use TradeStation's optimization features to iterate over different buy/sell signal combinations to see which produces better performance.

## The Money Flow Strategy

Below is the testing strategy to determine which buy/sell signals work best.

Input:
iSellType(1),
iLookback(10);

vars:
MyMoneyFlow(0),
Oversold(20),
Midline(50),
Overbought(80);

MyMoneyFlow = MoneyFlow( iLookback );

Begin
Case 1:
if MyMoneyFlow Crosses above Overbought then buy next bar at market;
Case 2:
if MyMoneyFlow Crosses below Overbought then buy next bar at market;
Case 3:
if MyMoneyFlow Crosses above Midline then buy next bar at market;
Case 4:
if MyMoneyFlow Crosses below OverSold then buy next bar at market;
Case 5:
if MyMoneyFlow Crosses above OverSold then buy next bar at market;
Case 6:
if MyMoneyFlow Crosses below Midline then buy next bar at market;
Default:
End;

Switch( iSellType )
Begin
Case 1:
if MyMoneyFlow Crosses above Overbought then Sellshort next bar at market;
Case 2:
if MyMoneyFlow Crosses below Overbought then Sellshort next bar at market;
Case 3:
if MyMoneyFlow Crosses above Midline then Sellshort next bar at market;
Case 4:
if MyMoneyFlow Crosses below OverSold then Sellshort next bar at market;
Case 5:
if MyMoneyFlow Crosses above OverSold then Sellshort next bar at market;
Case 6:
if MyMoneyFlow Crosses below Midline then Sellshort next bar at market;
Default:
Print("Invalid iSellType Value");
End;

## Testing Environment

Before getting into the details of the results, let me say this: Unless otherwise stated, all the tests within this article are going to use the following assumptions:

• Starting account size of \$100,000
• In-sample dates are from 2006 through December 2020
• Commissions & Slippage were not deducted
• One contract was traded per signal
• Overbought Threshold 80
• Oversold Threshold 20
• Midline Threshold 50

## Testing Money Flow Heating Oil

I can now load my testing strategy onto a daily Heating Oil (@HO) chart and test it. I will optimize to input values. First, the Buy Type with values between 1-6. Next, the Sell Type with values 1-6. This will produce 36 different tests.

I organized the performance results by Perfect Profit Correlation, which measures the straightness of the equity curve. The best-performing settings for Heating Oil were Buy Type 6 and Sell Type 4.

Looking at the code for these input values...

• Go long when the Money Flow crosses below the Midline.
• Go short when the Money Flow crosses below the oversold region.

Here is an image of the Money Flow signals on the Heating Oil chart.

Below are the equity curve and performance report.

Nice! We found a potential starting point for a viable trading system. TradeStation recently released a micro contract for Heating Oil. Trading a daily system based around Money Flow may work.

## Summary

In this article, I've explored the Money Flow Indicator, a technical analysis tool used in trading to measure the strength of buying or selling pressure in a security. Considering price and volume data, the Money Flow Indicator can help identify overbought and oversold conditions, providing traders with valuable insights into market sentiment. I've developed a testing strategy with various entry and exit triggers based on the Money Flow Indicator and tested it on the Heating Oil futures contract.

## Conclusion

The testing strategy I've presented demonstrates that the Money Flow Indicator can effectively generate trading signals. By optimizing input values and examining various buy/sell signal combinations, traders can find the best-performing settings for their specific market. In the case of Heating Oil, going long when the Money Flow crosses below the Midline and going short when it crosses below the oversold region produced the best results.

Note this strategy is a testing strategy, not a complete trading system! The strategy is not for live trading but for helping you locate the best entry and exit triggers on the Money Flow Indicator. If you want to learn more about building trading systems, check out the article, How to Build Profitable Trading Systems.

To make this a complete strategy, you would need to add a stop value, test different filters, and then put the strategy through a validation process.

Jeff Swanson