添加布林带显示
This commit is contained in:
@@ -115,7 +115,7 @@ class ChanLun_BTC_30(IStrategy):
|
||||
state_list = self.chan.get_klc_state_list(dataframe_15)
|
||||
dataframe_15['state'] = state_list
|
||||
dataframe_15['fx'] = state_list
|
||||
|
||||
state_list = self.chan.get_klc_state_list(dataframe_30)
|
||||
#bi_list_1 = self.chan.get_bi_list(dataframe)
|
||||
#bi_list_5 = self.chan.get_bi_list(dataframe_5)
|
||||
#bi_list_15 = self.chan.get_bi_list(dataframe_15)
|
||||
@@ -154,12 +154,17 @@ class ChanLun_BTC_30(IStrategy):
|
||||
period = 6
|
||||
macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period)
|
||||
bb365 = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
||||
bbp365 = ta.BBP(df, timeperiod=365)
|
||||
bb120 = ta.BBANDS(df, timeperiod=120, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
||||
bbp120 = ta.BBP(df, timeperiod=120)
|
||||
|
||||
# 手动计算布林带 %B 指标 (BBP)
|
||||
# %B = (Price - Lower Band) / (Upper Band - Lower Band)
|
||||
bbp365 = (df['close'] - bb365['lowerband']) / (bb365['upperband'] - bb365['lowerband'])
|
||||
bbp120 = (df['close'] - bb120['lowerband']) / (bb120['upperband'] - bb120['lowerband'])
|
||||
|
||||
df['bb365'] = bb365['upperband']
|
||||
df['bbp365'] = bbp365
|
||||
df['bb120'] = bb120['upperband']
|
||||
df['bbp120'] = bbp120
|
||||
df['macd'] = macd['macd']
|
||||
df['macdsignal'] = macd['macdsignal']
|
||||
df['macdhist'] = macd['macdhist']
|
||||
@@ -279,8 +284,8 @@ class ChanLun_BTC_30(IStrategy):
|
||||
ema10 = 'resample_{}_ema10'.format(self.get_ticker_indicator()*self.time30)
|
||||
ema26 = 'resample_{}_ema26'.format(self.get_ticker_indicator()*self.time30)
|
||||
ema52 = 'resample_{}_ema52'.format(self.get_ticker_indicator()*self.time30)
|
||||
print(last_candle[ema5], last_candle[ema10], last_candle[ema26], last_candle[ema52])
|
||||
print(last_candle['close'])
|
||||
#print(last_candle[ema5], last_candle[ema10], last_candle[ema26], last_candle[ema52])
|
||||
#print(last_candle['close'])
|
||||
klc_list = self.chan.get_klc_list(resample_to_interval(dataframe, self.get_ticker_indicator() * self.time30))
|
||||
bi_list = self.chan.cal_bi_list(klc_list)
|
||||
if self.last_order is None:
|
||||
|
||||
Reference in New Issue
Block a user