通达信MACD重心买卖副图指标公式源码
{日macd}
vol1:=6;
VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);
obv1:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
OBV2:=EMA(OBV1,3)-MA(OBV1,9);
OBV3:=EMA(IF(OBV2>0,OBV2,0),3);
Mac3:=MA(C,3);
SHORT:=11;LONG:=21;MID:=7;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)COLORWHITE;
DEA:EMA(DIF,MID)COLORYELLOW;
MACD:(DIF-DEA)*2,NODRAW;
STICKLINE(OBV3>REF(OBV3,1) AND MAC3>REF(MAC3,1),0,MACD,0.1,0),COLORRED;
吸:=XLPL.NOTEXT吸;
拉:=XLPL.NOTEXT拉;
派:=XLPL.NOTEXT派;
落:=XLPL.NOTEXT落;
STICKLINE(吸,0,MACD,0.1,0),COLORRED;
STICKLINE(拉,0,MACD,0.1,0),COLORRED;
STICKLINE(派,0,MACD,0,0),COLORGREEN;
STICKLINE(落,0,MACD,0,0),COLORGREEN;
主力买1:IF(DIF>REF(DIF,1),DIF,DRAWNULL),COLORRED;
主力买2:IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLOR00FF00;
{重心}
A1:=(CLOSE*2+HIGH+LOW)/4;
A2:=EMA(A1,13)-EMA(A1,34);
A3:=EMA(A2,5);
重心:2*(A2-A3)*3.8,NODRAW;
J:=重心;
{MACD}
DIF1:=EMA(CLOSE,11) - EMA(CLOSE,21);
DEA1:=EMA(DIF1,7);
MACD1:=2*(DIF1-DEA1);
{kdj}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,NODRAW;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J1:=3*K-2*D;
{CII}
TYP:=(HIGH + LOW + CLOSE)/3;
cci:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
买:=crOSS(CCI,-100),NODRAW;
{rsi}
LC:=REF(CLOSE,1);
RSI2:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(Abs(CLOSE-LC),6,1)*100,NODRAW;
R6:=(SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100),NODRAW;
MR持股:=K>D AND K>REF(K,1) AND DIF1>DEA1 AND DIF1>REF(DIF1,1) AND R6>50 AND R6>REF(R6,1) AND C>bbi AND BBI>REF(BBI,1),NODRAW;
IF(MR持股,J/3,DRAWNULL),COLORMAGENTA,LINETHICK2;
{买点}
负100买点:K>D AND K>REF(K,1) AND DIF1>DEA1 AND DIF1>REF(DIF1,1) AND R6>50 AND R6>REF(R6,1)AND 买 AND 重心>REF(重心,1),NODRAW;
M交叉临界:=351/28*(EMA(DIF1,9)-11/13*EMA(C,12)+25/27*EMA(C,26)),NODRAW;
K交叉点:=(3*REF(D,1)-2*REF(K,1))/100*(HHV(H,9)-LLV(L,9))+LLV(L,9),NODRAW;
长线持股:=K>D AND DIF1>DEA1 AND R6>50 AND C>BBI,NODRAW;
IF(长线持股,J/2,DRAWNULL)COLOR9966FF,LINETHICK1;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
{日MACD}
VOL1赋值:6
VA赋值:IF(收盘价>1日前的收盘价,成交量,-成交量)
OBV1赋值:SUM(IF(收盘价=1日前的收盘价,0,VA),0)
OBV2赋值:OBV1的3日指数移动平均-OBV1的9日简单移动平均
如果OBV2>0返回OBV2否则返回0
MAC3赋值:C的3日简单移动平均
SHORT赋值:11
LONG赋值:21
MID赋值:7
输出DIF:收盘价的SHORT日指数移动平均-收盘价的LONG日指数移动平均画白色
输出DEA:DIF的MID日指数移动平均画黄色
输出MACD:(DIF-DEA)*2,NODRAW
STICKLINE(OBV3>1日前的OBV3 AND MAC3>1日前的MAC3,0,MACD,0.1,0),COLORRED
吸赋值:XLPL.NOTEXT吸
拉赋值:XLPL.NOTEXT拉
派赋值:XLPL.NOTEXT派
落赋值:XLPL.NOTEXT落
当满足条件吸时,在0和MACD之间画柱状线
当满足条件拉时,在0和MACD之间画柱状线
当满足条件派时,在0和MACD之间画柱状线
当满足条件落时,在0和MACD之间画柱状线
输出主力买1:IF(DIF>1日前的DIF,DIF,DRAWNULL),COLORRED
输出主力买2:IF(DIF<1日前的DIF,DIF,DRAWNULL),COLOR00FF00
{重心}
A1赋值:(收盘价*2+最高价+最低价)/4
A2赋值:A1的13日指数移动平均-A1的34日指数移动平均
A3赋值:A2的5日指数移动平均
输出重心:2*(A2-A3)*3.8,NODRAW
J赋值:重心
{MACD}
DIF1:=收盘价的11日指数移动平均 - 收盘价的21日指数移动平均
DEA1:=DIF1的7日指数移动平均
MACD1:=2*(DIF1-DEA1)
{KDJ}
RSV:=(收盘价-9日内最低价最低值)/(9日内最高价最高值-9日内最低价最低值)*100,NODRAW
RSV的3日[1日权重]移动平均
K的3日[1日权重]移动平均
J1:=3*K-2*D
{CII}
TYP赋值:(最高价 + 最低价 + 收盘价)/3
CCI赋值:(TYP-TYP的14日简单移动平均)/(0.015*AVEDEV(TYP,14))
买赋值:CCI上穿-100,NODRAW
{RSI}
LC赋值:1日前的收盘价
RSI2赋值:SMA(收盘价-LC和0较大值,6,1)/SMA(收盘价-LC的绝对值,6,1)*100,NODRAW
R6赋值:(SMA(收盘价-LC和0较大值,6,1)/SMA(收盘价-LC的绝对值,6,1)*100),NODRAW
MR持股赋值:K>D AND K>1日前的K AND DIF1>DEA1 AND DIF1>1日前的DIF1 AND R6>50 AND R6>1日前的R6 AND C>BBI AND BBI>1日前的BBI,NODRAW
如果MR持股返回J/3否则返回DRAWNULL
{买点}
负100买点:K>D AND K>1日前的K AND DIF1>DEA1 AND DIF1>1日前的DIF1 AND R6>50 AND R6>1日前的R6AND 买 AND 重心>1日前的重心,NODRAW
M交叉临界赋值:351/28*(DIF1的9日指数移动平均-11/13*C的12日指数移动平均+25/27*C的26日指数移动平均),NODRAW
K交叉点:=(3*1日前的D-2*1日前的K)/100*(9日内H最高值-9日内L最低值)+9日内L最低值,NODRAW
长线持股赋值:K>D AND DIF1>DEA1 AND R6>50 AND C>BBI,NODRAW
如果长线持股返回J/2否则返回DRAWNULL