Timeframe
5m
Direction
Long Only
Stoploss
-8.0%
Trailing Stop
Yes
ROI
0m: 4.0%, 60m: 2.0%, 180m: 0.0%
Interface Version
3
Startup Candles
240
Indicators
4
freqtrade/freqtrade-strategies
Strategy 003 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
from __future__ import annotations
from pandas import DataFrame
import talib.abstract as ta
from freqtrade.strategy import DecimalParameter, IStrategy
class TrendAlphaV1(IStrategy):
INTERFACE_VERSION = 3
timeframe = "5m"
can_short = False
process_only_new_candles = True
startup_candle_count = 240
minimal_roi = {"0": 0.04, "60": 0.02, "180": 0.0}
stoploss = -0.08
trailing_stop = True
trailing_stop_positive = 0.015
trailing_stop_positive_offset = 0.035
trailing_only_offset_is_reached = True
buy_rsi_min = DecimalParameter(45.0, 62.0, default=52.0, decimals=1, space="buy")
sell_rsi_max = DecimalParameter(35.0, 55.0, default=46.0, decimals=1, space="sell")
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe["ema_50"] = ta.EMA(dataframe, timeperiod=50)
dataframe["ema_200"] = ta.EMA(dataframe, timeperiod=200)
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
dataframe["adx"] = ta.ADX(dataframe, timeperiod=14)
dataframe["atr"] = ta.ATR(dataframe, timeperiod=14)
dataframe["volume_mean_30"] = dataframe["volume"].rolling(30).mean()
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe["ema_50"] > dataframe["ema_200"])
& (dataframe["close"] > dataframe["ema_50"])
& (dataframe["adx"] > 20)
& (dataframe["rsi"] > self.buy_rsi_min.value)
& (dataframe["volume"] > dataframe["volume_mean_30"])
),
"enter_long",
] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe["close"] < dataframe["ema_50"])
| (dataframe["rsi"] < self.sell_rsi_max.value)
),
"exit_long",
] = 1
return dataframe