Timeframe
1m
Direction
Long Only
Stoploss
-10.0%
Trailing Stop
No
ROI
0m: 10000.0%
Interface Version
3
Startup Candles
N/A
Indicators
1
freqtrade/freqtrade-strategies
freqtrade/freqtrade-strategies
this is an example class, implementing a PSAR based trailing stop loss you are supposed to take the `custom_stoploss()` and `populate_indicators()` parts and adapt it to your own strategy
freqtrade/freqtrade-strategies
Strategy 003 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
import logging
from freqtrade.strategy import IStrategy
from pandas import DataFrame
import talib.abstract as ta
logger = logging.getLogger(__name__)
class Simple(IStrategy):
INTERFACE_VERSION = 3
minimal_roi = {"0": 100} # 10000% - never exit via ROI
stoploss = -0.10
timeframe = '1m'
can_short = False
process_only_new_candles = False
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Entry condition: RSI < 50 and RSI is not NaN
conditions = (
(dataframe['rsi'] < 50) &
(dataframe['rsi'].notnull())
)
dataframe.loc[conditions, 'enter_long'] = 1
# Debug: log how many entry signals we have
entry_count = dataframe['enter_long'].sum()
logger.info(f"Generated {entry_count} entry signals out of {len(dataframe)} candles")
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(dataframe['rsi'] > 50),
'exit_long'
] = 1
return dataframe