CofiBit Five-Minute Stochastic and ADX Strategy
Summary
This five-minute long-only strategy combines a fast stochastic crossover, an ADX threshold, and the open price relative to a short EMA channel. It enters when the open is below the five-period EMA of lows, fast %K crosses above %D, both stochastic values are below a configurable threshold, and ADX exceeds its threshold. An exit is triggered when the open reaches or exceeds the EMA of highs, or when either stochastic line crosses above its configurable upper level. The published defaults set both entry thresholds to 25 and the exit level to 75; the strategy also specifies a stepped return-on-investment schedule and a 25% stop loss.
The document consists mainly of implementation details and does not report backtest results, market selection, or evidence that the rules are profitable. Its parameters are exposed for optimization, but no validation procedure or risk analysis is provided. Since entries are long-only and the stop-loss and return targets can be overridden by configuration, results would depend on the trading setup and market tested.
Key ideas
- Long entries require a stochastic bullish crossover below a threshold, ADX above a threshold, and an open below the EMA of lows.
- Exits occur at the EMA of highs or when either stochastic line crosses an upper threshold.
- The strategy specifies a five-minute timeframe, configurable indicator thresholds, a return schedule, and a stop loss.
- No backtest results or evidence of profitability are provided.
Tags
Full text
# CofiBitStrategy
# CofiBitStrategy
taken from slack by user CofiBit
## Source (GPL-3.0)
```python
# --- Do not remove these libs ---
import freqtrade.vendor.qtpylib.indicators as qtpylib
import talib.abstract as ta
from freqtrade.strategy import IStrategy
from freqtrade.strategy import IntParameter
from pandas import DataFrame
# --------------------------------
class CofiBitStrategy(IStrategy):
"""
taken from slack by user CofiBit
"""
INTERFACE_VERSION: int = 3
# Buy hyperspace params:
buy_params = {
"buy_fastx": 25,
"buy_adx": 25,
}
# Sell hyperspace params:
sell_params = {
"sell_fastx": 75,
}
# Minimal ROI designed for the strategy.
# This attribute will be overridden if the config file contains "minimal_roi"
minimal_roi = {
"40": 0.05,
"30": 0.06,
"20": 0.07,
"0": 0.10
}
# Optimal stoploss designed for the strategy
# This attribute will be overridden if the config file contains "stoploss"
stoploss = -0.25
# Optimal timeframe for the strategy
timeframe = '5m'
buy_fastx = IntParameter(20, 30, default=25)
buy_adx = IntParameter(20, 30, default=25)
sell_fastx = IntParameter(70, 80, default=75)
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
stoch_fast = ta.STOCHF(dataframe, 5, 3, 0, 3, 0)
dataframe['fastd'] = stoch_fast['fastd']
dataframe['fastk'] = stoch_fast['fastk']
dataframe['ema_high'] = ta.EMA(dataframe, timeperiod=5, price='high')
dataframe['ema_close'] = ta.EMA(dataframe, timeperiod=5, price='close')
dataframe['ema_low'] = ta.EMA(dataframe, timeperiod=5, price='low')
dataframe['adx'] = ta.ADX(dataframe)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
Based on TA indicators, populates the buy signal for the given dataframe
:param dataframe: DataFrame
:return: DataFrame with buy column
"""
dataframe.loc[
(
(dataframe['open'] < dataframe['ema_low']) &
(qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) &
(dataframe['fastk'] < self.buy_fastx.value) &
(dataframe['fastd'] < self.buy_fastx.value) &
(dataframe['adx'] > self.buy_adx.value)
),
'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
Based on TA indicators, populates the sell signal for the given dataframe
:param dataframe: DataFrame
:return: DataFrame with buy column
"""
dataframe.loc[
(
(dataframe['open'] >= dataframe['ema_high'])
) |
(
(qtpylib.crossed_above(dataframe['fastk'], self.sell_fastx.value)) |
(qtpylib.crossed_above(dataframe['fastd'], self.sell_fastx.value))
),
'exit_long'] = 1
return dataframe
```Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.