use 1 hour bb
This commit is contained in:
@@ -68,6 +68,7 @@ class ChanKLC():
|
|||||||
for klu in self.klus:
|
for klu in self.klus:
|
||||||
if self.high >= klu.bbup302 and klu.bbup302 > 0 and (self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2):
|
if self.high >= klu.bbup302 and klu.bbup302 > 0 and (self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2):
|
||||||
self.bb_out = True
|
self.bb_out = True
|
||||||
|
#print(self.end_time, self.high, klu.bbup302, self.klc_fx_type)
|
||||||
if self.high >= klu.bbup30 and klu.bbup30 > 0:
|
if self.high >= klu.bbup30 and klu.bbup30 > 0:
|
||||||
self.klc_fx_type = Chan_KLC_FX.TOP4
|
self.klc_fx_type = Chan_KLC_FX.TOP4
|
||||||
if self.low <= klu.bblow302 and klu.bblow302 > 0 and (self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2):
|
if self.low <= klu.bblow302 and klu.bblow302 > 0 and (self.klc_fx_type == Chan_KLC_FX.BOTTOM1 or self.klc_fx_type == Chan_KLC_FX.BOTTOM2):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
|
|||||||
# freqtrade plot-dataframe --strategy ChanLun_BTC_30 --datadir user_data/data/binance -c ./user_data/ChanLun_SOL_30.json --timerange=20250309-
|
# freqtrade plot-dataframe --strategy ChanLun_BTC_30 --datadir user_data/data/binance -c ./user_data/ChanLun_SOL_30.json --timerange=20250309-
|
||||||
|
|
||||||
# freqtrade trade -c ./user_data/Chan/config/ChanLun_BTC_30.json --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies
|
# freqtrade trade -c ./user_data/Chan/config/ChanLun_BTC_30.json --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies
|
||||||
# freqtrade backtesting -c ./user_data/Chan/config/ChanLun_BTC_30.json --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies --timerange=20250510-20250520
|
# freqtrade backtesting -c ./user_data/Chan/config/ChanLun_BTC_30.json --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies --timerange=20250712-
|
||||||
# freqtrade download-data -c ./user_data/Chan/config/ChanLun_BTC_30.json -t 1m --pairs BTC/USDT:USDT --timerange=20250405-
|
# freqtrade download-data -c ./user_data/Chan/config/ChanLun_BTC_30.json -t 1m --pairs BTC/USDT:USDT --timerange=20250405-
|
||||||
# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi stoploss --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies -c ./user_data/Chan/config/ChanLun_BTC_30.json -e 200 --timerange=20250201-20250401
|
# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi stoploss --strategy ChanLun_BTC_30 --strategy-path ./user_data/Chan/strategies -c ./user_data/Chan/config/ChanLun_BTC_30.json -e 200 --timerange=20250201-20250401
|
||||||
|
|
||||||
@@ -62,6 +62,8 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
"240": 0.025,
|
"240": 0.025,
|
||||||
"360": 0
|
"360": 0
|
||||||
}
|
}
|
||||||
|
minimal_roi = {
|
||||||
|
}
|
||||||
can_short = True
|
can_short = True
|
||||||
lev = 1.0
|
lev = 1.0
|
||||||
stoploss = -0.2 # 设置为很大的负值,让custom_stoploss来控制
|
stoploss = -0.2 # 设置为很大的负值,让custom_stoploss来控制
|
||||||
@@ -74,14 +76,14 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
|
|
||||||
# 启用仓位调整功能以支持分批止盈
|
# 启用仓位调整功能以支持分批止盈
|
||||||
position_adjustment_enable = True
|
position_adjustment_enable = True
|
||||||
startup_candle_count = 780
|
startup_candle_count = 2880
|
||||||
|
|
||||||
time5 = 5
|
time5 = 5
|
||||||
time15 = 15
|
time15 = 15
|
||||||
time30 = 30
|
time30 = 30
|
||||||
time60 = 60
|
time60 = 60
|
||||||
time4h = 240
|
time4h = 240
|
||||||
time30 = 3
|
time30 = 60
|
||||||
last_time = datetime.now()
|
last_time = datetime.now()
|
||||||
chan = ChanLun()
|
chan = ChanLun()
|
||||||
chanpy = ChanPY()
|
chanpy = ChanPY()
|
||||||
@@ -117,9 +119,9 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
#self.chan.plot_dual(dataframe_5, dataframe_30)
|
#self.chan.plot_dual(dataframe_5, dataframe_30)
|
||||||
chanpy_state = self.chanpy.get_bsp_state(dataframe_5)
|
chanpy_state = self.chanpy.get_bsp_state(dataframe_5)
|
||||||
dataframe_5['chanpy_state'] = chanpy_state
|
dataframe_5['chanpy_state'] = chanpy_state
|
||||||
state_list = self.chan.get_klc_state_list(dataframe_3)
|
state_list = self.chan.get_klc_state_list(dataframe_60)
|
||||||
dataframe_3['state'] = state_list
|
dataframe_60['state'] = state_list
|
||||||
dataframe_3['fx'] = state_list
|
dataframe_60['fx'] = state_list
|
||||||
#bi_list_1 = self.chan.get_bi_list(dataframe)
|
#bi_list_1 = self.chan.get_bi_list(dataframe)
|
||||||
#bi_list_5 = self.chan.get_bi_list(dataframe_5)
|
#bi_list_5 = self.chan.get_bi_list(dataframe_5)
|
||||||
#bi_list_15 = self.chan.get_bi_list(dataframe_15)
|
#bi_list_15 = self.chan.get_bi_list(dataframe_15)
|
||||||
@@ -145,9 +147,11 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
klc_list = self.chan.get_klc_list(dataframe)
|
klc_list = self.chan.get_klc_list(dataframe)
|
||||||
bi_list = self.chan.cal_bi_list(klc_list)
|
bi_list = self.chan.cal_bi_list(klc_list)
|
||||||
seg_list = self.chan.get_seg_list(bi_list)
|
seg_list = self.chan.get_seg_list(bi_list)
|
||||||
|
zs_list = self.chan.get_zs_list(bi_list, seg_list)
|
||||||
seg = seg_list[-1]
|
seg = seg_list[-1]
|
||||||
bi = bi_list[-1]
|
bi = bi_list[-1]
|
||||||
print(seg.start_time, seg.dir, bi.start_time, bi.dir)
|
zs = zs_list[-1]
|
||||||
|
print(zs.start_time, zs.zg, zs.zd, zs.dir)
|
||||||
def print_bi(self, bi_list):
|
def print_bi(self, bi_list):
|
||||||
if bi_list and len(bi_list) > 2:
|
if bi_list and len(bi_list) > 2:
|
||||||
bi1 = bi_list[-1]
|
bi1 = bi_list[-1]
|
||||||
@@ -160,8 +164,8 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period)
|
macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period)
|
||||||
bb365 = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
bb365 = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
||||||
bb120 = ta.BBANDS(df, timeperiod=120, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
bb120 = ta.BBANDS(df, timeperiod=120, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
||||||
bb30 = ta.BBANDS(df, timeperiod=90, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
bb30 = ta.BBANDS(df, timeperiod=41, nbdevup=2.3, nbdevdn=2.3, matype=0)
|
||||||
bb302 = ta.BBANDS(df, timeperiod=90, nbdevup=2.0, nbdevdn=2.0, matype=0)
|
bb302 = ta.BBANDS(df, timeperiod=41, nbdevup=2.0, nbdevdn=2.0, matype=0)
|
||||||
|
|
||||||
# 计算布林带中轨(移动平均线)
|
# 计算布林带中轨(移动平均线)
|
||||||
bb30_middle = ta.SMA(df, timeperiod=90)
|
bb30_middle = ta.SMA(df, timeperiod=90)
|
||||||
@@ -226,7 +230,7 @@ class ChanLun_BTC_30(IStrategy):
|
|||||||
new_exitprice = proposed_rate - 50
|
new_exitprice = proposed_rate - 50
|
||||||
return new_exitprice
|
return new_exitprice
|
||||||
|
|
||||||
def adjust_trade_position(self, trade: Trade, current_time: datetime,
|
def adjust_trade_position1(self, trade: Trade, current_time: datetime,
|
||||||
current_rate: float, current_profit: float,
|
current_rate: float, current_profit: float,
|
||||||
min_stake: Optional[float], max_stake: float,
|
min_stake: Optional[float], max_stake: float,
|
||||||
current_entry_rate: float, current_exit_rate: float,
|
current_entry_rate: float, current_exit_rate: float,
|
||||||
|
|||||||
Reference in New Issue
Block a user