通达信多周期均线粘合同图显示副图指标 源码分享 附图
N:=5;
M:=3;
JX5:=MA(C,5);JX13:=MA(C,13);JX24:=MA(C,24);JX60:=MA(C,60);JX120:=MA(C,120);JX250:=MA(C,250);
{以下三线粘合}
NHD1:=100*(MAX(JX5,MAX(JX13,JX24))/MIN(JX5,MIN(JX13,JX24))-1); {JX5 JX13 JX24粘合}
NHD2:=100*(MAX(JX13,MAX(JX24,JX60))/MIN(JX13,MIN(JX24,JX60))-1); {JX13 JX24 JX60粘合}
NHD3:=100*(MAX(JX24,MAX(JX60,JX120))/MIN(JX24,MIN(JX60,JX120))-1); {JX24 JX60 JX120粘合}
NHD4:=100*(MAX(JX60,MAX(JX120,JX250))/MIN(JX60,MIN(JX120,JX250))-1); {JX60 JX120 JX250粘合}
{以下四线粘合}
NHD5:=100*(MAX(JX5,MAX(JX13,MAX(JX24,JX60)))/MIN(JX5,MIN(JX13,MIN(JX24,JX60)))-1); {JX5 JX13 JX24 JX60粘合}
NHD6:=100*(MAX(JX13,MAX(JX24,MAX(JX60,JX120)))/MIN(JX13,MIN(JX24,MIN(JX60,JX120)))-1); {JX13 JX24 JX60 JX120粘合}
NHD7:=100*(MAX(JX24,MAX(JX60,MAX(JX120,JX250)))/MIN(JX24,MIN(JX60,MIN(JX120,JX250)))-1); {JX24 JX60 JX120 JX250粘合}
{以下五线粘合}
NHD8:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX120))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX120))))-1); {JX5 JX13 JX24 JX60 JX120粘合}
NHD9:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX250))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX250))))-1); {JX5 JX13 JX24 JX60 JX250粘合}
NHD10:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX120,JX250))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX120,JX250))))-1); {JX5 JX13 JX24 JX120 JX250粘合}
NHD11:=100*(MAX(JX5,MAX(JX13,MAX(JX60,MAX(JX120,JX250))))/MIN(JX5,MIN(JX13,MIN(JX60,MIN(JX120,JX250))))-1); {JX5 JX13 JX60 JX120 JX250粘合}
NHD12:=100*(MAX(JX5,MAX(JX24,MAX(JX60,MAX(JX120,JX250))))/MIN(JX5,MIN(JX24,MIN(JX60,MIN(JX120,JX250))))-1); {JX5 JX24 JX60 JX120 JX250粘合}
NHD13:=100*(MAX(JX13,MAX(JX24,MAX(JX60,MAX(JX120,JX250))))/MIN(JX13,MIN(JX24,MIN(JX60,MIN(JX120,JX250))))-1); {JX13 JX24 JX60 JX120 JX250粘合}
{以下六线粘合}
NHD14:=100 * (MAX(JX5, MAX(JX13, MAX(JX24, MAX(JX60, MAX(JX120, JX250))))) / MIN(JX5, MIN(JX13, MIN(JX24, MIN(JX60, MIN(JX120, JX250))))) - 1);
NF1:=EVERY(REF(NHD1,1)>NHD1,M) AND NHD1<N ;
NF2:=EVERY(REF(NHD2,1)>NHD2,M) AND NHD2<N;
NF3:=EVERY(REF(NHD3,1)>NHD3,M) AND NHD3<N;
NF4:=EVERY(REF(NHD4,1)>NHD4,M) AND NHD4<N ;
NF5:=EVERY(REF(NHD5,1)>NHD5,M) AND NHD5<N ;
NF6:=EVERY(REF(NHD6,1)>NHD6,M) AND NHD6<N;
NF7:=EVERY(REF(NHD7,1)>NHD7,M) AND NHD7<N;
NF8:=EVERY(REF(NHD8,1)>NHD8,M) AND NHD8<N ;
NF9:=EVERY(REF(NHD9,1)>NHD9,M) AND NHD9<N ;
NF10:=EVERY(REF(NHD10,1)>NHD10,M) AND NHD10<N;
NF11:=EVERY(REF(NHD11,1)>NHD11,M) AND NHD11<N;
NF12:=EVERY(REF(NHD12,1)>NHD12,M) AND NHD12<N;
NF13:=EVERY(REF(NHD13,1)>NHD13,M) AND NHD13<N;
NF14:=EVERY(REF(NHD14,1)>NHD14,M) AND NHD14<N;
1.05,POINTDOT,COLORWHITE;
{以下判断均线粘合情形,3条 4条 5条 还是6条}
NH3:=IF(NF1 OR NF2 OR NF3 OR NF4,3,0);
NH4:=IF(NF5 OR NF6 OR NF7,4,0);
NH5:=IF(NF8 OR NF9 OR NF10 OR NF11 OR NF12 OR NF13,5,0);
NH6:=IF(NF14,6,0);
{以下条状显示相邻均线粘合情况:51324 5132460 5132460120 5132460250 60120250 2460120250}
STICKLINE(NF1,0,0.8,1,0),COLORE47833;
STICKLINE(NF5,0,0.8,1,0),COLOR32CD32;
STICKLINE(NF8,0,0.8,1,0),COLOR0B86B8;
STICKLINE(NF14,0,0.8,1,0),COLORCD00CD;
三粘:100*(MAX(JX5,MAX(JX13,JX24))/MIN(JX5,MIN(JX13,JX24))-1),COLORE47833,NODRAW; {JX5 JX13 JX24粘合}
四粘:100*(MAX(JX5,MAX(JX13,MAX(JX24,JX60)))/MIN(JX5,MIN(JX13,MIN(JX24,JX60)))-1),COLOR32CD32,NODRAW; {JX5 JX13 JX24 JX60粘合}
五粘:100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX120))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX120))))-1),COLOR0B86B8,NODRAW; {JX5 JX13 JX24 JX60 JX120粘合}
六粘:100 * (MAX(JX5, MAX(JX13, MAX(JX24, MAX(JX60, MAX(JX120, JX250))))) / MIN(JX5, MIN(JX13, MIN(JX24, MIN(JX60, MIN(JX120, JX250))))) - 1),COLORCD00CD,NODRAW;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
N赋值:5
M赋值:3
JX5赋值:C的5日简单移动平均
JX13赋值:C的13日简单移动平均
JX24赋值:C的24日简单移动平均
JX60赋值:C的60日简单移动平均
JX120赋值:C的120日简单移动平均
JX250赋值:C的250日简单移动平均
{以下三线粘合}
NHD1:=100*(MAX(JX5,MAX(JX13,JX24))/MIN(JX5,MIN(JX13,JX24))-1)
{JX5 JX13 JX24粘合}
NHD2:=100*(MAX(JX13,MAX(JX24,JX60))/MIN(JX13,MIN(JX24,JX60))-1)
{JX13 JX24 JX60粘合}
NHD3:=100*(MAX(JX24,MAX(JX60,JX120))/MIN(JX24,MIN(JX60,JX120))-1)
{JX24 JX60 JX120粘合}
NHD4:=100*(MAX(JX60,MAX(JX120,JX250))/MIN(JX60,MIN(JX120,JX250))-1)
{JX60 JX120 JX250粘合}
{以下四线粘合}
NHD5:=100*(MAX(JX5,MAX(JX13,MAX(JX24,JX60)))/MIN(JX5,MIN(JX13,MIN(JX24,JX60)))-1)
{JX5 JX13 JX24 JX60粘合}
NHD6:=100*(MAX(JX13,MAX(JX24,MAX(JX60,JX120)))/MIN(JX13,MIN(JX24,MIN(JX60,JX120)))-1)
{JX13 JX24 JX60 JX120粘合}
NHD7:=100*(MAX(JX24,MAX(JX60,MAX(JX120,JX250)))/MIN(JX24,MIN(JX60,MIN(JX120,JX250)))-1)
{JX24 JX60 JX120 JX250粘合}
{以下五线粘合}
NHD8:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX120))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX120))))-1)
{JX5 JX13 JX24 JX60 JX120粘合}
NHD9:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX250))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX250))))-1)
{JX5 JX13 JX24 JX60 JX250粘合}
NHD10:=100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX120,JX250))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX120,JX250))))-1)
{JX5 JX13 JX24 JX120 JX250粘合}
NHD11:=100*(MAX(JX5,MAX(JX13,MAX(JX60,MAX(JX120,JX250))))/MIN(JX5,MIN(JX13,MIN(JX60,MIN(JX120,JX250))))-1)
{JX5 JX13 JX60 JX120 JX250粘合}
NHD12:=100*(MAX(JX5,MAX(JX24,MAX(JX60,MAX(JX120,JX250))))/MIN(JX5,MIN(JX24,MIN(JX60,MIN(JX120,JX250))))-1)
{JX5 JX24 JX60 JX120 JX250粘合}
NHD13:=100*(MAX(JX13,MAX(JX24,MAX(JX60,MAX(JX120,JX250))))/MIN(JX13,MIN(JX24,MIN(JX60,MIN(JX120,JX250))))-1)
{JX13 JX24 JX60 JX120 JX250粘合}
{以下六线粘合}
NHD14:=100 * (MAX(JX5, MAX(JX13, MAX(JX24, MAX(JX60, MAX(JX120, JX250))))) / MIN(JX5, MIN(JX13, MIN(JX24, MIN(JX60, MIN(JX120, JX250))))) - 1)
NF1:=EVERY(1日前的NHD1>NHD1,M) AND NHD1
NF2:=EVERY(1日前的NHD2>NHD2,M) AND NHD2
NF3:=EVERY(1日前的NHD3>NHD3,M) AND NHD3
NF4:=EVERY(1日前的NHD4>NHD4,M) AND NHD4
NF5:=EVERY(1日前的NHD5>NHD5,M) AND NHD5
NF6:=EVERY(1日前的NHD6>NHD6,M) AND NHD6
NF7:=EVERY(1日前的NHD7>NHD7,M) AND NHD7
NF8:=EVERY(1日前的NHD8>NHD8,M) AND NHD8
NF9:=EVERY(1日前的NHD9>NHD9,M) AND NHD9
NF10:=EVERY(1日前的NHD10>NHD10,M) AND NHD10
NF11:=EVERY(1日前的NHD11>NHD11,M) AND NHD11
NF12:=EVERY(1日前的NHD12>NHD12,M) AND NHD12
NF13:=EVERY(1日前的NHD13>NHD13,M) AND NHD13
NF14:=EVERY(1日前的NHD14>NHD14,M) AND NHD14
1.05,POINTDOT,画白色
如果NF1 OR NF2 OR NF3 OR NF4返回3否则返回0
如果NF5 OR NF6 OR NF7返回4否则返回0
如果NF8 OR NF9 OR NF10 OR NF11 OR NF12 OR NF13返回5否则返回0
如果NF14返回6否则返回0
当满足条件NF1时,在0和0.8之间画柱状线
当满足条件NF5时,在0和0.8之间画柱状线
当满足条件NF8时,在0和0.8之间画柱状线
当满足条件NF14时,在0和0.8之间画柱状线
输出三粘:100*(MAX(JX5,MAX(JX13,JX24))/MIN(JX5,MIN(JX13,JX24))-1),COLORE47833,NODRAW
{JX5 JX13 JX24粘合}
四粘:100*(MAX(JX5,MAX(JX13,MAX(JX24,JX60)))/MIN(JX5,MIN(JX13,MIN(JX24,JX60)))-1),COLOR32CD32,NODRAW
{JX5 JX13 JX24 JX60粘合}
五粘:100*(MAX(JX5,MAX(JX13,MAX(JX24,MAX(JX60,JX120))))/MIN(JX5,MIN(JX13,MIN(JX24,MIN(JX60,JX120))))-1),COLOR0B86B8,NODRAW
{JX5 JX13 JX24 JX60 JX120粘合}
六粘:100 * (MAX(JX5, MAX(JX13, MAX(JX24, MAX(JX60, MAX(JX120, JX250))))) / MIN(JX5, MIN(JX13, MIN(JX24, MIN(JX60, MIN(JX120, JX250))))) - 1),COLORCD00CD,NODRAW