天德上宝MACDTDSB通达信公式 副图 源码附图
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;
{资金博弈今日持仓}
超B:=L2_AMO(0,2)/10000.0;
大B:=L2_AMO(1,2)/10000.0;
中B:=L2_AMO(2,2)/10000.0;
小B:=L2_AMO(3,2)/10000.0;
超S:=L2_AMO(0,3)/10000.0;
大S:=L2_AMO(1,3)/10000.0;
中S:=L2_AMO(2,3)/10000.0;
小S:=L2_AMO(3,3)/10000.0;
TESTSKIP(NOT(超B OR 大B OR 中B OR 小B OR 超S OR 大S OR 中S OR 小S)!=0);
总流入比:=(超B+大B+中B+小B)/(超B+大B+中B+小B+超S+大S+中S+小S)*100,NODRAW,COLORWHITE;
大单流入:=(超B+大B)/(超B+大B+超S+大S)*100,NODRAW,COLORWHITE;
大单流入限制:=IF((超B+大B+超S+大S)=0,0,大单流入);
成交总量:=(超B+大B+中B+小B+超S+大S+中S+小S),NODRAW,COLORWHITE;
机构参与度:=(超B+超S+大B+大S)/成交总量*100,NODRAW,COLORWHITE;
主买A:=ACTINVOL,COLORRED,NODRAW;
主卖A:=ACTOUTVOL,COLORGREEN,NODRAW;
主买C:=主买A*100/(主买A+主卖A),NODRAW,COLORRED;
{资金}
DRAWTEXT_FIX(1,0.2,0,0.01,STRCAT(STRCAT('资金流入比: ',CON2STR(总流入比,2)),' %')),COLORWHITE;
DRAWTEXT_FIX(1,0.4,0,0.01,STRCAT(STRCAT('大单流入比: ',CON2STR(大单流入限制,2)),' %买')),COLORWHITE;
DRAWTEXT_FIX(1,0.6,0,0.01,STRCAT(STRCAT('机构参与度: ',CON2STR(机构参与度,2)),' %')),COLORWHITE;
DRAWTEXT_FIX(1,0.8,0,0.01,STRCAT(STRCAT('主动买卖比: ',CON2STR(主买C,2)),' %')),COLORWHITE;
{------------------------------------------------------------------}
{重心}
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
相关股票指标公式
原理解析:
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
{资金博弈今日持仓}
超B赋值:L2_AMO(0,2)/10000.0
大B赋值:L2_AMO(1,2)/10000.0
中B赋值:L2_AMO(2,2)/10000.0
小B赋值:L2_AMO(3,2)/10000.0
超S赋值:L2_AMO(0,3)/10000.0
大S赋值:L2_AMO(1,3)/10000.0
中S赋值:L2_AMO(2,3)/10000.0
小S赋值:L2_AMO(3,3)/10000.0
TESTSKIP(NOT(超B OR 大B OR 中B OR 小B OR 超S OR 大S OR 中S OR 小S)!=0)
总流入比赋值:(超B+大B+中B+小B)/(超B+大B+中B+小B+超S+大S+中S+小S)*100,NODRAW,画白色
大单流入赋值:(超B+大B)/(超B+大B+超S+大S)*100,NODRAW,画白色
大单流入限制:=IF((超B+大B+超S+大S)=0,0,大单流入)
成交总量赋值:(超B+大B+中B+小B+超S+大S+中S+小S),NODRAW,画白色
机构参与度赋值:(超B+超S+大B+大S)/成交总量*100,NODRAW,画白色
主买A赋值:ACTIN成交量,COLORRED,NODRAW
主卖A赋值:ACTOUT成交量,画绿色,NODRAW
主买C赋值:主买A*100/(主买A+主卖A),NODRAW,COLORRED
输出{资金}
DRAWTEXT_FIX(1,0.2,0,0.01,STRCAT(STRCAT('资金流入比: ',CON2STR(总流入比,2)),' %')),画白色
DRAWTEXT_FIX(1,0.4,0,0.01,STRCAT(STRCAT('大单流入比: ',CON2STR(大单流入限制,2)),' %买')),画白色
DRAWTEXT_FIX(1,0.6,0,0.01,STRCAT(STRCAT('输出机构参与度: ',CON2STR(机构参与度,2)),' %')),画白色
输出DRAWTEXT_FIX(1,0.8,0,0.01,STRCAT(STRCAT('主动买卖比: ',CON2STR(主买C,2)),' %')),画白色
{------------------------------------------------------------------}
{重心}
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