先编写公式:“HQSJ”,其中CC=C,OO=O,HH=H,LL=L;使用公式时将默认周期设在1分钟。
INPUT:N(2,2,5)
M:=IF(N=2,5,IF(N=3,15,IF(N=4,30,60)));
WAR00:=OPENMINUTES(TIME);
WAR01:=MOD(WAR00,M);
WAR02:=BARSLAST(WAR01=1)+1;
WAR03:=CEILING(M/2);
OO:=STKINDI('','HQSJ.OO',0,N);
CC:=STKINDI('','HQSJ.CC',0,N);
HH:=STKINDI('','HQSJ.HH',0,N);
LL:=STKINDI('','HQSJ.LL',0,N);
STICKLINE(CC>=OO AND WAR02=WAR03,HH,LL,N,0),COLORRED;
STICKLINE(CC<OO AND WAR02=WAR03,HH,LL,N,0),COLORCYAN;
STICKLINE(CC>=OO,OO,CC,10,0),COLORRED;
STICKLINE(CC<OO,OO,CC,10,0),COLORCYAN;
MA1:MA(STKINDI('','MA.MA1',0,N),5),COLORWHITE;
MA2:MA(STKINDI('','MA.MA2',0,N),5),COLORYELLOW;
MA3:MA(STKINDI('','MA.MA3',0,N),5),COLORRED;
MA4:MA(STKINDI('','MA.MA4',0,N),5),COLORGREEN;
DRAWTEXT(N=2 AND BARPOS=SYSPARAM(2),H,'5分钟K线'),ALIGN4,COLORYELLOW;
DRAWTEXT(N=3 AND BARPOS=SYSPARAM(2),H,'15分钟K线'),ALIGN4,COLORYELLOW;
DRAWTEXT(N=4 AND BARPOS=SYSPARAM(2),H,'30分钟K线'),ALIGN4,COLORYELLOW;
DRAWTEXT(N=5 AND BARPOS=SYSPARAM(2),H,'60分钟K线'),ALIGN4,COLORYELLOW;