多空通道九转通达信公式 主图 源码附图
E1:=EXPMA(C,5);
E2:=EXPMA(C,10);
E3:=EXPMA(C,20);
E4:=EXPMA(C,30);
E5:=EXPMA(C,60);
VARE1:=(E1+E2+E3+E4)/4;
VARE2:=(E1+E2+E3+E5)/4;
N:=IF(CODELIKE('9999')OR CODELIKE('3990')OR CODELIKE('880')OR CODELIKE('0000'),1,0);
D1:=IF(N=1,0.013,0.03);
D2:=IF(N=1,0.018,0.03);
C1:=IF(N=1,0.015,0.03);
C2:=IF(N=1,0.015,0.03);
短线多:EXPMA(VARE1,5)+EXPMA(VARE1,5)*D1,COLORRED;
短线空:EXPMA(VARE1,5)-EXPMA(VARE1,5)*D2,COLORRED;
长线多:EXPMA(VARE2,70)+EXPMA(VARE2,70)*C1,COLORMAGENTA;
长线空:EXPMA(VARE2,70)-EXPMA(VARE2,70)*C2,COLORMAGENTA;
{DRAWKLINE(H,O,L,C);}
TJ1:=RANGE(C,短线空,短线多);
TJ2:=RANGE(C,长线空,长线多);
STICKLINE(短线多>REF(短线多,1) AND TJ1=0,短线多,短线空,0.1,1),COLORRED;
STICKLINE(短线多<REF(短线多,1) AND TJ1=0,短线多,短线空,0.1,1),COLORGREEN;
STICKLINE(长线多>REF(长线多,1) AND TJ2=0,长线多,长线空,0.1,1),COLORMAGENTA;
STICKLINE(长线多<REF(长线多,1) AND TJ2=0,长线多,长线空,0.1,1),COLORBLUE;
NOTEXT短线多:IF(短线多<REF(短线多,1),短线多,DRAWNULL),COLORGREEN;
NOTEXT短线空:IF(短线空<REF(短线空,1),短线空,DRAWNULL),COLORGREEN;
NOTEXT长线多:IF(长线多<REF(长线多,1),长线多,DRAWNULL),COLORBLUE;
NOTEXT长线空:IF(长线空<REF(长线空,1),长线空,DRAWNULL),COLORBLUE;
空:=REF(C,1)>REF(短线空,1) AND C<短线空 AND C<REF(C,1){ AND COUNT(C>短线多,5)>0};
多:=REF(C,1)<REF(短线多,1) AND C>短线多 AND C>REF(C,1){ AND COUNT(C<长线多,5)>0};
空1:=TFILTER(多,空,2);
多1:=TFILTER(多,空,1);
DRAWTEXT(空1,短线多*1.04,'空'),COLORGREEN;
DRAWTEXT(多1,短线空*0.96,'多'),COLORRED;
DRAWICON(空1,短线多*1.02,2);
DRAWICON(多1,短线空*0.98,1);
A1:=C>REF(C,4);
A2:=BARSLASTCOUNT(A1);
A3:=REF(A2,1)=8 AND A2>REF(A2,1);
A4:=REF(BETWEEN(A2,5,8),1) AND A2<REF(A2,1);
A5:=ISLASTBAR AND BETWEEN(A2,6,8);
A6:=(BACKSET(A3>0,9) OR BACKSET(A4>0,A2+1)*0 OR BACKSET(A5>0,A2))*A2;
DRAWTEXT(A6>0,H+H*0.02,VAR2STR(A6,0)),COLORFF00FF{COLOR00FFFF};
DRAWTEXT(A2=9,H+H*0.02,'9'),COLOR00FF00;
B1:=C<REF(C,4);
B2:=BARSLASTCOUNT(B1);
B3:=REF(B2,1)=8 AND B2>REF(B2,1);
B4:=REF(BETWEEN(B2,5,8),1) AND B2<REF(B2,1);
B5:=ISLASTBAR AND BETWEEN(B2,6,8);
B6:=(BACKSET(B3>0,9) OR BACKSET(B4>0,B2+1)*0 OR BACKSET(B5>0,B2))*B2;
DRAWTEXT(B6>0,L-L*0.02,VAR2STR(B6,0)),COLOR00FF00{COLORFFFFFF};
DRAWTEXT(B2=9,L-L*0.02,'9'),COLORFF00FF;
DRAWTEXT_FIX(1,0.00,0.00,0,'股票指标网'),COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
E1赋值:C的5日指数移动平均
E2赋值:C的10日指数移动平均
E3赋值:C的20日指数移动平均
E4赋值:C的30日指数移动平均
E5赋值:C的60日指数移动平均
VARE1赋值:(E1+E2+E3+E4)/4
VARE2赋值:(E1+E2+E3+E5)/4
N赋值:IF(CODELIKE('9999')OR CODELIKE('3990')OR CODELIKE('880')OR CODELIKE('0000'),1,0)
如果N=1返回0.013否则返回0.03
如果N=1返回0.018否则返回0.03
如果N=1返回0.015否则返回0.03
如果N=1返回0.015否则返回0.03
输出短线多:VARE1的5日指数移动平均+VARE1的5日指数移动平均*D1,画红色
输出短线空:VARE1的5日指数移动平均-VARE1的5日指数移动平均*D2,画红色
输出长线多:VARE2的70日指数移动平均+VARE2的70日指数移动平均*C1,COLORMAGENTA
输出长线空:VARE2的70日指数移动平均-VARE2的70日指数移动平均*C2,COLORMAGENTA
{DRAWKLINE(H,O,L,C)
}
TJ1赋值:RANGE(C,短线空,短线多)
TJ2赋值:RANGE(C,长线空,长线多)
STICKLINE(短线多>1日前的短线多 AND TJ1=0,短线多,短线空,0.1,1),画红色
STICKLINE(短线多<1日前的短线多 AND TJ1=0,短线多,短线空,0.1,1),COLORGREEN
STICKLINE(长线多>1日前的长线多 AND TJ2=0,长线多,长线空,0.1,1),COLORMAGENTA
STICKLINE(长线多<1日前的长线多 AND TJ2=0,长线多,长线空,0.1,1), 画蓝色
NOTEXT输出短线多:IF(短线多<1日前的短线多,短线多,DRAWNULL),COLORGREEN
NOTEXT输出短线空:IF(短线空<1日前的短线空,短线空,DRAWNULL),COLORGREEN
NOTEXT输出长线多:IF(长线多<1日前的长线多,长线多,DRAWNULL), 画蓝色
NOTEXT输出长线空:IF(长线空<1日前的长线空,长线空,DRAWNULL), 画蓝色
空赋值:1日前的C>1日前的短线空 AND C<短线空 AND C<1日前的C{ AND 统计5日满足C>短线多的天数>0}
多赋值:1日前的C<1日前的短线多 AND C>短线多 AND C>1日前的C{ AND 统计5日满足C<长线多的天数>0}
空1:=TFILTER(多,空,2)
多1:=TFILTER(多,空,1)
当满足条件空1时,在短线多*1.04和'空'位置书写文字
当满足条件多1时,在短线空*0.96和'多'位置书写文字
当满足条件空1时,在短线多*1.02和2之间画图标
当满足条件多1时,在短线空*0.98和1之间画图标
A1赋值:C>4日前的C
A2赋值:BARSLASTCOUNT(A1)
A3赋值:1日前的A2=8 AND A2>1日前的A2
A4赋值:REF(BETWEEN(A2,5,8),1) AND A2[
A5赋值:ISLASTBAR AND BETWEEN(A2,6,8)]
A6赋值:(BACKSET(A3>0,9) OR BACKSET(A4>0,A2+1)*0 OR BACKSET(A5>0,A2))*A2
DRAWTEXT(A6>0,H+H*0.02,VAR2STR(A6,0)),COLORFF00FF{COLOR00FFFF}
当满足条件A2=9时,在H+H*0.02和'9'位置书写文字
B1赋值:C<4日前的C
B2赋值:BARSLASTCOUNT(B1)
B3赋值:1日前的B2=8 AND B2>1日前的B2
B4赋值:REF(BETWEEN(B2,5,8),1) AND B2[
B5赋值:ISLASTBAR AND BETWEEN(B2,6,8)]
B6赋值:(BACKSET(B3>0,9) OR BACKSET(B4>0,B2+1)*0 OR BACKSET(B5>0,B2))*B2
DRAWTEXT(B6>0,L-L*0.02,VAR2STR(B6,0)),COLOR00FF00{COLORFFFFFF}
当满足条件B2=9时,在L-L*0.02和'9'位置书写文字
当满足条件1时,在横轴0.00纵轴0.00位置书写文字