Timeframe
6h
Direction
Long Only
Stoploss
-25.4%
Trailing Stop
No
ROI
0m: 10000.0%
Interface Version
N/A
Startup Candles
N/A
Indicators
2
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
# --- Do not remove these libs ---
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
# Add your lib to import here
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
import pandas_ta as pta
import numpy as np # noqa
import pandas as pd # noqa
class keltnerchannel(IStrategy):
timeframe = "6h"
# Both stoploss and roi are set to 100 to prevent them to give a sell signal.
stoploss = -0.254
minimal_roi = {"0": 100}
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Keltner Channel
keltner = qtpylib.keltner_channel(dataframe, window=16, atrs=1)
dataframe["kc_upperband"] = keltner["upper"]
dataframe["kc_lowerband"] = keltner["lower"]
dataframe["kc_middleband"] = keltner["mid"]
# RSI
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
# Horizontal RSI line
dataframe['hline'] = 61
return dataframe
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(qtpylib.crossed_above(dataframe['close'], dataframe['kc_upperband'])
& (dataframe["rsi"] > dataframe['hline'])
),
"buy",
] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(qtpylib.crossed_below(dataframe['close'], dataframe['kc_middleband'])),
"sell",
] = 1
return dataframe