Skip to content
The Casebook · A classic strategy

Buy at money flow index below 20, sell above 80

Buy when the 14-day money flow index drops below 20 and sell when it rises above 80.
VerdictTested Nov 22, 2026

Survivorship mirage

It clears the bar on today's winners, the stocks everyone wishes they had bought, but not on the laggards, which is where hindsight can't help.

  • It clears the bar on today's winners but not on the laggards: the winners' own rise did the work.
Trades on the laggards
589

42 large US stocks, 15 years

Per trade, after costs
+0.050R

Before costs +0.121R

Bar to clear
t > 2.01

By trade and by day, sized to a first try

What the numbers say

On the 22 laggards the idea averaged 0.050R per trade after costs across 589 trades, against 0.186 on today's winners. Its 0.334R in bear markets stands out (t 2.69), but bull markets came in at −0.035R and flat at 0.079R. The gap between winners and laggards points to the winners' own rise doing the work.

How it was tested

Go long at the close when the 14-day Money Flow Index falls below 20 and exit at the first close where it rises above 80.

Side
Long
Its own exit
Exit at the first close after entry where MFI(14) is above 80., checked at each close
Time limit
Exit at the close after 30 trading days, unless the stop, the target or its own exit comes first
Bar to clear
t > 2.01, by trade and by day, sized to a first try (one idea, tested once)
Prices
15 years of daily bars through 2026-11-20; judged 2026-11-22
Choices made where the idea was open
  • MFI uses the standard definition: typical price x volume as raw money flow, positive/negative flow summed over 14 days
  • Entry fires only on the day MFI first crosses below 20, not on every day it stays below
  • Idea gives no stop or target, so wide protective ones were chosen: 3 x ATR(14) stop, 6 x ATR(14) target
  • The 'sell when above 80' is treated as the exit of the long trade, not a short entry
  • Time limit set to the 30-day maximum since the idea has no time exit

The evidence

The laggards decide: 22 large stocks that lagged or fell, where hindsight can't flatter a rule. Today's winners sit beside them to show what survivorship would add.

MarketTradesPer tradet, by tradet, by dayRandom datesWinners, per trade
Bull346−0.035R−0.61−0.55 · 287d−0.054R · beats 70%+0.281R
Flat157+0.079R0.870.80 · 120d−0.043R · beats 100%−0.072R
Bear86+0.334R2.691.87 · 59d+0.070R · beats 100%+0.299R
All589+0.050R−0.033R+0.186R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 12.6 bps) plus 0.045R for the fills a real order wouldn't get. “By day” groups trades opened the same day, so a rule that fires on the same dates for every stock counts as a few events. “Random dates” places the same plan on random days of the same stocks in the same kind of market, 20 times; the idea must beat 95% of those draws.

The scanner we wroteShow the code
from decimal import Decimal

from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate


def _mfi(bars, end_idx, period):
    # MFI at bars[end_idx], using only bars up to end_idx.
    start = end_idx - period + 1
    if start < 1:
        return None
    pos = 0.0
    neg = 0.0
    prev_tp = (float(bars[start - 1].high) + float(bars[start - 1].low) + float(bars[start - 1].close)) / 3.0
    for j in range(start, end_idx + 1):
        b = bars[j]
        tp = (float(b.high) + float(b.low) + float(b.close)) / 3.0
        flow = tp * float(b.volume)
        if tp > prev_tp:
            pos += flow
        elif tp < prev_tp:
            neg += flow
        prev_tp = tp
    if neg == 0.0:
        if pos == 0.0:
            return 50.0
        return 100.0
    ratio = pos / neg
    return 100.0 - 100.0 / (1.0 + ratio)


class Mfi14OversoldBuyOverboughtExit:
    name = "mfi14_oversold_buy_overbought_exit"
    description = "Long when MFI(14) first falls below 20; exit at first close with MFI(14) above 80."

    def __init__(self, period: int = 14, oversold: float = 20.0, overbought: float = 80.0,
                 stop_atr: float = 3.0, target_atr: float = 6.0) -> None:
        self._period = period
        self._oversold = oversold
        self._overbought = overbought
        self._stop_atr = stop_atr
        self._target_atr = target_atr

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        if len(bars) < self._period + 16:
            return None
        last = len(bars) - 1
        mfi_now = _mfi(bars, last, self._period)
        mfi_prev = _mfi(bars, last - 1, self._period)
        if mfi_now is None or mfi_prev is None:
            return None
        if not (mfi_now < self._oversold and mfi_prev >= self._oversold):
            return None
        atr_val = atr(bars, 14)
        if atr_val is None:
            return None
        atr_dec = Decimal(str(atr_val))
        if atr_dec <= 0:
            return None
        entry = bars[-1].close
        stop = entry - Decimal(str(self._stop_atr)) * atr_dec
        target = entry + Decimal(str(self._target_atr)) * atr_dec
        if stop <= 0 or not (stop < entry < target):
            return None
        rr = (target - entry) / (entry - stop)
        return Candidate(
            ticker=ticker,
            side="buy",
            entry=entry,
            stop=stop,
            target=target,
            risk_reward_ratio=rr.quantize(Decimal("0.01")),
            signal_strength=50,
            thesis=f"MFI(14) fell below {self._oversold:.0f} (from {mfi_prev:.1f} to {mfi_now:.1f}); oversold mean-reversion long.",
        )

    def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal,
                 side: str, bars_held: int) -> bool:
        if side != "buy":
            return False
        if len(bars) < self._period + 1:
            return False
        m = _mfi(bars, len(bars) - 1, self._period)
        if m is None:
            return False
        return m > self._overbought

Hypothetical results from our own backtest of the rule as restated, on 42 large US stocks over 15 years. Past performance, real or simulated, does not predict future results. Research and education only; not investment advice.

Have an idea of your own?

Describe it in plain words and get the same honest test in about a minute.

Run the Gauntlet