Compiled from TRADE.md. Parent: none
Timeframe
5m
Direction
Long Only
Stoploss
-10.0%
Trailing Stop
No
ROI
0m: 15.0%, 60m: 5.0%, 120m: 1.0%
Interface Version
3
Startup Candles
70
Indicators
2
freqtrade/freqtrade-strategies
Strategy 003 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
"""
Auto-generated by trade-md from bbands-rsi@0.1.0.
DO NOT EDIT BY HAND - modify TRADE.md and recompile.
Source strategy: bbands-rsi
Version: 0.1.0
Thesis: Classic mean-reversion: enter when price is both RSI-oversold (< 30) and below the
"""
from __future__ import annotations
from pandas import DataFrame
import talib.abstract as ta
from freqtrade.strategy import IStrategy, merge_informative_pair
class BbandsRsi(IStrategy):
"""Compiled from TRADE.md. Parent: none"""
INTERFACE_VERSION = 3
timeframe = '5m'
stoploss = -0.1
minimal_roi = {"0": 0.15, "60": 0.05, "120": 0.01}
trailing_stop = False
startup_candle_count = 70
max_open_trades = 3
process_only_new_candles = True
can_short = False
@property
def protections(self):
return []
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi_14'] = ta.RSI(dataframe, timeperiod=14)
dataframe['bb_lower_20_2'] = ta.BBANDS(dataframe, timeperiod=20, nbdevup=2, nbdevdn=2)['lowerband']
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
((dataframe['rsi_14'] < 30) & (dataframe['close'] < dataframe['bb_lower_20_2']) & (dataframe['volume'] > 0)),
['enter_long', 'enter_tag']
] = (1, 'rsi_oversold_below_bb')
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(dataframe['rsi_14'] > 70),
['exit_long', 'exit_tag']
] = (1, 'rsi_overbought')
return dataframe