通达信【优化老鸭头】主图 空中加油涨不愁 用法详解 源码
MA5:MA(CLOSE,5),DOTLINE;
MA10:MA(CLOSE,10),DOTLINE;
VAR1:=BARSLAST(CROSS(MA10,MA5));
VAR2:=BARSLAST(CROSS(MA5,MA10));
VAR18:=FINDHIGHBARS(HIGH,VAR1+1,5,1);
VAR19:=FINDLOWBARS(LOW,VAR2+1,5,1);
A:REF(H,BARSLAST(CURRBARSCOUNT=CONST(VAR18)+1)),COLORRED;
B:REF(L,BARSLAST(CURRBARSCOUNT=CONST(VAR19)+1)),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=CONST(VAR18)+1,H,'死叉5天前最高'),COLORYELLOW,DRAWABOVE;
DRAWTEXT(CURRBARSCOUNT=CONST(VAR19)+1,L,' 金叉5天前最低'),COLORYELLOW,DRAWABOVE;
DRAWTEXT(CURRBARSCOUNT=CONST(VAR1)+1,MA5,'死叉'),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=CONST(VAR2)+1,MA5,'金叉'),COLORRED;
DRAWICON(CONST(VAR18)>CONST(VAR19) AND COUNT(C>A,VAR18)=1 AND C>A AND C/B<1.2,H,1);
未来函数检测结果如下:
该公式包含未来函数:DHIGH
该公式包含未来函数:DLOW
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
输出MA5:收盘价的5日简单移动平均,DOTLINE
输出MA10:收盘价的10日简单移动平均,DOTLINE
VAR1赋值:上次MA10上穿MA5距今天数
VAR2赋值:上次MA5上穿MA10距今天数
VAR18:=FIND最高价BARS(最高价,VAR1+1,5,1)
VAR19:=FIND最低价BARS(最低价,VAR2+1,5,1)
输出A:REF(H,上次CURRBARSCOUNT=CONST(VAR18距今天数+1)),画红色
输出B:REF(L,上次CURRBARSCOUNT=CONST(VAR19距今天数+1)),画绿色
DRAWTEXT(CURRBARSCOUNT=CONST(VAR18)+1,H,'死叉5天前最高'),画黄色,DRAWABOVE
DRAWTEXT(CURRBARSCOUNT=CONST(VAR19)+1,L,' 金叉5天前最低'),画黄色,DRAWABOVE
DRAWTEXT(CURRBARSCOUNT=CONST(VAR1)+1,MA5,'死叉'),画绿色
DRAWTEXT(CURRBARSCOUNT=CONST(VAR2)+1,MA5,'金叉'),画红色
DRAWICON(CONST(VAR18)>CONST(VAR19) AND 统计VAR18日满足C>A的天数=1 AND C>A AND C/B<1.2,H,1)