💬 Forum

hansencandlepatternV1

freqle/uploads/user-90abf0da8f3178f3/hansencandlepatternV1_converted.py · first seen 2026-07-28

Basics mode: spot timeframe: 1h interface version: 3
Settings stoploss: -0.1 has minimal roi
Indicators SMA talib
8 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
37
38
39
40
41
42
from freqtrade.strategy.interface import IStrategy
from typing import Dict, List
from functools import reduce
from pandas import DataFrame
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
from typing import Dict, List
from functools import reduce
from pandas import DataFrame, DatetimeIndex, merge
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy  # noqa

class hansencandlepatternV1(IStrategy):
    INTERFACE_VERSION = 3
    '\n        This strategy is only an experiment using candlestick pattern to be used as buy or sell indicator. Do not use this strategy live.\n    '
    timeframe = '1h'
    minimal_roi = {'0': 10}
    stoploss = -0.1

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['3LINESTRIKE'] = ta.CDL3LINESTRIKE(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['EVENINGSTAR'] = ta.CDLEVENINGSTAR(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['ABANDONEDBABY'] = ta.CDLEVENINGSTAR(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['HARAMI'] = ta.CDLHARAMI(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['INVERTEDHAMMER'] = ta.CDLINVERTEDHAMMER(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['ENGULFING'] = ta.CDLENGULFING(dataframe['open'], dataframe['high'], dataframe['low'], dataframe['close'])
        dataframe['hclose'] = (dataframe['open'] + dataframe['high'] + dataframe['low'] + dataframe['close']) / 4
        dataframe['hopen'] = (dataframe['open'].shift(2) + dataframe['close'].shift(2)) / 2
        dataframe['hhigh'] = dataframe[['open', 'close', 'high']].max(axis=1)
        dataframe['hlow'] = dataframe[['open', 'close', 'low']].min(axis=1)
        dataframe['emac'] = ta.SMA(dataframe['hclose'], timeperiod=6)
        dataframe['emao'] = ta.SMA(dataframe['hopen'], timeperiod=6)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[((dataframe['3LINESTRIKE'] < 0) | (dataframe['EVENINGSTAR'] > 0) | (dataframe['ABANDONEDBABY'] > 0) | (dataframe['HARAMI'] > 0) | (dataframe['ENGULFING'] > 0)) & (dataframe['emao'] < dataframe['emac']), 'enter_long'] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[dataframe['emao'] > dataframe['emac'], 'exit_long'] = 1
        return dataframe