趋势转折-无未来的转折线(付飞狐源码)
{通达信用的:}
{INPUT: N(3,1,100);}
N:=3;
{转折}
Z_1:=(EMA(C,N)-REF(EMA(C,N),1))/REF(EMA(C,N),1)*100;
Z_2:=IF(Z_1<0,REF(Z_1,BARSLAST(CROSS(0,Z_1))+1),0);
Z_3:=IF(Z_1>0,REF(Z_1,BARSLAST(CROSS(0,Z_1))+1),0);
Z_4:=IF(CROSS(0,Z_1),H,L);
DRAWLINE(CROSS(Z_2,Z_3),H,CROSS(Z_3,Z_2),L,0),LINETHICK2,COLORWHITE;
DRAWLINE(CROSS(Z_3,Z_2),L,CROSS(Z_2,Z_3),H,0),LINETHICK2,COLORMAGENTA;
DRAWLINE(CROSS(0,Z_1)||CROSS(Z_1,0),Z_4,ISLASTBAR,Z_4,0),LINETHICK2,COLORGREEN;
来函数检测结果如下:
该公式没有未来函数
解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
{通达信用的:}
{INPUT: N(3,1,100)
}
N赋值:3
{转折}
Z_1赋值:(C的N日指数移动平均-1日前的C的N日指数移动平均)/1日前的C的N日指数移动平均*100
Z_2赋值:IF(Z_1<0,REF(Z_1,上次0上穿Z_1距今天数+1),0)
Z_3赋值:IF(Z_1>0,REF(Z_1,上次0上穿Z_1距今天数+1),0)
Z_4赋值:IF(0上穿Z_1,H,L)
DRAWLINE(Z_2上穿Z_3,H,Z_3上穿Z_2,L,0), 线宽为2,画白色
DRAWLINE(Z_3上穿Z_2,L,Z_2上穿Z_3,H,0), 线宽为2,画洋红色
DRAWLINE(0上穿Z_1||Z_1上穿0,Z_4,ISLASTBAR,Z_4,0), 线宽为2,画绿色