?
下次轉換的代碼,請把你修改后的代碼也貼出來。并指出修改過程中遇到的問題,我們嘗試幫你解決。
注:相關的初始變量請一并提供。
?
N:TODAYBAR,NODRAW;
//昨收:REF(C,IF(N<=ZQ,N+1,drawnull)),COLORMAGENTA,DASH,PRECIS0;//取的當日的開盤價
//夜收:REF(C,IF(N>ZQ,N-ZQ,drawnull)),COLORMAGENTA,DASH,PRECIS0;
1H:REF(C,IF(N<=ZQ,N+1,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;//取的當日的開盤價
2H:REF(C,IF(N>ZQ AND N<=2*ZQ,N-ZQ,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;
3H:REF(C,IF(N>2*ZQ AND N<=3*ZQ,N-2*ZQ,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;//取的當日的開盤價
4H:REF(C,IF(N>3*ZQ AND N<=4*ZQ,N-3*ZQ,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;//取的當日的開盤價
5H:REF(C,IF(N>4*ZQ AND N<=5*ZQ,N-4*ZQ,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;
6H:REF(C,IF(N>5*ZQ AND N<=6*ZQ,N-5*ZQ,drawnull)),COLORMAGENTA,LINETHICK1,PRECIS0;
//HTR:=HHV(H,TRX);
//LTR:=LLV(L,TRX);
//AA:INTPART(SETTLE),PRECIS0,COLORYELLOW;
BBB:=BARSLAST(DATE<>REF(DATE,1)) +1,NODRAW;
HH:=REF(HHV(H,BBB),1),COLORRED;
LL:=REF(LLV(L,BBB),1),COLORGREEN;
MA5:IF(KG<>1,MA(C,5),drawnull),COLORMAGENTA,PRECIS0;
MA21:IF(KG<>1,MA(C,21),drawnull),COLORGREEN,PRECIS0;
DRAWTEXT(CROSS(MA5,MA21),MA5,'多'),COLORRED,FONTSIZE30;
DRAWTEXT(CROSS(MA21,MA5),MA21,'空'),COLORGREEN,FONTSIZE30;
DHH2:=REF(HHV(H,SUMBARS(N=1,2)),N);//不包含當天的前兩天高點
DHH3:=REF(HHV(H,SUMBARS(N=1,3)),N);//不包含當天的前三天高點
DHH4:=REF(HHV(H,SUMBARS(N=1,4)),N);//不包含當天的前四天高點
DH2:=HHV(H,SUMBARS(N=1,3));//包含當天的前兩天高點
DH3:=HHV(H,SUMBARS(N=1,4));//包含當天的前三天高點
DH4:=HHV(H,SUMBARS(N=1,5));//包含當天的前四天高點
DLL2:=REF(LLV(L,SUMBARS(N=1,2)),N);//不包含當天的前兩天低點
DLL3:=REF(LLV(L,SUMBARS(N=1,3)),N);//不包含當天的前三天低點
DLL4:=REF(LLV(L,SUMBARS(N=1,4)),N);//不包含當天的前四天低點
DL2:=LLV(L,SUMBARS(N=1,3));//包含當天的前兩天低點
DL3:=LLV(L,SUMBARS(N=1,4));//包含當天的前三天低點
DL4:=LLV(L,SUMBARS(N=1,5));//包含當天的前四天低點
BH1:=BARSLAST(COUNT(H>DHH3,BARSLAST(L<DLL3))=1&&H>DHH3)+1,NODRAW;
BL1:=BARSLAST(COUNT(L<DLL3,BARSLAST(H>DHH3))=1&&L<DLL3)+1,NODRAW;
B:=IF(BH1<BL1,BH1,drawnull),PRECIS0,NODRAW;
S:=IF(BL1<BH1,BL1,drawnull),PRECIS0,NODRAW;
J:=BARSLAST(CROSS(B,0))+1,NODRAW;
J1:=SUMBARS(todaybar=1,1),NODRAW;
J2:=SUMBARS(todaybar=1,2),NODRAW;
J3:=SUMBARS(todaybar=1,3),NODRAW;
H2:=HHV(H,2);
L2:=LLV(L,2);
H3:=HHV(H,3);
L3:=LLV(L,3);
HH3:=REF(H3,1);
LL3:=REF(L3,1);
TR3:=H3-L3;
BH:=BARSLAST(COUNT(H>HH3,BARSLAST(L<LL3))=1&&H>HH3)+1,NODRAW;//H轉向定義
BL:=BARSLAST(COUNT(L<LL3,BARSLAST(H>HH3))=1&&L<LL3)+1,NODRAW;
DB:INTPART(IF(B>0 ,IF((B-N)<0,1,CEILING((BARSLAST((B-N)<=0))/(J2-J1)+1)),drawnull)),NODRAW,COLORRED;//日線轉向
DS:INTPART(IF(S>0 ,IF((S-N)<0,1,CEILING((BARSLAST((S-N)<=0))/(J2-J1)+1)),drawnull)),NODRAW,COLORGREEN;
HB:IF(BH<BL,BH,drawnull),PRECIS0,NODRAW,COLORRED;//H轉向
HS:IF(BL<BH,BL,drawnull),PRECIS0,NODRAW,COLORGREEN;
D2H:=DHH2,PRECIS0,COLORRED,NODRAW;
D2L:=DLL2,PRECIS0,COLORGREEN,NODRAW;
DRAWICON(KG<>2 AND BH=1 AND DB>0 ,L*0.997,'ICO130');
DRAWICON(KG<>2 AND BL=1 AND DS>0 ,H*1.003,'ICO131');
DRAWICON(BH=1 AND (XH=1 OR XH=3),L*0.999,'ICO4');
DRAWICON(BL=1 AND (XH=2 OR XH=3),H*1.001,'ICO5');
?
?來源:程序化久久網( www.kzuj.com.cn )