通达信买卖单差副图,附加顶底背离信号源码副图
TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,TOTALFZNUM,1)))));
MTIME:=MOD(FROMOPEN,TOTAL);
CTIME:=IF(MTIME<0.5,TOTAL,MTIME);
VVOL:IF(CURRBARSCOUNT=1,VOL*TOTAL/CTIME,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1,VVOL,0,-1,-1),COLOR00C0C0;
JJ:=(HIGH+LOW+CLOSE)/3;QJ0:=VOL/IF(HIGH=LOW,4,HIGH-LOW);
主买:=QJ0*IF(C<O,MIN(CLOSE,OPEN)-LOW,ABS(JJ-MIN(CLOSE,OPEN)));
主卖:=QJ0*IF(C<O,(HIGH-JJ),(HIGH-MAX(OPEN,CLOSE)));
V0:=VOL;
大单差:(主买-主卖),LINETHICK;
STICKLINE(大单差>=0,0,V0,3,0),COLOR2222CC;
STICKLINE(大单差>=0,0,V0,2.5,0),COLOR3333DD;
STICKLINE(大单差>=0,0,V0,2,0),COLOR4444DD;
STICKLINE(大单差>=0,0,V0,1.5,0),COLOR5555EE;
STICKLINE(大单差>=0,0,V0,1,0),COLOR6666EE;
STICKLINE(大单差>=0,0,V0,0.5,0),COLOR9977EE;
STICKLINE(大单差<0,0,V0,3,0),COLORFF7700;
STICKLINE(大单差<0,0,V0,2.5,0),COLORFF8811;
STICKLINE(大单差<0,0,V0,2,0),COLORFFAA22;
STICKLINE(大单差<0,0,V0,1.5,0),COLORFFBB33;
STICKLINE(大单差<0,0,V0,1,0),COLORFFDD44;
STICKLINE(大单差<0,0,V0,0.5,0),COLORFFFF55;
MA5:MA(VOL,5)*2;
MA60:MA(VOL,60)*2;
AA:=SUMBARS(VOL,CAPITAL);
地量:IF(CAPITAL=0,AMOUNT=LLV(AMOUNT,34),VOL<MA(VOL,AA)/3) ,LINETHICK0;
STICKLINE(地量,VOL,0,1,0),COLORYELLOW;
天量:IF(CAPITAL=0,AMOUNT=HHV(AMOUNT,34),VOL>MA(VOL,AA)*3) ,LINETHICK0,COLORFF0000;
STICKLINE(天量,VOL,0,1,0),COLORFF0000;
STICKLINE(大单差>0,0,大单差,2,0),COLOR102088;
STICKLINE(大单差>0,0,大单差,1.5,0),COLOR1020BB;
STICKLINE(大单差>0,0,大单差,1,0),COLOR1020DD;
STICKLINE(大单差>0,0,大单差,0.5,0),COLOR1020EE;
STICKLINE(大单差<0,0,大单差,2,0),COLOR007700;
STICKLINE(大单差<0,0,大单差,1.5,0),COLOR008800;
STICKLINE(大单差<0,0,大单差,1,0),COLOR00AA00;
STICKLINE(大单差<0,0,大单差,0.5,0),COLOR00CC00;
BB:IF(CROSS(0.9,1/VOL*10000>0.01 AND "KDJ.J"<0),VOL*5,0) AND 大单差>0,LINETHICK0;
STICKLINE(BB<0,0,100,1,0),COLORYELLOW,POINTDOT;
RSV:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18))*100;
K:=SMA(RSV,5,1);
D:=SMA(K,3,1);
J:=(3*K-2*D);
M:=EMA(J,3);
E:=EMA(M,3);
A1:=BARSLAST(REF(CROSS(M,E),1));
底背离:=REF(L,A1+1)>L AND M>REF(M,A1+1) AND CROSS(M,E) AND M<20;
B:底背离,LINETHICK0;
STICKLINE(B,0,100,1,0),COLOR00CC00;
X:=LLV(J,2)=LLV(J,8);
VAR1:=LLV(LOW,10);
VAR2:=HHV(HIGH,25);
VAR3:=100*EMA((CLOSE-VAR1)/(VAR2-VAR1),4);
下注:CROSS(J,REF(J+0.01,1)) AND X AND J<0,LINETHICK0;
STICKLINE(下注,0,100,1,0),COLORRED,POINTDOT;
DRAWTEXT(下注,0,'--注★--'),COLORRED;
S:=EMA((CLOSE-LLV(CLOSE,21))/(HHV(CLOSE,21)-LLV(CLOSE,21)),1);
Y:=IF(S>0,MA(S,1),0);
庄:CROSS(Y,REF(Y+0.001,1)) AND J<0,LINETHICK0,COLORFF22AA;
DRAWTEXT(庄,0,'★买'),COLORFF22AA;
STICKLINE(庄,0,100,1,0),COLORFF22AA;
DRAWTEXT(REF(C,BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1))+1)>C AND REF("MACD.DIF",BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1))+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA") >0,MACD.DEA,'★M底'),COLORWHITE;{MACD底背离};
DRAWTEXT(REF(C,BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1))+1)<C AND REF("MACD.DIF",BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1))+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF") >0,MACD.DEA,'☆M顶'),COLORGREEN;{MACD顶背离};
STICKLINE(REF(C,BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1))+1)>C AND REF("MACD.DIF",BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1))+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA")
>0,0,0.03,6,0),COLOR00FF00;
DRAWTEXT(REF(C,BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1))+1)>C AND REF("RSI.RSI1",BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1))+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2")>0,MACD.DEA,'◆R底');{RSI底背离};
DRAWTEXT(REF(C,BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1))+1)<C AND REF("RSI.RSI1",BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1))+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1")>0,MACD.DEA,'◇R顶');{RSI顶背离};
未来函数检测结果如下:
该公式包含未来函数:CAPITAL
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
TOTAL赋值:IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,TOTALFZNUM,1)))))
MTIME赋值:MOD(FROMOPEN,TOTAL)
如果MTIME<0.5返回TOTAL否则返回MTIME
如果CURRBARSCOUNT=1返回成交量*TOTAL/CTIME否则返回DRAWNULL
当满足条件CURRBARSCOUNT=1时,在VVOL和0之间画柱状线
JJ赋值:(最高价+最低价+CLOSE)/3
如果最高价=最低价返回4否则返回最高价-最低价
主买赋值:QJ0*IF(C
主卖赋值:QJ0*IF(C
V0赋值:成交量
输出大单差:(主买-主卖),LINETHICK
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差>=0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
当满足条件大单差<0时,在0和V0之间画柱状线
输出MA5:成交量的5日简单移动平均*2
输出MA60:成交量的60日简单移动平均*2
AA赋值:成交量累加至当前流通股本的天数
输出地量:IF(当前流通股本=0,AMOUNT=34日内AMOUNT最低值,成交量<成交量的AA日简单移动平均/3) ,LINETHICK0
当满足条件地量时,在成交量和0之间画柱状线
输出天量:IF(当前流通股本=0,AMOUNT=34日内AMOUNT最高值,成交量>成交量的AA日简单移动平均*3) ,LINETHICK0,COLORFF0000
当满足条件天量时,在成交量和0之间画柱状线
当满足条件大单差>0时,在0和大单差之间画柱状线
当满足条件大单差>0时,在0和大单差之间画柱状线
当满足条件大单差>0时,在0和大单差之间画柱状线
当满足条件大单差>0时,在0和大单差之间画柱状线
当满足条件大单差<0时,在0和大单差之间画柱状线
当满足条件大单差<0时,在0和大单差之间画柱状线
当满足条件大单差<0时,在0和大单差之间画柱状线
当满足条件大单差<0时,在0和大单差之间画柱状线
输出BB:IF(0.9上穿1/成交量*10000>0.01 AND "KDJ.J"<0,成交量*5,0) AND 大单差>0,LINETHICK0
当满足条件BB<0时,在0和100之间画柱状线
RSV赋值:(CLOSE-18日内最低价最低值)/(18日内最高价最高值-18日内最低价最低值)*100
RSV的5日[1日权重]移动平均
K的3日[1日权重]移动平均
J赋值:(3*K-2*D)
M赋值:J的3日指数移动平均
E赋值:M的3日指数移动平均
A1赋值:上次1日前的M上穿E距今天数
底背离赋值:A1+1日前的L>L AND M>A1+1日前的M AND M上穿E AND M<20
输出B:底背离,LINETHICK0
当满足条件B时,在0和100之间画柱状线
X赋值:2日内J最低值=8日内J最低值
VAR1赋值:10日内最低价最低值
VAR2赋值:25日内最高价最高值
VAR3赋值:100*EMA((CLOSE-VAR1)/(VAR2-VAR1),4)
输出下注:CROSS(J,1日前的J+0.01) AND X AND J<0,LINETHICK0
当满足条件下注时,在0和100之间画柱状线
当满足条件下注时,在0和'--注★--'位置书写文字
S赋值:EMA((CLOSE-21日内CLOSE最低值)/(21日内CLOSE最高值-21日内CLOSE最低值),1)
Y赋值:IF(S>0,S的1日简单移动平均,0)
输出庄:CROSS(Y,1日前的Y+0.001) AND J<0,LINETHICK0,COLORFF22AA
当满足条件庄时,在0和'★买'位置书写文字
当满足条件庄时,在0和100之间画柱状线
DRAWTEXT(REF(C,上次REF("MACD.DIF"上穿"MACD.DEA",1距今天数)+1)>C AND REF("MACD.DIF",上次REF("MACD.DIF"上穿"MACD.DEA",1距今天数)+1)<"MACD.DIF" AND "MACD.DIF"上穿"MACD.DEA" >0,MACD.DEA,'★M底'),COLORWHITE
{MACD底背离}
DRAWTEXT(REF(C,上次REF("MACD.DEA"上穿"MACD.DIF",1距今天数)+1)"MACD.DIF" AND "MACD.DEA"上穿"MACD.DIF" >0,MACD.DEA,'☆M顶'),COLORGREEN
{MACD顶背离}
STICKLINE(REF(C,上次REF("MACD.DIF"上穿"MACD.DEA",1距今天数)+1)>C AND REF("MACD.DIF",上次REF("MACD.DIF"上穿"MACD.DEA",1距今天数)+1)<"MACD.DIF" AND "MACD.DIF"上穿"MACD.DEA"
>0,0,0.03,6,0),COLOR00FF00
DRAWTEXT(REF(C,上次REF("RSI.RSI1"上穿"RSI.RSI2",1距今天数)+1)>C AND REF("RSI.RSI1",上次REF("RSI.RSI1"上穿"RSI.RSI2",1距今天数)+1)<"RSI.RSI1" AND "RSI.RSI1"上穿"RSI.RSI2">0,MACD.DEA,'◆R底')
{RSI底背离}
DRAWTEXT(REF(C,上次REF("RSI.RSI2"上穿"RSI.RSI1",1距今天数)+1)"RSI.RSI1" AND "RSI.RSI2"上穿"RSI.RSI1">0,MACD.DEA,'◇R顶')
{RSI顶背离}