在《完全换手2》公式中增加前数5,前量5,前数6,前量6的表达
2020/1/15 18:54:24
公式编写说明:
以下是求助老师编写的《完全换手2》,我想在此基础上增加前数5,前量5,前数6,前量6的表达,(见附图两红线)几次编写均未成功,再次求助老师帮助,谢谢啦!HS:V*100/FINANCE(7)*100,VOLSTICK;HS1:=INTPART(SUM(HS/100,0));HS2:=HS1!=REF(HS1,1) OR BARSCOUNT(C)=0;HS3:=BARSLAST(HS2);HS4:=SUM(HS,HS3+1);S2:=REF(HS3,HS3+1);S3:=REF(REF(HS3,HS3+1),HS3+1);S4:=REF(REF(REF(HS3,HS3+1),HS3+1),HS3+1);Q1:=BACKSET(ISLASTBAR,HS3+1);Q2:=BACKSET(ISLASTBAR,S2+HS3+2);Q3:=BACKSET(ISLASTBAR,S3+S2+HS3+3);Q4:=BACKSET(ISLASTBAR,S4+S3+S2+HS3+4);前数1:IF(Q1>0,BARSLAST(Q1>REF(Q1,1))+1,DRAWNULL),NODRAW,COLORYELLOW;前量1:IF(Q1>0,SUM(HS,前数1),DRAWNULL),COLORYELLOW;前数2:IF(Q2>0,BARSLAST(Q2>REF(Q2,1))+1,DRAWNULL),NODRAW,COLORGREEN;前量2:IF(Q2>0,SUM(HS,前数2),DRAWNULL),COLORGREEN;前数3:IF(Q3>0,BARSLAST(Q3>REF(Q3,1))+1,DRAWNULL),NODRAW,COLORMAGENTA;前量3:IF(Q3>0,SUM(HS,前数3),DRAWNULL),COLORMAGENTA;前数4:IF(Q4>0,BARSLAST(Q4>REF(Q4,1))+1,DRAWNULL),NODRAW,COLORBLUE;前量4:IF(Q4>0,SUM(HS,前数4),DRAWNULL),COLORBLUE;STICKLINE(HS2,HS,0,2,0),COLORMAGENTA;DRAWICON(HS2,0,3);AA:=CONST(HHV(HS,120))*0.6;DRAWTEXT(CROSS(HS4,25),AA,'25%'),COLORYELLOW;DRAWTEXT(CROSS(HS4,50),AA,'50%'),COLORYELLOW;DRAWTEXT(CROSS(HS4,75),AA,'75%'),COLORYELLOW;DRAWTEXT(HS2,AA,'100%'),COLORMAGENTA;STICKLINE(CROSS(HS4,25) OR CROSS(HS4,50) OR CROSS(HS4,75),HS,0,0,0),COLORYELLOW;DRAWTEXT(Q1>REF(Q1,1),AA/2,'1次'),COLORYELLOW;DRAWTEXT(Q2>REF(Q2,1),AA/2,'2次'),COLORGREEN;DRAWTEXT(Q3>REF(Q3,1),AA/2,'3次'),COLORMAGENTA;DRAWTEXT(Q4>REF(Q4,1),AA/2,'4次'),COLORBLUE;
公式源码回答:
Q2:=BACKSET(ISLASTBAR,S2+HS3+2);
Q3:=BACKSET(ISLASTBAR,S3+S2+HS3+3);
Q4:=BACKSET(ISLASTBAR,S4+S3+S2+HS3+4);
Q5:=BACKSET(ISLASTBAR,S5+S4+S3+S2+HS3+5);
Q6:=BACKSET(ISLASTBAR,S6+S5+S4+S3+S2+HS3+6);
前数1:IF(Q1>0,BARSLAST(Q1>REF(Q1,1))+1,DRAWNULL),NODRAW,COLORYELLOW;
前量1:IF(Q1>0,SUM(HS,前数1),DRAWNULL),COLORYELLOW;
前数2:IF(Q2>0,BARSLAST(Q2>REF(Q2,1))+1,DRAWNULL),NODRAW,COLORGREEN;
前量2:IF(Q2>0,SUM(HS,前数2),DRAWNULL),COLORGREEN;
前数3:IF(Q3>0,BARSLAST(Q3>REF(Q3,1))+1,DRAWNULL),NODRAW,COLORMAGENTA;
前量3:IF(Q3>0,SUM(HS,前数3),DRAWNULL),COLORMAGENTA;
前数4:IF(Q4>0,BARSLAST(Q4>REF(Q4,1))+1,DRAWNULL),NODRAW,COLORBLUE;
前量4:IF(Q4>0,SUM(HS,前数4),DRAWNULL),COLORBLUE;
前数5:IF(Q5>0,BARSLAST(Q5>REF(Q5,1))+1,DRAWNULL),NODRAW,COLORRED;
前量5:IF(Q5>0,SUM(HS,前数5),DRAWNULL),COLORRED;
前数6:IF(Q6>0,BARSLAST(Q6>REF(Q6,1))+1,DRAWNULL),NODRAW,COLORWHITE;
前量6:IF(Q6>0,SUM(HS,前数6),DRAWNULL),COLORWHITE;
STICKLINE(HS2,HS,0,2,0),COLORMAGENTA;
DRAWICON(HS2,0,3);
AA:=CONST(HHV(HS,120))*0.6;
DRAWTEXT(CROSS(HS4,25),AA,'25%'),COLORYELLOW;
DRAWTEXT(CROSS(HS4,50),AA,'50%'),COLORYELLOW;
DRAWTEXT(CROSS(HS4,75),AA,'75%'),COLORYELLOW;
DRAWTEXT(HS2,AA,'100%'),COLORMAGENTA;
STICKLINE(CROSS(HS4,25) OR CROSS(HS4,50) OR CROSS(HS4,75),HS,0,0,0),COLORYELLOW;
DRAWTEXT(Q1>REF(Q1,1),AA/2,'1次'),COLORYELLOW;
DRAWTEXT(Q2>REF(Q2,1),AA/2,'2次'),COLORGREEN;
DRAWTEXT(Q3>REF(Q3,1),AA/2,'3次'),COLORMAGENTA;
DRAWTEXT(Q4>REF(Q4,1),AA/2,'4次'),COLORBLUE;
DRAWTEXT(Q5>REF(Q5,1),AA/2,'5次'),COLORRED;
DRAWTEXT(Q6>REF(Q6,1),AA/2,'6次'),COLORWHITE;
投股 票网 www.tou18. cn
股市公式下载推荐