以下是交通规则源码主图
DRAWGBK(O>C,RGB(57,35,146),RGB(0,0,0),0,’1′,0);
DRAWTEXT_FIX(1,0.02,0.05,0,’★绿灯行,红灯停。★’),COLORYELLOW;
DRAWTEXT_FIX(1,0.02,0.10,0,’★交通规则。法师9430制作。★’),COLORYELLOW;
UR:=15;{0~200可调}
LR:=15;{0~200可调}
DA1:=IF(130>TOTALBARSCOUNT,TOTALBARSCOUNT,130);
DA:=IF(CURRBARSCOUNT>DA1,0,DA1);
HI:=REFDATE(HHV(H,DA),DATE);
LO:=REFDATE(LLV(L,DA),DATE);
C1:=IF(CURRBARSCOUNT<=DA,C,DRAWNULL);
GZ:=EXP(LN(HI/LO)/10);
LH1:=SUM(IF(C1>=(HI/GZ),V,0),DA);
LH2:=SUM(IF(C1>=(HI/POW(GZ,2)) AND C1<(HI/GZ),V,0),DA);
LH3:=SUM(IF(C1>=(HI/POW(GZ,3)) AND C1<(HI/POW(GZ,2)),V,0),DA);
LH4:=SUM(IF(C1>=(HI/POW(GZ,4)) AND C1<(HI/POW(GZ,3)),V,0),DA);
LH5:=SUM(IF(C1>=(HI/POW(GZ,5)) AND C1<(HI/POW(GZ,4)),V,0),DA);
LH6:=SUM(IF(C1>=(HI/POW(GZ,6)) AND C1<(HI/POW(GZ,5)),V,0),DA);
LH7:=SUM(IF(C1>=(HI/POW(GZ,7)) AND C1<(HI/POW(GZ,6)),V,0),DA);
LH8:=SUM(IF(C1>=(HI/POW(GZ,8)) AND C1<(HI/POW(GZ,7)),V,0),DA);
LH9:=SUM(IF(C1>=(LO*GZ) AND C1<LO*POW(GZ,2),V,0),DA);
LH10:=SUM(IF(C1>=LO AND C1<LO*GZ,V,0),DA);
L1:=REFDATE(HHV(LH1,DA),DATE);
L2:=REFDATE(HHV(LH2,DA),DATE);
L3:=REFDATE(HHV(LH3,DA),DATE);
L4:=REFDATE(HHV(LH4,DA),DATE);
L5:=REFDATE(HHV(LH5,DA),DATE);
L6:=REFDATE(HHV(LH6,DA),DATE);
L7:=REFDATE(HHV(LH7,DA),DATE);
L8:=REFDATE(HHV(LH8,DA),DATE);
L9:=REFDATE(HHV(LH9,DA),DATE);
L10:=REFDATE(HHV(LH10,DA),DATE);
SS:=(L1+L2+L3+L4+L5+L6+L7+L8+L9+L10);
STICKLINE(CEILING(DA*L1/SS)*3>=CURRBARSCOUNT,HI*99/100,HI/GZ,9,0),
,COLORLIGRAY,LINETHICK3;
STICKLINE(CEILING(DA*L2/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,1)*99/100
,HI/POW(GZ,2),9,0),COLORWHITE,LINETHICK3;
STICKLINE(CEILING(DA*L3/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,2)*99/100
,HI/POW(GZ,3),9,0),COLOR808300,LINETHICK3;
STICKLINE(CEILING(DA*L4/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,3)*99/100
,HI/POW(GZ,4),9,0),COLOR883D88,LINETHICK3;
STICKLINE(CEILING(DA*L5/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,4)*99/100
,HI/POW(GZ,5),9,0),COLOR777700,LINETHICK3;
STICKLINE(CEILING(DA*L6/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,5)*99/100
,HI/POW(GZ,6),9,0),COLOR804000,LINETHICK3;
STICKLINE(CEILING(DA*L7/SS)*3>=CURRBARSCOUNT,HI/POW(GZ,6)*99/100
,HI/POW(GZ,7),9,0),COLOR003377,LINETHICK3;
STICKLINE(CEILING(DA*L8/SS)*3>=CURRBARSCOUNT,LO*POW(GZ,2),LO*POW(GZ,3)
*99/100,9,0),COLORLICYAN,LINETHICK3;
STICKLINE(CEILING(DA*L9/SS)*3>=CURRBARSCOUNT,LO*POW(GZ,1),LO*POW(GZ,2)
*99/100,9,0),COLORLIMAGENTA,LINETHICK3;
STICKLINE(CEILING(DA*L10/SS)*3>=CURRBARSCOUNT,LO,LO*POW(GZ,1)*99/100,9,0)
,COLORBROWN,LINETHICK3;
DRAWKLINE(H,O,L,C);
TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));
LR1:=FORCAST(C,NOD+1);
NP:IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;
LR2:=SLOPE(C,NOD+1);
LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
FP:NP-LR3*(NOD),POINTDOT,COLOR93BDA8;
AD:=ABS(NP-FP);
DBL:=BARSLAST(BC1!=DRAWNULL)+1;
DBH:=BARSLAST(TC1!=DRAWNULL)+1;
BSP:=IF(BC2>TC2,DBL,DBH)-1;
LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=CONST(BARSLAST(AT1-LRL=AT2));
AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
ATL:=LRL+AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);
UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
UT3:=CONST(BARSLAST(LRL-UT1=UT2));
UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
UTL:=LRL-UT5;
RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)));
RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)));
上轨:=IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLORBLUE,LINETHICK2;
下轨:=IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLORMAGENTA ,LINETHICK2;
操作2:=(C*4+L*3+H*2+O)/10,COLORGREEN,LINETHICK1;
P:=14;
A1Z:=REF(操作2,P)=HHV(操作2,2*P+1);
B1:=FILTER(A1Z,P);
C1Z:=BACKSET(B1,P+1);
D1:=FILTER(C1Z,P);{高点}
A2Z:=REF(操作2,P)=LLV(操作2,2*P+1);
B2:=FILTER(A2Z,P);
C2Z:=BACKSET(B2,P+1);
D2:=FILTER(C2Z,P);{低点}
下:=REF(操作2,BARSLAST(D2)),COLOR00FF00,NODRAW;
上:=REF(操作2,BARSLAST(D1)),COLORFF00FF,NODRAW;
STICKLINE(REF(操作2=下,1) AND 操作2>下轨,L,L-0.3,3,0),COLORGRAY;
STICKLINE(REF(操作2=下,1) AND 操作2>下轨,L-0.05,L-0.25,2,0),COLORGREEN ;
DRAWTEXT(REF(操作2=下,1) AND 操作2>下轨,L-0.4,’绿灯’)COLORGREEN;
STICKLINE(操作2=上,H,H+0.3,3,0),COLORYELLOW ;
STICKLINE(操作2=上,H+0.05,H+0.25,2,0),COLORRED ;
DRAWTEXT(操作2=上,H+0.4,’红灯’)COLORRED;
Z:ZIG(3,上),COLORFFFFFF;
LC:=REF(CLOSE,1);
RSI5:=((SMA(MAX((CLOSE – LC),0),5,1) / SMA(ABS((CLOSE – LC)),5,1)) * 100);
TR1:=SUM(MAX(MAX((HIGH – LOW),ABS((HIGH – REF(CLOSE,1)))),ABS((LOW – REF(CLOSE,1)))),10);
HD:=(HIGH – REF(HIGH,1));
LD:=(REF(LOW,1) – LOW);
DMP:=SUM(IF(((HD > 0) AND (HD > LD)),HD,0),10);
DMM:=SUM(IF(((LD > 0) AND (LD > HD)),LD,0),10);
PDI:=((DMP * 100) / TR1);
MDI:=((DMM * 100) / TR1);
ADX:=MA(((ABS((MDI – PDI)) / (MDI + PDI)) * 100),5);
AV:=(RSI5 + ADX);
WR10:=((100 *( HHV(HIGH,10) – CLOSE)) / (HHV(HIGH,10) – LLV(LOW,10)));
NEWVOL:=(RSI5 – WR10);
回调买:=(AV + NEWVOL);
DRAWTEXT(CROSS(回调买,0),L*0.86,’↖回调买’),COLORYELLOW;
MT1:=IF(ISLASTBAR,REF((C*2-REF(C,3)),1),DRAWNULL);
MT2:=IF(ISLASTBAR,REF((C*2-REF(C,3)),2),DRAWNULL);
MT3:=IF(ISLASTBAR,C*2-REF(C,3),DRAWNULL);
DRAWTEXT(ISLASTBAR,MT2,’ ●’),COLORMAGENTA,LINETHICK2;
DRAWTEXT(ISLASTBAR,MT1,’ ●’),COLORMAGENTA,LINETHICK2;
DRAWTEXT(ISLASTBAR,MT3,’ ●’),COLORMAGENTA,LINETHICK2;
评论(0)