通达信【套利分时】有买有卖不普通 用法详解 源码附图
VAR1:=MAX(DYNAINFO(3),DYNAINFO(5));
VAR2:=MIN(DYNAINFO(3),DYNAINFO(6));
VAR3:=VAR1-VAR2;
VAR4:=(EMA(CLOSE,12)-EMA(CLOSE,26))+DYNAINFO(3);
VAR5:=EMA(VAR4,9);
VAR6:=10*(VAR4-VAR5);
VAR7:=EMA(VAR6,2);
VAR8:=SUM(AMOUNT,BARSCOUNT(CLOSE))/SUM(V*100,BARSCOUNT(CLOSE));
VAR9:=EXPMA(CLOSE/VAR8,20);
VAR10:=YEAR AND MONTH AND DAY;
VAR11:=STRCAT(CON2STR(YEAR,0),'年');
VAR12:=STRCAT(CON2STR(MONTH,0),'月');
VAR13:=STRCAT(CON2STR(DAY,0),'日');
VAR14:=STRCAT('星期',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
VAR15:=STRCAT(STRCAT(STRCAT(VAR11,VAR12),STRCAT(VAR13,VAR14)),'');
VAR16:=V*C/100;
VAR17:=SUM((IF(((VAR16/8>20) AND (CLOSE>(REF(CLOSE,1)))),VAR16,0)),0);
VAR18:=SUM((IF(((VAR16/8>20) AND (CLOSE<(REF(CLOSE,1)))),VAR16,0)),0);
VAR26:=SUM((IF(((VAR16/8<20) AND (CLOSE>(REF(CLOSE,1)))),VAR16,0)),0);
VAR28:=SUM((IF(((VAR16/8<20) AND (CLOSE<(REF(CLOSE,1)))),VAR16,0)),0);
XG:HHV(H,480),DOTLINE,COLORCYAN;
阻力:VAR2+VAR3*8/9,COLORLIRED,DOTLINE;
支撑:VAR2+VAR3*0.5/9,COLORGREEN,DOTLINE;
均线:IF(BETWEEN(C/(SUM(AMOUNT,0)/SUM(VOL*100,0)),1.05,0.95)=0,MA(C,0),(SUM(AMOUNT,0)/SUM(VOL*100,0))),COLORYELLOW,DOTLINE;
STICKLINE(VAR6>=VAR7 AND VAR6>=0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLIGRAY;
STICKLINE(VAR6<VAR7 AND VAR6>0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLICYAN;
STICKLINE(VAR6>=VAR7 AND VAR6<0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLIGRAY;
STICKLINE(VAR6<VAR7 AND VAR6<0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLIGREEN;
DRAWTEXT(CROSS(VAR9,1.02),C*0.999,' 拉'),COLORMAGENTA;
DRAWICON(CROSS(VAR9,1.04),C,45);
DRAWTEXT(CROSS(VAR9,1.04),C*0.999,' 冲'),COLORRED;
DRAWTEXT(LONGCROSS(支撑,C,2),C-0.01,' 买入'),COLOR0000FF;
DRAWICON(LONGCROSS(支撑,C,2),C-0.01,1);
STICKLINE(LONGCROSS(支撑,C,2),C,阻力,0,-1),COLORCYAN;
DRAWTEXT(LONGCROSS(C,阻力,2),C+0.01,' 卖出'),COLORGREEN;
DRAWICON(LONGCROSS(C,阻力,2),C+0.01,45);
STICKLINE(LONGCROSS(C,阻力,2),C,支撑,0,-1),COLORRED;
DRAWTEXT_FIX(VAR10,0.905,0,0,VAR15),COLORGRAY;
DRAWTEXT_FIX(1,0.752,1-0.088,0,STRCAT(STRCAT('【机构买盘】',CON2STR(VAR17,2)),' 万')),COLORRED;
DRAWTEXT_FIX(1,0.752,1-0.001,0,STRCAT(STRCAT('【机构卖盘】',CON2STR(VAR18,2)),' 万')),COLORGREEN;
DRAWTEXT_FIX(1,0.883,1-0.088,0,STRCAT(STRCAT('【散户买盘】',CON2STR(VAR26,2)),' 万')),COLORMAGENTA;
DRAWTEXT_FIX(1,0.883,1-0.001,0,STRCAT(STRCAT('【散户卖盘】',CON2STR(VAR28,2)),' 万')),COLORCYAN;
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
VAR1赋值:MAX(DYNAINFO(3),DYNAINFO(5))
VAR2赋值:MIN(DYNAINFO(3),DYNAINFO(6))
VAR3赋值:VAR1-VAR2
VAR4赋值:(收盘价的12日指数移动平均-收盘价的26日指数移动平均)+DYNAINFO(3)
VAR5赋值:VAR4的9日指数移动平均
VAR6赋值:10*(VAR4-VAR5)
VAR7赋值:VAR6的2日指数移动平均
VAR8赋值:SUM(成交额,收盘价的有效数据周期数)/SUM(V*100,收盘价的有效数据周期数)
VAR9赋值:收盘价/VAR8的20日指数移动平均
VAR10:=YEAR AND MONTH AND DAY
VAR11:=STRCAT(CON2STR(YEAR,0),'年')
VAR12:=STRCAT(CON2STR(MONTH,0),'月')
VAR13:=STRCAT(CON2STR(DAY,0),'日')
VAR14:=STRCAT('星期',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))))
VAR15:=STRCAT(STRCAT(STRCAT(VAR11,VAR12),STRCAT(VAR13,VAR14)),'')
VAR16:=V*C/100
VAR17:=SUM((IF(((VAR16/8>20) AND (收盘价>(1日前的收盘价))),VAR16,0)),0)
VAR18:=SUM((IF(((VAR16/8>20) AND (收盘价<(1日前的收盘价))),VAR16,0)),0)
VAR26:=SUM((IF(((VAR16/8<20) AND (收盘价>(1日前的收盘价))),VAR16,0)),0)
VAR28:=SUM((IF(((VAR16/8<20) AND (收盘价<(1日前的收盘价))),VAR16,0)),0)
输出XG:480日内H最高值,DOTLINE,画青色
输出阻力:VAR2+VAR3*8/9,COLORLIRED,DOTLINE
输出支撑:VAR2+VAR3*0.5/9,画绿色,DOTLINE
输出均线:IF(BETWEEN(C/(0的成交额日累和/0的成交量*100日累和),1.05,0.95)=0,C的0日简单移动平均,(0的成交额日累和/0的成交量*100日累和)),画黄色,DOTLINE
STICKLINE(VAR6>=VAR7 AND VAR6>=0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLIGRAY
STICKLINE(VAR60,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLICYAN
STICKLINE(VAR6>=VAR7 AND VAR6<0,DYNAINFO(3),VAR6+DYNAINFO(3),0,-1),COLORLIGRAY
STICKLINE(VAR6
DRAWTEXT(VAR9上穿1.02,C*0.999,' 拉'),画洋红色
DRAWICON(VAR9上穿1.04,C,45)
DRAWTEXT(VAR9上穿1.04,C*0.999,' 冲'),画红色
DRAWTEXT(LONGCROSS(支撑,C,2),C-0.01,' 买入'),COLOR0000FF
DRAWICON(LONGCROSS(支撑,C,2),C-0.01,1)
STICKLINE(LONGCROSS(支撑,C,2),C,阻力,0,-1),画青色
DRAWTEXT(LONGCROSS(C,阻力,2),C+0.01,' 卖出'),画绿色
DRAWICON(LONGCROSS(C,阻力,2),C+0.01,45)
STICKLINE(LONGCROSS(C,阻力,2),C,支撑,0,-1),画红色
当满足条件VAR10时,在横轴0.905纵轴0位置书写文字
DRAWTEXT_FIX(1,0.752,1-0.088,0,STRCAT(STRCAT('【机构买盘】',CON2STR(VAR17,2)),' 万')),画红色
DRAWTEXT_FIX(1,0.752,1-0.001,0,STRCAT(STRCAT('【机构卖盘】',CON2STR(VAR18,2)),' 万')),画绿色
DRAWTEXT_FIX(1,0.883,1-0.088,0,STRCAT(STRCAT('【散户买盘】',CON2STR(VAR26,2)),' 万')),画洋红色
DRAWTEXT_FIX(1,0.883,1-0.001,0,STRCAT(STRCAT('【散户卖盘】',CON2STR(VAR28,2)),' 万')),画青色