股票箱(最好的箱体)

2011-02-17 09:12:00来源:本站整理浏览:120

股票箱

FH:=HIGH;
FL:=LOW;
SELL:=0*FH;
BUY:=SELL;
SIGNAL:=SELL;
BOXH:SELL,LINETHICK0;
BOXL:SELL,LINETHICK0;
VARIABLE:HC=0,LC=0,BT=FH[1],BB=FH[1];
FOR I=1 TO DATACOUNT DO BEGIN
IF HC>1 THEN BEGIN
IF LC>2 AND BT<=FH[I] THEN BEGIN
BUY[I]:=1;
FOR J=I-1 DOWNTO I-HC DO BEGIN
BOXH[J]:=FH[I-HC],LINETHICK0;
BOXL[J]:=FL[I-LC],LINETHICK0;
END;
HC:=0;
LC:=0;
END;
IF BT>FH[I] THEN BEGIN
IF LC>2 THEN BEGIN
IF BB>=FL[I] THEN BEGIN
SELL[I]:=1;
FOR J=I-1 DOWNTO I-HC DO BEGIN
BOXH[J]:=FH[I-HC],LINETHICK0;
BOXL[J]:=FL[I-LC],LINETHICK0;
END;
HC:=-1;
LC:=0;
END;ELSE BEGIN
BOXH[I]:=FH[I-HC],LINETHICK0;
BOXL[I]:=FL[I-LC],LINETHICK0;
END;
END;
HC:=HC+1;
IF LC>1 THEN BEGIN
IF BB<FL[I] THEN BEGIN
LC:=LC+1;
IF LC=3 THEN BEGIN
SIGNAL[I-HC+1]:=1;
FOR J=I DOWNTO I-HC+1 DO BEGIN
BOXH[J]:=FH[I-HC+1],LINETHICK0;
BOXL[J]:=FL[I-LC+1],LINETHICK0;
END;
END;
END;ELSE
LC:=0;
END;ELSE
IF LC=1 THEN BEGIN
IF BB<FL[I] THEN BEGIN
LC:=LC+1;
END;ELSE
LC:=0;
END;
IF LC=0 AND HC>1 THEN BEGIN
BB:=FL[I];
LC:=LC+1;
END;
END;ELSE BEGIN
HC:=0;
LC:=0;
END;
END;ELSE
IF HC=1 THEN BEGIN
IF BT>FH[I] THEN
HC:=HC+1;ELSE BEGIN
HC:=0;
LC:=0;
END;
END;
IF HC=0 THEN BEGIN
BT:=FH[I];
HC:=HC+1;
END;
END;
PARTLINE(BOXH AND BOXH=REF(BOXH,1),BOXH),POINTDOT,colorFFFF;
PARTLINE(BOXL AND BOXL=REF(BOXL,1),BOXL),POINTDOT,colorFFFF;
PARTLINE(BOXL AND BOXL=REF(BOXL,1),(BOXL+BOXH)/2),POINTDOT,colorFFFF;
STICKLINE((SIGNAL OR REFX(BUY OR SELL,1)) AND BOXH,BOXH,BOXL,0.1,0),POINTDOT,colorFFFF;
DRAWICON(BUY,LOW*0.98,4);
DRAWICON(SELL,HIGH*1.02,5);
BOXHL:=(BOXL+BOXH)/2;
HAC:=CLOSE;
VARIABLE:HA=1;
FOR I=2 TO DATACOUNT DO BEGIN
IF BOXH[I-1]=0 AND BOXH[I]>0 AND (BOXH[I]<>BOXH[I-1] OR BOXL[I]<>BOXL[I-1]) THEN
HAC[I]:=0;
IF BOXH[I-1]>0 AND BOXH[I]>0 AND (BOXH[I]<>BOXH[I-1] OR BOXL[I]<>BOXL[I-1]) THEN
HAC[I]:=0;
IF BOXH[I-1]>0 AND BOXH[I]>0 AND BOXH[I]=BOXH[I-1] AND BOXL[I]<>BOXL[I-1] THEN
HAC[I]:=0;
IF BOXH[I-1]>0 AND BOXH[I]>0 AND BOXH[I]=BOXH[I-1] AND BOXL[I]=BOXL[I-1] THEN
HAC[I]:=HA;
IF BOXH[I-1]>0 AND BOXH[I]>0 AND BOXH[I]=BOXH[I-1] AND BOXL[I]<>BOXL[I-1] THEN
HAC[I]:=HA;
IF BOXH[I-1]>0 AND BOXH[I]>0 AND BOXH[I]=BOXH[I-1] AND BOXH[I-2]=BOXH[I-1] THEN
HAC[I]:=HAC[I-1]+HA;
IF BOXH[I-1]>0 AND BOXH[I]=0 THEN
HAC[I]:=0;
IF BOXH[I-1]=0 AND BOXH[I]=0 THEN
HAC[I]:=0;
END;
NV:=HAC;
KK:=HAC[1];
LL:=HAC[1];
LLT:=HAC[1];
MM:=HAC[1];
MMT:=HAC[1];
FOR I=2 TO DATACOUNT DO BEGIN
IF HAC[I-1]=0 AND HAC[I]>0 THEN
KK:=I-1;
IF HAC[I-1]>0 AND HAC[I]>0 THEN
LLT:=I-1;
IF HAC[I-1]>0 AND HAC[I]>0 THEN
FOR J=KK TO LLT DO BEGIN
NV[J]:=HAC[I]+1;
END;
IF HAC[I-1]>0 AND HAC[I]=0 THEN
LL:=I-1;
IF HAC[I-1]>0 AND HAC[I]=0 THEN
FOR J=KK TO LL DO BEGIN
NV[J]:=HAC[I-1]+1;
END;
END;
XX:=NV;
BB25:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*(TAN(-26.5659*3.14159/180))+BOXH;
PARTLINE(REF(BB25,1)<>0 AND BOXH=REF(BOXH,1) AND BB25>0 AND BB25>BOXL-BOXL*0.05,BB25),POINTDOT,LINETHICK1,colorFF00FF;
DRAWLINE(BB25>0 AND BB25=BOXH AND BARSCOUNT(CLOSE)>DATACOUNT-45,BB25,BB25>0 AND BB25=BOXL AND BARSCOUNT(CLOSE)>DATACOUNT-45,BB25,1),colorFF00FF;
BB45:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*(TAN(-45*3.14159/180))+BOXH;
PARTLINE(REF(BB45,1)<>0 AND BOXH=REF(BOXH,1) AND BB45>0 AND BB45>BOXL-BOXL*0.05,BB45),LINETHICK1,colorFF00FF;
DRAWLINE(BB45>0 AND BB45=BOXH AND BARSCOUNT(CLOSE)>DATACOUNT-45,BB45,BB45>0 AND BB45=BOXL AND BARSCOUNT(CLOSE)>DATACOUNT-45,BB45,1),colorFF00FF;
BB66:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*(TAN(-63.435*3.14159/180))+BOXH;
PARTLINE(REF(BB66,1)<>0 AND BOXH=REF(BOXH,1) AND BB66>0 AND BB66>BOXL-BOXL*0.025,BB66),POINTDOT,LINETHICK1,colorFF00FF;
XBB23:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*TAN(26.5659*3.14159/180)+BOXL;
PARTLINE(XBB23>0 AND XBB23>BOXL AND XBB23<BOXH+BOXH*0.05,XBB23),POINTDOT,LINETHICK1,colorFF00;
DRAWLINE(XBB23>0 AND XBB23=BOXL AND BARSCOUNT(CLOSE)>DATACOUNT-45,XBB23,XBB23>0 AND XBB23=BOXH AND BARSCOUNT(CLOSE)>DATACOUNT-45,XBB23,1),colorFF00;
XBB45:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*TAN(45*3.14159/180)+BOXL;
PARTLINE(XBB45>0 AND XBB45>BOXL AND XBB45<BOXH+BOXH*0.05,XBB45),LINETHICK1,colorFF00;
DRAWLINE(XBB45>0 AND XBB45=BOXL AND BARSCOUNT(CLOSE)>DATACOUNT-45,XBB45,XBB45>0 AND XBB45=BOXH AND BARSCOUNT(CLOSE)>DATACOUNT-45,XBB45,1),colorFF00;
XBB66:=(BOXH-BOXL)/(NV-1)*IF(ISLASTBAR,HAC-1,HAC)*TAN(63.435*3.14159/180)+BOXL;
PARTLINE(XBB66>0 AND XBB66>BOXL AND XBB66<BOXH+BOXH*0.025,XBB66),POINTDOT,LINETHICK1,colorFF00;
AC:=CLOSE;
AH:=HIGH;
AL:=LOW;
AO:=OPEN;
STICKLINE(AC>=AO,AH,AC,1,0),color8899;
STICKLINE(AC>=AO,AH,AC,0,0),color77FFEE;
STICKLINE(AC>=AO,AO,AL,1,0),color8899;
STICKLINE(AC>=AO,AO,AL,0,0),color77FFEE;
STICKLINE(AC>AO,AC,AO,8,0),color8899;
STICKLINE(AC>AO,AC,AO,7,0),color1199AA;
STICKLINE(AC>AO,AC,AO,6,0),color22AABB;
STICKLINE(AC>AO,AC,AO,5,0),color33BBCC;
STICKLINE(AC>AO,AC,AO,4,0),color44CCDD;
STICKLINE(AC>AO,AC,AO,3,0),color55DDEE;
STICKLINE(AC>AO,AC,AO,2,0),color66EEEE;
STICKLINE(AC>AO,AC,AO,1,0),color77FFEE;
STICKLINE(AC<=AO,AH,AC,1,0),colorFF8800;
STICKLINE(AC<=AO,AH,AC,0,0),colorFFFF33;
STICKLINE(AC<=AO,AO,AL,1,0),colorFF8800;
STICKLINE(AC<=AO,AO,AL,0,0),colorFFFF33;
STICKLINE(AC<=AO,AC,AO,8,0),colorFF8800;
STICKLINE(AC<=AO,AC,AO,7,0),colorFF9900;
STICKLINE(AC<=AO,AC,AO,6,0),colorFFAA11;
STICKLINE(AC<=AO,AC,AO,5,0),colorFFBB11;
STICKLINE(AC<=AO,AC,AO,4,0),colorFFCC22;
STICKLINE(AC<=AO,AC,AO,3,0),colorFFDD22;
STICKLINE(AC<=AO,AC,AO,2,0),colorFFEE33;
STICKLINE(AC<=AO,AC,AO,1,0),colorFFFF33;

股票公式栏目导航

精品指标推荐

最新热门

本类随机推荐

相关公式