kdj调整-kdj调整后与macd共振选股

2023-03-08 技术指标 0次阅读 admin

关于kdj调整内容导航:

1、kdj调整


# 参数
N = 9
M1 = 3
M2 = 3
# 计算RSV
rsv = (close - LLV(low, N)) / (HHV(high, N) - LLV(low, N)) * 100
# 计算K值
k = SMA(rsv, M1, 1)
# 计算D值
d = SMA(k, M2, 1)
# 计算J值
j = 3 * k - 2 * d
return k, d, j

# 计算MACD
def MACD(close, short=12, long=26, mid=9):
# 计算DIF
dif = EMA(close, short) - EMA(close, long)
# 计算DEA
dea = EMA(dif, mid)
# 计算MACD
macd = (dif - dea) * 2
return dif, dea, macd

# 计算ATR
def ATR(high, low, close, N=14):
tr = MAX(high - low, ABS(REF(close, 1) - high), ABS(REF(close, 1) - low))
atr = MA(tr, N)
return atr

# 计算BIAS
def BIAS(close, N=6):
bias = (close - MA(close, N)) / MA(close, N) * 100
return bias

# 计算CCI
def CCI(high, low, close, N=14):
tp = (high + low + close) / 3
cci = (tp - MA(tp, N)) / (0.015 * AVEDEV(tp, N))
return cci

# 计算ROC
def ROC(close, N=12):
roc = (close - REF(close, N)) / REF(close, N) * 100
return roc

# 计算RSI
def RSI(close, N1=6, N2=12, N3=24):
# 计算RSI1
rsi1 = SMA(MAX(close - REF(close, 1), 0), N1, 1) / SMA(ABS(close - REF(close, 1)), N1, 1) * 100
# 计算RSI2
rsi2 = SMA(MAX(close - REF(close, 1), 0), N2, 1) / SMA(ABS(close - REF(close, 1)), N2, 1) * 100
# 计算RSI3
rsi3 = SMA(MAX(close - REF(close, 1), 0), N3, 1) / SMA(ABS(close - REF(close, 1)), N3, 1) * 100
return rsi1, rsi2, rsi3

# 计算WR
def WR(high, low, close, N=10):
# 计算RS
rs = SMA(MAX(high - REF(close, 1), 0), N, 1) / SMA(ABS(low - REF(close, 1)), N, 1) * 100
return rs

# 计算SAR
def SAR(high, low, step=0.02, maximum=0.2):
# 参数
length = len(high)
# 计算初始值
if high[0] > low[0]:
trend = 'up'
sar = low[0]
else:
trend = 'down'
sar = high[0]
# 计算
ep = []
for i in range(length):
if trend == 'up':
if high[i] > sar:
sar = sar + step * (high[i] - sar)
ep.append(high[i])
else:
sar = low[i]
trend = 'down'
ep.append(low[i])
else:
if low[i] < sar:
sar = sar - step * (sar - low[i])
ep.append(low[i])
else:
sar = high[i]
trend = 'up'
ep.append(high[i])
if step < maximum:
step = step + 0.02
return sar, ep

# 计算BOLL
def BOLL(close, N=20, M=2):
# 计算MA
ma = MA(close, N)
# 计算标准差
md = STD(close, N)
# 计算上轨线
up = ma + M * md
# 计算下轨线
dn = ma - M * md
return ma, up, dn

# 计算PSY
def PSY(close, N=12):
# 计算涨幅
change = close - REF(close, 1)
# 计算心理线
psy = SUM(IF(change > 0, change, 0), N) / SUM(ABS(change), N) * 100
return psy

# 计算OBV
def OBV(close, volume):
length = len(close)
obv = [volume[0]]
for i in range(1, length):
if close[i] > close[i - 1]:
obv.append(obv[i - 1] + volume[i])
elif close[i] == close[i - 1]:
obv.append(obv[i - 1])
else:
obv.append(obv[i - 1] - volume[i])
return obv

# 计算VR
def VR(high, low, close, volume, N=26):
# 计算TR
tr = MAX(high - low, ABS(REF(close, 1) - high), ABS(REF(close, 1) - low))
# 计算VR
vr = SUM(IF(close > REF(close, 1), volume, IF(close < REF(close, 1), -volume, 0)), N) / SUM(volume, N) * 100
return vr

# 计算EMV
def EMV(high, low, close, volume, N=14):
# 计算MV
mv = (high + low + close) / 3 * volume
# 计算EMV
emv = MA(mv, N) / MA(volume, N)
return emv

# 计算DMA
def DMA(close, N=10, M=10):
# 计算DIF
dif = MA(close, N) - MA(close, M)
# 计算DMA
dma = MA(dif, M)
return dif, dma

# 计算DDI
def DDI(high, low, close, N=25, M=6):
# 计算ADX
adx = MA(ABS(high - low) / (high - low) * 100, N)
# 计算ADXR
adxr = MA(adx, M)
# 计算DDI
ddi = adx / adxr * 100
return adx, adxr, ddi

# 计算MTM
def MTM(close, N=12, M=6):
# 计算MTM
mtm = close - REF(close, N)
# 计算MTMMA
mtmma = MA(mtm, M)
return mtm, mtmma

# 计算CR
def CR(high, low, close, N=

2、kdj调整为9,9,9的优点

点右键找到指标在点调整指标参数能调整了
kdj调整为9,9,9的优点

3、kdj调整后与macd共振选股

这是liang个指标都发生金叉时,是强烈的买入信号。 反过来,liang个指标都发生死叉时,是强烈的卖出信号。 注意,macd会比kdj滞后一些。
kdj调整后与macd共振选股

传统的MACD有滞后性,要提高买入胜率,只有调整其参数,使之与KDJ的变动频率相配就可最大限度地避免你所说的困惑了
猜你感兴趣: kdj调整
kdj调整到位-kdj如何设置最佳

kdj调整到位-kdj如何设置最佳

kdj调整到位-kdj如何设置最佳..

2023-02-27 0次阅读