Twiggs Money Flow

← strategies

Strategy

Methodology

This strategy is backtested on daily OHLCV price data across major US equity indices and ETFs. Entry and exit signals are generated from the strategy's indicators with no lookahead bias — trades execute at the open of the bar following the signal.

Performance metrics are computed per symbol and shown individually. The parameter optimization section (where available) runs a grid search over the strategy's key parameters, optimizing for Sharpe ratio. Transaction costs and slippage are not modeled.

The signal logic and indicator code for this strategy is shown in the methodology code section below.

Methodology

Twiggs Money Flow is a refined version of Chaikin Money Flow that uses true range instead of high-low range, reducing distortion from gaps. Enters long when TMF crosses above zero.

Implementation

class TwiggsMoneyFlow(Strategy):
    n = 21

    def init(self):
        h,l,c,v = pd.Series(self.data.High), pd.Series(self.data.Low), pd.Series(self.data.Close), pd.Series(self.data.Volume)
        tp = (h+l+c)/3
        mf = tp.diff() * v / (h-l).replace(0,1e-10)
        tmf = mf.rolling(self.n).sum() / (v*(h-l).replace(0,1e-10)).rolling(self.n).sum()
        self.tmf = self.I(lambda: tmf.fillna(0), name="TMF")

    def next(self):
        if self.tmf[-1] > 0 and self.tmf[-2] <= 0 and not self.position: self.buy()
        elif self.tmf[-1] < 0 and self.position: self.position.close()

Performance metrics

Total return+2.828%
Net profit$28,281
Gross profit$537,393
Gross loss$487,948
CAGR+0.538%
Annualized return+0.538%
Monthly average return+0.090%
Median monthly return+0.131%
Best month return+4.947%
Worst month return-8.525%
Rolling 1-month return+11.618%
Return per trade+0.139
Log return CAGR-0.808%
Compounded vs simple return difference-4.402%

Equity curves

Chart for symbol:

Charts & distributions

2024-10 → 2026-04 · 5-year daily data

Equity curve vs ^GSPC — buy/sell signals

Strategy equityIndex (normalized)▲ Buy▼ Sell

22 trades · green dashes = buy entries · red dashes = sell exits

Drawdown (underwater)

Rolling 1-month Sharpe

Rolling 1-month return (%)

Period return (≈ monthly)

Return distribution (bar returns)

MAE vs MFE (trades)

Rolling 12m Beta

Rolling 12m correlation

Monthly returns (run)

Performance Matrix

Total return+47.888%
Net profit$478,880
Gross profit$701,590
Gross loss$267,980
CAGR+12.487%
Annualized return+12.487%
Monthly average return+0.984%
Median monthly return+2.982%
Best month return+14.007%
Worst month return-16.636%
Rolling 1-month return+14.007%
Return per trade+1.800
Log return CAGR-0.741%
Compounded vs simple return difference-48.183%