Timeframe
1h
Direction
Long Only
Stoploss
-2.0%
Trailing Stop
No
ROI
0m: 5.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
from freqtrade.strategy import IStrategy
from freqtrade.freqai.prediction_models.LightGBMRegressor import LightGBMRegressor
import pandas_ta as ta
class MyFreqAIStrategy(IStrategy):
INTERFACE_VERSION = 3 # For Freqtrade compatibility
minimal_roi = {"0": 0.05} # 5% profit target
stoploss = -0.02 # 2% stop-loss
timeframe = '1h' # 1-hour data
def populate_indicators(self, dataframe, metadata):
dataframe['rsi'] = ta.rsi(dataframe['close'], length=14)
return dataframe
def populate_entry_trend(self, dataframe, metadata):
conditions = (dataframe['rsi'] < 30) & (dataframe['freqai_prediction'] > 0.5)
dataframe.loc[conditions, 'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe, metadata):
conditions = (dataframe['rsi'] > 70) | (dataframe['freqai_prediction'] < 0.5)
dataframe.loc[conditions, 'exit_long'] = 1
return dataframe
def freqai_models(self):
return {"regressor": LightGBMRegressor} # Auto-ML model