Timeframe
15m
Direction
Long & Short
Stoploss
-2.5%
Trailing Stop
Yes
ROI
0m: 8.0%, 480m: 5.0%, 1440m: 3.0%, 4320m: 0.0%
Interface Version
3
Startup Candles
200
Indicators
7
freqtrade/freqtrade-strategies
Strategy 003 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
from pandas import DataFrame
import talib.abstract as ta
from freqtrade.strategy import IStrategy
# === B1: 15m A4 but max_open pushed to limit ===
class B1(IStrategy):
INTERFACE_VERSION = 3; timeframe = '15m'; can_short = True
stoploss = -0.025; trailing_stop = True
trailing_stop_positive = 0.005; trailing_stop_positive_offset = 0.018
trailing_only_offset_is_reached = True
minimal_roi = {"0": 0.08, "480": 0.05, "1440": 0.03, "4320": 0}
max_open_trades = 15
startup_candle_count = 200
process_only_new_candles = True; use_exit_signal = False
def populate_indicators(self,d,m):
d['e10']=ta.EMA(d,10);d['e30']=ta.EMA(d,30)
md=ta.MACD(d);d['md']=md['macd'];d['ms']=md['macdsignal']
d['mom']=ta.ROC(d,3);d['adx']=ta.ADX(d,14);d['vr']=d['volume']/ta.SMA(d['volume'],20)
return d
def populate_entry_trend(self,d,m):
d.loc[((d['e10']>d['e30'])&(d['md']>d['ms'])&(d['mom']>0.1)&(d['adx']>18)&(d['vr']>1.0)&(d['volume']>0)),['enter_long','enter_tag']]=(1,'L')
d.loc[((d['e10']<d['e30'])&(d['md']<d['ms'])&(d['mom']<-0.1)&(d['adx']>18)&(d['vr']>1.0)&(d['volume']>0)),['enter_short','enter_tag']]=(1,'S')
return d
def populate_exit_trend(self,d,m):return d
# === B2: 15m tighter stop, faster trades ===
class B2(IStrategy):
INTERFACE_VERSION = 3; timeframe = '15m'; can_short = True
stoploss = -0.02; trailing_stop = True
trailing_stop_positive = 0.004; trailing_stop_positive_offset = 0.012
trailing_only_offset_is_reached = True
minimal_roi = {"0": 0.04, "360": 0.025, "960": 0.015, "2880": 0}
max_open_trades = 15
startup_candle_count = 200
process_only_new_candles = True; use_exit_signal = False
def populate_indicators(self,d,m):
d['e10']=ta.EMA(d,10);d['e30']=ta.EMA(d,30)
md=ta.MACD(d);d['md']=md['macd'];d['ms']=md['macdsignal']
d['mom']=ta.ROC(d,3);d['adx']=ta.ADX(d,14);d['vr']=d['volume']/ta.SMA(d['volume'],20)
d['rsi']=ta.RSI(d,14)
return d
def populate_entry_trend(self,d,m):
d.loc[((d['e10']>d['e30'])&(d['md']>d['ms'])&(d['mom']>0.05)&(d['adx']>15)&(d['vr']>1.0)&(d['rsi']<75)&(d['volume']>0)),['enter_long','enter_tag']]=(1,'L')
d.loc[((d['e10']<d['e30'])&(d['md']<d['ms'])&(d['mom']<-0.05)&(d['adx']>15)&(d['vr']>1.0)&(d['rsi']>25)&(d['volume']>0)),['enter_short','enter_tag']]=(1,'S')
return d
def populate_exit_trend(self,d,m):return d
# === B3: 5m EMA-only ultra simple, max trades ===
class B3(IStrategy):
INTERFACE_VERSION = 3; timeframe = '5m'; can_short = True
stoploss = -0.015; trailing_stop = True
trailing_stop_positive = 0.004; trailing_stop_positive_offset = 0.010
trailing_only_offset_is_reached = True
minimal_roi = {"0": 0.04, "120": 0.025, "480": 0.015, "1440": 0}
max_open_trades = 12
startup_candle_count = 200
process_only_new_candles = True; use_exit_signal = False
def populate_indicators(self,d,m):
d['e9']=ta.EMA(d,9);d['e21']=ta.EMA(d,21);d['e55']=ta.EMA(d,55)
d['adx']=ta.ADX(d,14);d['vr']=d['volume']/ta.SMA(d['volume'],20)
return d
def populate_entry_trend(self,d,m):
d.loc[((d['e9']>d['e21'])&(d['e21']>d['e55'])&(d['adx']>20)&(d['vr']>1.1)&(d['volume']>0)),['enter_long','enter_tag']]=(1,'L')
d.loc[((d['e9']<d['e21'])&(d['e21']<d['e55'])&(d['adx']>20)&(d['vr']>1.1)&(d['volume']>0)),['enter_short','enter_tag']]=(1,'S')
return d
def populate_exit_trend(self,d,m):return d
# === B4: 15m B1 but adapt stop/trail by ATR ===
class B4(IStrategy):
INTERFACE_VERSION = 3; timeframe = '15m'; can_short = True
stoploss = -0.025; trailing_stop = True
trailing_stop_positive = 0.005; trailing_stop_positive_offset = 0.018
trailing_only_offset_is_reached = True
minimal_roi = {"0": 0.06, "480": 0.04, "1440": 0.025, "4320": 0}
max_open_trades = 15
startup_candle_count = 200
process_only_new_candles = True; use_exit_signal = False
def populate_indicators(self,d,m):
d['e10']=ta.EMA(d,10);d['e30']=ta.EMA(d,30)
md=ta.MACD(d);d['md']=md['macd'];d['ms']=md['macdsignal']
d['mom']=ta.ROC(d,3);d['adx']=ta.ADX(d,14);d['vr']=d['volume']/ta.SMA(d['volume'],20)
return d
def populate_entry_trend(self,d,m):
d.loc[((d['e10']>d['e30'])&(d['md']>d['ms'])&(d['mom']>0.05)&(d['adx']>16)&(d['vr']>1.0)&(d['volume']>0)),['enter_long','enter_tag']]=(1,'L')
d.loc[((d['e10']<d['e30'])&(d['md']<d['ms'])&(d['mom']<-0.05)&(d['adx']>16)&(d['vr']>1.0)&(d['volume']>0)),['enter_short','enter_tag']]=(1,'S')
return d
def populate_exit_trend(self,d,m):return d