「翔博精选指标」量学趋势主图123Q4(通达信公式 主图 源码 测试
2021-11-20原创 编 辑:翔博软件
{P:=10;}
趋势:ZIG(3,P);
↑:TROUGHBARS(3,P,1),COLOR0000FF,NODRAW;
↓:PEAKBARS(3,P,1),COLOR00FF00,NODRAW;
低:IF(↑=0,C,IF(↓<↑,TROUGH(3,P,1),REF(TROUGH(3,P,1),1))),COLOR00FFFF,,POINTDOT;
高:IF(↓=0,C,IF(↑<↓,PEAK(3,P,1),REF(PEAK(3,P,1),1))),COLOR00FF00,,POINTDOT;
①:IF(↓<↑,REF(高,↑),REF(低,↓)),COLOR0000FF,NODRAW;
②:IF(↓<↑,REF(低,↓),REF(高,↑)),COLOR00FFFF,NODRAW;
③:IF(↓<↑,高,低),COLORFFFFFF,NODRAW;
④:②*③/①,COLOR00FF00,NODRAW;
涨%:IF(↑<↓,(C/低-1)*100,REF((C/低-1)*100,↓)),COLOR0000FF,NODRAW;
跌%:IF(↓<↑,(C/高-1)*100,REF((C/高-1)*100,↑)),COLORFF0000,NODRAW;
{以下设置主图显示方式}
上:IF(趋势>REF(趋势,1),趋势,DRAWNULL),COLORRED,LINETHICK2;
下:IF(趋势<REF(趋势,1),趋势,DRAWNULL),COLOR00FF00,LINETHICK2;
STICKLINE(↑=0,H*1.01,REF(高,1),0,0),COLOR00FF00;
STICKLINE(↓=0,L*0.99,REF(低,1),0,0),COLORFF00FF;
STICKLINE(BETWEEN(↑,0,6),低,低,3,0),COLOR00FFFF;
STICKLINE(BETWEEN(↓,0,6),高,高,3,0),COLOR00FF00;
DRAWTEXT(↓=0,趋势*1.01,'←高'),COLOR0000FF;
DRAWTEXT(↑=0,趋势,'←低'),COLORFFFFFF;
{以下设置自动提示文字}
AA:=CONST(LLV(L,120));
DRAWTEXT(CURRBARSCOUNT=100,AA*1.02,'■提醒:①②③求④仅适用于趋势稳定的周期或波段!'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=100,AA*0.98,'■原理:相似涨(跌)幅===> ④÷③=②÷①'),COLOR00FFFF;
趋势:ZIG(3,P);
↑:TROUGHBARS(3,P,1),COLOR0000FF,NODRAW;
↓:PEAKBARS(3,P,1),COLOR00FF00,NODRAW;
低:IF(↑=0,C,IF(↓<↑,TROUGH(3,P,1),REF(TROUGH(3,P,1),1))),COLOR00FFFF,,POINTDOT;
高:IF(↓=0,C,IF(↑<↓,PEAK(3,P,1),REF(PEAK(3,P,1),1))),COLOR00FF00,,POINTDOT;
①:IF(↓<↑,REF(高,↑),REF(低,↓)),COLOR0000FF,NODRAW;
②:IF(↓<↑,REF(低,↓),REF(高,↑)),COLOR00FFFF,NODRAW;
③:IF(↓<↑,高,低),COLORFFFFFF,NODRAW;
④:②*③/①,COLOR00FF00,NODRAW;
涨%:IF(↑<↓,(C/低-1)*100,REF((C/低-1)*100,↓)),COLOR0000FF,NODRAW;
跌%:IF(↓<↑,(C/高-1)*100,REF((C/高-1)*100,↑)),COLORFF0000,NODRAW;
{以下设置主图显示方式}
上:IF(趋势>REF(趋势,1),趋势,DRAWNULL),COLORRED,LINETHICK2;
下:IF(趋势<REF(趋势,1),趋势,DRAWNULL),COLOR00FF00,LINETHICK2;
STICKLINE(↑=0,H*1.01,REF(高,1),0,0),COLOR00FF00;
STICKLINE(↓=0,L*0.99,REF(低,1),0,0),COLORFF00FF;
STICKLINE(BETWEEN(↑,0,6),低,低,3,0),COLOR00FFFF;
STICKLINE(BETWEEN(↓,0,6),高,高,3,0),COLOR00FF00;
DRAWTEXT(↓=0,趋势*1.01,'←高'),COLOR0000FF;
DRAWTEXT(↑=0,趋势,'←低'),COLORFFFFFF;
{以下设置自动提示文字}
AA:=CONST(LLV(L,120));
DRAWTEXT(CURRBARSCOUNT=100,AA*1.02,'■提醒:①②③求④仅适用于趋势稳定的周期或波段!'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=100,AA*0.98,'■原理:相似涨(跌)幅===> ④÷③=②÷①'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=100,AA*0.94,'■推导:★ ④=②×③÷① ★'),COLORFFFFFF;