💬 Forum

MoneyFlowStrategy

🏆 League #1189 / 1936

mlsys-io/PortfolioBench/strategy/MoneyFlowStrategy.py · ★4 · ⑂5 · first seen 2026-07-16 · repo updated 2026-05-13

Basics mode: spot timeframe: 5m
Settings stoploss: -0.04 has minimal roi startup candle count: 20
Indicators EMA MFI RSI talib
15 related strategies ( identical code, similar name)

Each tile is a different kind of check — from an instant code lint to full sandboxed backtests and forward tests on recent data. Not sure what a check actually proves? See the FAQ →

Source

Download Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Strategy 10: Money Flow Index"""
import talib.abstract as ta
from freqtrade.strategy import IStrategy
from pandas import DataFrame


class MoneyFlowStrategy(IStrategy):
    timeframe = "5m"
    minimal_roi = {"0": 0.08, "120": 0.04}
    stoploss = -0.04
    startup_candle_count = 20

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe["mfi"] = ta.MFI(dataframe, timeperiod=14)
        dataframe["mfi_prev"] = dataframe["mfi"].shift(1)
        dataframe["ema50"] = ta.EMA(dataframe, timeperiod=50)
        dataframe["ema100"] = ta.EMA(dataframe, timeperiod=100)
        dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["mfi"] > 20) & (dataframe["mfi_prev"] <= 20)
            & (dataframe["ema50"] > dataframe["ema100"])
            & (dataframe["rsi"] < 65)
            & (dataframe["volume"] > 0),
            "enter_long",
        ] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["mfi"] > 80) | (dataframe["rsi"] > 72),
            "exit_long",
        ] = 1
        return dataframe