Timeframe
15m
Direction
Long Only
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
5
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
# === S1: 15m Long-Only spot (mirror of B1) ===
class S1(IStrategy):
INTERFACE_VERSION = 3; timeframe = '15m'; can_short = False
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 = 10
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')
return d
def populate_exit_trend(self,d,m):return d
# === S2: 15m Long+Short SPOT (can't actually short, but test both signals) ===
class S2(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 = 10
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