[PEL] 复制代码
MA5:STKINDI('','CTFZC.MA5',0,6);
VARIABLE:A:=0;
VARIABLE:MARK:=0;
ma37:=ma(c,n4)COLORMAGENTA;
CMI:=ABS(CLOSE-REF(CLOSE,29))/(HHV(HIGH,30)-LLV(L,30))*100;
PH9:=(CLOSE-OPEN)>=16*MINDIFF;
PE9:=(OPEN-C)>=13*MINDIFF;
PH3:=(CLOSE-OPEN)>=4*MINDIFF;
PE3:=(OPEN-CLOSE)>=4*MINDIFF;
DIFF : =EMA(CLOSE,S) - EMA(CLOSE,P1);////S 25 P1 45 M 9
DEA : =EMA(DIFF,M);
MACD1: =2*(DIFF-DEA), COLORSTICK;
CDAA:CMI>5;
CDBB:CMI<5;
CD88:=OPENPROFIT>=10*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD66:=OPENPROFIT<=-10*MINDIFF;//表示盈利40个点以上平CLOSETIME(0)-10
CD300:=OPENPROFIT>=1200*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD200:=OPENPROFIT>=1500*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD400:=OPENPROFIT>=600*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD100:=OPENPROFIT>=400*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD500:=OPENPROFIT>=400*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
CD250:=OPENPROFIT>=1200*MINDIFF;//表示盈利40个点以上平CLOSETIME(0) 60
H1:=IF(Low<ref(low,2) AND ref(low,1)<ref(low,2) and open>close,MAX(High,ref(High,1)),0);//创新低取最高价
L1:=IF(High>ref(High,2) and ref(High,1)>ref(High,2) and open<close,MIN(Low,ref(low,1)),0);//创新高取最低价
HR:=VALUEWHEN(H1>0,H1);//平空点
LR:=VALUEWHEN(L1>0,L1);//平多点
D1:=IF(C>HR,-1,IF(C<LR,1,0));//空头止损返回-1,多头止损返回1AND ISUP AND ISDOWN SLOPE(CLOSE,10 )
D2:=VALUEWHEN(D1<>0,D1);
BARSLAST(D1=-1);
G:=IF(D2=1,HR,LR);//如果多头止损画平空线,否则画平多线
多头止损线:=IF(D2<=0,G,drawnull),COLOR6633FF,LINETHICK1,COLORWHITE;
空头止损线:=IF(D2>0,G,drawnull),COLORFF9933,LINETHICK1,COLORGREEN;
MC:=TYPEBAR(holding>0,1);
MC2:=TYPEBAR(holding<0,3);
成交量H:=VOL=HHV(VOL,2);
成交量L:=VOL=LLV(VOL,2);
成交量L1:=VOL=LLV(VOL,2);
k5:=VOL>50000;
k4:=VOL>40000;
k250:=VOL>26000;
VAR2:=MA(C,N2)COLORWHITE;
VAR3:=MA(VAR2,N1)COLORYELLOW;
VAR4:=IF((H+L)<=(REF(H,1)+REF(L,1)),0,MAX(ABS(H-REF(H,1)),ABS(L-REF(L,1))));
VAR5:=IF((H+L)>=(REF(H,1)+REF(L,1)),0,MAX(ABS(H-REF(H,1)),ABS(L-REF(L,1))));
VAR6:=SUM(VAR4,N1)/(SUM(VAR4,N1)+SUM(VAR5,N1));
VAR7:=SUM(VAR5,N1)/(SUM(VAR4,N1)+SUM(VAR5,N1));
VAR8:=VAR6-VAR7;
VAR9:=MA(VAR8,2*N1);
VAR10:=MA(VAR9,N1);
手数:1;
PH3:=(CLOSE-OPEN)>=2*MINDIFF;
PE3:=(OPEN-CLOSE)>=2*MINDIFF;
TR1:= EMA(EMA(EMA(CLOSE,P),P),P);
TRIX := (TR1-REF(TR1,1))/REF(TR1,1)*100;
TRcd := MA(TRIX,N);
TRx :=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR :=MA(TRx,20);
CDTT:= (C-VAR3)<=15*MINDIFF;
CDYY:= (VAR3-C)<=15*MINDIFF;
CDTT1:= (C-VAR2)<=30*MINDIFF;
CDYY1:= (VAR2-C)<=25*MINDIFF;
CONPD:C<VAR2 AND C>ENTERPRICE*(1+0.03*N3);
CONPK:C>VAR2 AND C<ENTERPRICE*(1-0.03*N3);
CONKD:BARPOS>N2 AND C>VAR2 AND VAR2>VAR3 AND VAR8>0 AND VAR9>VAR10;
CONKK:BARPOS>N2 AND C<VAR2 AND VAR2<VAR3 AND VAR8<0 AND VAR9<VAR10;
//交易条件:
平空条件:={ma37>VAR3}c>多头止损线 and pe3 and diff>-0.5 and diff>dea AND MARK>=0 and holding<=0;
开多条件:={ma37>VAR3}c>多头止损线 and pe3 AND diff>-0.5 and diff>dea AND MARK>=0 and holding=0;
平多条件:={ma37<VAR3}c<空头止损线 and ph3 and diff<-1.5 and diff<dea AND MARK<=0 and holding>=0;
开空条件:={ma37<VAR3}c<空头止损线 and ph3 AND diff<-1.5 and diff<dea AND MARK<=0 and holding=0;
IF 平空条件 AND ISDOWN THEN BEGIN
平空10:=sellshort( holding=-2, 2,MARKETR);
平空5:=sellshort( holding=-1, 1,MARKETR);
//开多1:=buy( holding=0, 手数*1,MARKETR);
MARK:=0;
END
//IF MC>=2 AND close<(enterprice-3) AND ISDOWN AND MC<=20 THEN BEGIN
//加仓开多:=buy( holding=1, 手数*1,MARKETR);
//mark:=0;
//END
IF MC>=45 AND ISUP AND K5 THEN BEGIN
趋势成交量止盈PK:SELL(holding=1,1,MARKETR);
mark:=-1;
END
IF MC>=2 AND CD500 AND ISUP THEN BEGIN
波幅止盈A500:SELL(holding=2,1,MARKETR);
mark:=-1;
END
IF MC>=2 AND CD250 AND ISUP THEN BEGIN
波幅止盈Ag250:SELL(holding=1,1,MARKETR);
mark:=-1;
END
IF MC>=2 AND K250 AND ISUP THEN BEGIN
波幅止盈A200:SELL(holding=1,1,MARKETR);
mark:=-1;
END
IF MC>=20 AND CD200 AND ISUP THEN BEGIN
波幅止盈Ag350:SELL(holding=2,2,MARKETR);
mark:=-1;
END
IF MC>=2 AND PH9 AND ISUP THEN BEGIN
价格异动止盈PH9:SELL(holding=2,1,MARKETR);
mark:=-1;
END
IF MC>=10 AND DIFF>13.5 AND 成交量H THEN BEGIN
波幅止盈DIF:SELL(holding=2,1,MARKETR);
mark:=-1;
END
IF 平多条件 AND ISUP THEN BEGIN
平多2:=sell( holding=2,2,MARKETR);
平多1:=sell( holding=1,1,MARKETR);
开空1:BUYSHORT( HOLDING=0 ,1,MARKETR);
mark:=0;
END
IF MC2>=2 AND enterprice<(close-3) AND ISUP AND MC2<=20 THEN BEGIN
加仓开空2A:buyshort(holding=-1,手数*1,MARKETR);
mark:=0;
END
IF MC2>=15 AND ISDOWN AND CD300 and 手数*2 THEN BEGIN
波幅止盈By100:SELLSHORT(holding=-2,1,MARKETR);
mark:=1;
END
IF MC2>=15 AND ISDOWN AND CD100 AND PE9 and 手数*2 THEN BEGIN
波幅止盈BH20:SELLSHORT(holding=-2,1,MARKETR);
mark:=1;
END
IF MC2>=5 AND CD88 AND ISDOWN AND diff<-14 and 手数*2 THEN BEGIN
波幅止盈diff:SELLSHORT(holding=-2,1,MARKETR);
mark:=1;
END
IF MC2>=5 AND ISDOWN AND macd1<-7 and 手数*2 AND 成交量H THEN BEGIN
波幅止盈ma:SELLSHORT(holding=-2,2,MARKETR);
mark:=1;
END
IF MC2>=5 AND ISDOWN AND PE9 AND DIFF<-10 AND 成交量H THEN BEGIN
波幅止盈DIIF:SELLSHORT(holding=-2,1,MARKETR);
mark:=1;
END
IF MC2>=5 AND ISUP AND K5 AND 成交量H THEN BEGIN
跳空成交量止盈HK:SELLSHORT(holding=-2,2,MARKETR);
mark:=1;
END
IF MC2>=5 AND ISDOWN AND K5 AND 成交量H THEN BEGIN
波幅止盈KK:SELLSHORT(holding=-2,2,MARKETR);
mark:=1;
END
IF MC2>=5 AND ISDOWN AND K5 AND 成交量H THEN BEGIN
趋势成交量止盈AK:SELLSHORT(holding=-1,1,MARKETR);
mark:=1;
END
IF MC2>=10 AND ISDOWN AND cd500 THEN BEGIN
趋势成交量止盈500K:SELLSHORT(holding=-2,1,MARKETR);
mark:=1;
END
IF MC2>=10 AND ISDOWN AND cd250 THEN BEGIN
趋势成交量止盈25K:SELLSHORT(holding=-1,1,MARKETR);
mark:=1;
END
多头止损条件:=C<=ZS*AVGENTERPRICE;
空头止损条件:=C>=(2-ZS)*AVGENTERPRICE;
//*********************************************************************************************
IF HOLDING>0 AND 多头止损条件 THEN
BEGIN
多头止损:=SELL(多头止损条件,0,MARKETR);
END
IF HOLDING<0 AND 空头止损条件 THEN
BEGIN
空头止损:=SELLSHORT(空头止损条件,0,MARKETR);
END
多头波段止盈条件:c>=(2-zy)*AVGENTERPRICE AND MARK>=0 ;
空头波段止盈条件:c<=zy*AVGENTERPRICE AND MARK<=0;
多头趋势止盈条件1:c>=(2-zy1)*AVGENTERPRICE AND MARK>=0;
空头趋势止盈条件1:c<=zy1*AVGENTERPRICE AND MARK<=0;
IF mc<=50 AND MC>10 THEN BEGIN
A:=1;
if 多头波段止盈条件 AND 手数*2 then
begin
多头波段止盈:sell(holding=2,1,MARKETR);
end
end
IF mc2<=50 AND MC2>10 THEN BEGIN
A:=-1;
if 空头波段止盈条件 AND 手数*2 AND ISDOWN then
begin
空头波段止盈:sellshort( holding=-2, 1,MARKETR);
end
end
IF mc>50 THEN BEGIN
A:=-1;
if 多头趋势止盈条件1 AND 手数*1 AND MC>50 then
begin
多头趋势止盈高1:sell(holding=1,1,MARKETR);
end
if 多头趋势止盈条件1 AND 手数*2 AND MC>50 then
begin
多头趋势止盈高1A:sell(holding=2,1,MARKETR);
mark:=-1;
end
end
IF mc2>50 THEN BEGIN
A:=1;
if 空头趋势止盈条件1 AND 手数*1 AND MC2>50 then
begin
空头趋势止盈高2:sellshort( holding=-1, 1,MARKETR);
end
if 空头趋势止盈条件1 AND 手数*2 AND MC2>25 then
begin
空头趋势止盈高2A:sellshort( holding=-2, 1,MARKETR);
end
end