1
This commit is contained in:
parent
e93ec6516c
commit
d69261446e
@ -36,8 +36,8 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
upperband, middleband, lowerband = talib.BBANDS(df['close'], timeperiod=bollinger_length, nbdevup=bollinger_mult, nbdevdn=bollinger_mult, matype=0)
|
||||
|
||||
# 生成交易信号
|
||||
long_condition = (macd.shift(1) <= 0) & (macd > 0) & (df['high'] < upperband) & (df['close'] > fast_ema | df['close'] > slow_ema)
|
||||
short_condition = (macd.shift(1) >= 0) & (macd < 0) & (df['low'] > lowerband) & (df['close'] < fast_ema | df['close'] < slow_ema)
|
||||
long_condition = (macd.shift(1) <= 0) & (macd > 0) & (df['high'] < upperband) & ((df['close'] > fast_ema) | (df['close'] > slow_ema))
|
||||
short_condition = (macd.shift(1) >= 0) & (macd < 0) & (df['low'] > lowerband) & ((df['close'] < fast_ema) | (df['close'] < slow_ema))
|
||||
|
||||
|
||||
df['Long_Signal'] = np.where(long_condition, True, False)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user