Freqtrade Strategy

Diamond

5m candlesHyperopt-generatedSpot, long only

Tested 1 Jun 2023 – 30 May 2025
Rank 14 of 27 by return

Diamond turned $1,000 into $837 (−16.3%) over 729 days, while holding Bitcoin returned +288.1% and an equal mix of the ten coins +194.8%. Its worst drawdown was 27.4%, a substantial dip to sit through. With a 67% win rate and a profit factor of 0.75, losses outweighed gains.

Diamond account balance compared with holding Bitcoin$0$1,000$2,000$3,000$4,000JulOctJan 2024AprJulOctJan 2025AprDiamond $837BTC hold $3,880
Account balance from $1,000 (closed trades, daily). Dashed line: $1,000 held in BTC over the same days.
Total return−16.3%$837 final balance
Max drawdown27.4%11 Apr 2024 to 9 Apr 2025
Win rate67.2%480 wins / 234 losses
Profit factor0.75Gross wins ÷ gross losses
Trades7141.0 per day
Average trade−0.11%after fees
Average hold1d 20hwinners 19h 23m, losers 3d 23h
Annualised (CAGR)−8.5%Sharpe -0.60 · Sortino -0.36

How Diamond trades

Diamond was produced by hyperparameter optimisation rather than designed by hand. Its tuned entry compares the candle high from seven bars ago with the current volume multiplied by 0.942, and its exit compares an older high with the current low. A stepped take-profit and a trailing stop do the rest.

Comparing a price to a volume figure has no market logic behind it; the rule exists because it fitted past data. Treat Diamond as an example of what over-fitted strategies look like, not as a trading idea.

Rules at a glance

Indicators
Shifted price vs. volume comparison
Take-profit (minimal ROI)
24.2% from entry; 4.4% after 13m; 2% after 51m; 0% after 2h 50m
Stoploss
−27.1%
Trailing stop
Trails 1.1% behind the high once profit passes 5.4%
Exit signal
Used

Results by month

Profit or loss in USDT for trades closed in each month.

JFMAMJJASOND2023-47+15+0+0+0+9+152024+11+31+28-35+13+25-57-52+4-0+67+162025-50-144-21-27+36

Results by coin

PairTradesWin rateProfit (USDT)Avg. hold
LINK/USDT333.3%+2.158h 47m
AVAX/USDT757.1%+0.443d 23h
BTC/USDT00.0%0.000:00
XRP/USDT00.0%0.000:00
ADA/USDT00.0%0.000:00
DOGE/USDT00.0%0.000:00
DOT/USDT00.0%0.000:00
SOL/USDT10.0%−0.036h 10m
BNB/USDT31169.5%−22.501d 21h
ETH/USDT39266.1%−142.921d 18h

Why trades closed

Exit reasonTradesWin rateProfit (USDT)
Take-profit (ROI)70068.6%+500.11
Still open at end of test20.0%−14.56
Stoploss20.0%−109.07
Trailing stop100.0%−539.36

The code

Diamond comes from the community freqtrade-strategies repository (GPL-3.0). These are the parts that decide when it trades; the full file is 155 lines.

Entry rules
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
    conditions = []
    conditions.append(
        qtpylib.crossed_above
        (
            dataframe[self.buy_fast_key.value].shift(self.buy_horizontal_push.value),
            dataframe[self.buy_slow_key.value] * self.buy_vertical_push.value
        )
    )

    if conditions:
        dataframe.loc[
            reduce(lambda x, y: x & y, conditions),
            'enter_long']=1

    return dataframe
Exit rules
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
    conditions = []
    conditions.append(
        qtpylib.crossed_below
        (
            dataframe[self.sell_fast_key.value].shift(self.sell_horizontal_push.value),
            dataframe[self.sell_slow_key.value] * self.sell_vertical_push.value
        )
    )
    if conditions:
        dataframe.loc[
            reduce(lambda x, y: x & y, conditions),
            'exit_long']=1
    return dataframe
Indicators
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
    # you can add new indicators and enable them inside
    # hyperoptable categorical params on the top
    # dataframe['ma_fast'] = ta.SMA(dataframe, timeperiod=9)
    # dataframe['ma_slow'] = ta.SMA(dataframe, timeperiod=18)
    # dataframe['{...}'] = ta.{...}(dataframe, timeperiod={...})
    return dataframe

Reproduce this test

With freqtrade installed (see our Docker guide), download the data and run the same backtest:

freqtrade download-data --exchange binance --pairs ADA/USDT AVAX/USDT BNB/USDT BTC/USDT DOGE/USDT DOT/USDT ETH/USDT LINK/USDT SOL/USDT XRP/USDT --timeframes 5m --timerange 20230501-20250530
freqtrade backtesting --strategy Diamond --timeframe 5m \
  --timerange 20230601-20250530 --dry-run-wallet 1000 --stake-amount 200 --max-open-trades 5 --fee 0.001

Results can differ slightly with a different data source or freqtrade version. See how we test.