等级: 新手上路
- 注册:
- 2021-7-16
- 曾用名:
|
楼主 |
发表于 2021-7-16 10:12
|
显示全部楼层
J70:=stkindi('','KDJ.J',0,7),noaxis;
CCI70:=stkindi('','CCI.CCI',0,7),noaxis;
J71:=stkindi('','KDJ.J',0,7,-1),noaxis;
CCI71:=stkindi('','CCI.CCI',0,7,-1),noaxis;
J72:=stkindi('','KDJ.J',0,7,-2),noaxis;
CCI72:=stkindi('','CCI.CCI',0,7,-2),noaxis;
DIFF70:=stkindi('','MACD.DIFF',0,7),noaxis;
DEA70:=stkindi('','MACD.DEA',0,7),noaxis;
DIFF71:=stkindi('','MACD.DIFF',0,7,-1),noaxis;
DEA71:=stkindi('','MACD.DEA',0,7,-1),noaxis;
DIFF72:=stkindi('','MACD.DIFF',0,7,-2),noaxis;
DEA72:=stkindi('','MACD.DEA',0,7,-2),noaxis;
DIFF0:=stkindi('','MACD.DIFF',0, datatype);
DEA0:=stkindi('','MACD.DEA',0, datatype);
DIFF1:=stkindi('','MACD.DIFF',0, datatype,-1);
DEA1:=stkindi('','MACD.DEA',0, datatype,-1);
DIFF2:=stkindi('','MACD.DIFF',0, datatype,-2);
DEA2:=stkindi('','MACD.DEA',0, datatype,-2);
k0:=stkindi('','KDJ.k',0, datatype);
k1:=stkindi('','KDJ.k',0, datatype,-1);
k2:=stkindi('','KDJ.k',0, datatype,-2);
d0:=stkindi('','KDJ.d',0, datatype);
d1:=stkindi('','KDJ.d',0, datatype,-1);
d2:=stkindi('','KDJ.d',0, datatype,-2);
J0:=stkindi('','KDJ.J',0, datatype);
J1:=stkindi('','KDJ.J',0, datatype,-1);
J2:=stkindi('','KDJ.J',0, datatype,-2);
MA10:=stkindi('','MA.MA1',0, datatype);
MA11:=stkindi('',' MA.MA1',0, datatype,-1);
MA12:=stkindi('',' MA.MA1',0, datatype,-2);
MA20:=stkindi('','MA.MA2',0, datatype);
MA21:=stkindi('',' MA.MA2',0, datatype,-1);
MA22:=stkindi('',' MA.MA2',0, datatype,-2);
CCI0:=stkindi('','CCI.CCI',0, datatype);
CCI1:=stkindi('','CCI.CCI',0, datatype,-1);
UPPER0:=stkindi('','BOLL.UPPER',0, datatype);
UPPER1:=stkindi('','BOLL.UPPER',0, datatype,-1);
UPPER2:=stkindi('','BOLL.UPPER',0, datatype,-2);
UPPER3:=stkindi('','BOLL.UPPER',0, datatype,-3);
UPPER4:=stkindi('','BOLL.UPPER',0, datatype,-4);
UPPER5:=stkindi('','BOLL.UPPER',0, datatype,-5);
LOWER0:=stkindi('','BOLL.LOWER',0, datatype);
LOWER1:=stkindi('','BOLL.LOWER',0, datatype,-1);
LOWER2:=stkindi('','BOLL.LOWER',0, datatype,-2);
LOWER3:=stkindi('','BOLL.LOWER',0, datatype,-3);
LOWER4:=stkindi('','BOLL.LOWER',0, datatype,-4);
LOWER5:=stkindi('','BOLL.LOWER',0, datatype,-5);
xy:=if(c<o,c-l,o-l);
sy:=if(c<O,h-o,h-c);
pd:=if(c<o,h=o,h=c);
MACD金叉:=DIFF1<DEA1 and DIFF0>DEA0;
MACD金叉1:=DIFF2<DEA2 and DIFF1>DEA1 and DIFF0>DEA0;
MACD金叉区:=DIFF2>DEA2 and DIFF1>DEA1 and DIFF0>DEA0;
MACD死叉:=DIFF1>DEA1 and DIFF0<DEA0;
MACD死叉1:=DIFF2>DEA2 and DIFF1<DEA1 and DIFF0<DEA0;
MACD死叉区:=DIFF2<DEA2 and DIFF1<DEA1 and DIFF0<DEA0;
K1:=O/C>=1.05 AND C<O AND ((H-L)<=(O-C)*1.36 OR (H-L)=(O-C)) and REF(O,1)>LOWER1 AND REF(C,1)>LOWER1 AND REF(O,2)>LOWER2 AND REF(C,2)>LOWER2 AND J71>-5 AND CCI71>-220 AND J1>-5 AND CCI1>-220 and ((DIFF1>DEA1 and DIFF0<DEA0) or (DIFF2>DEA2 and DIFF1<DEA1 and DIFF0<DEA0) OR (MACD死叉区 and (abs(DIFF0-DEA0)>abs(DIFF1-DEA1)*1.1 or abs(DIFF0-DEA0)>abs(DIFF2-DEA2)*1.1)) OR (MACD金叉区 and (abs(DIFF0-DEA0)<abs(DIFF1-DEA1)*0.9 or abs(DIFF0-DEA0)<abs(DIFF2-DEA2)*0.9))) AND DIFF0<DIFF1;
K2:=REF(O,1)/REF(C,1)>=1.025 AND O/C>=1.025 AND REF(C,1)<REF(O,1) AND O<REF(O,1) AND C<REF(C,1) AND C<O AND ((HHV(H,2)-LLV(L,2))<=(HHV(O,2)-LLV(C,2))*1.36 OR (HHV(h,2)-LLV(l,2))=(HHV(O,2)-LLV(C,2))) and REF(O,1)>LOWER1 AND REF(C,1)>LOWER1 AND REF(O,2)>LOWER2 AND REF(C,2)>LOWER2 AND J71>-5 AND CCI71>-220 AND J1>-5 AND CCI1>-220 and ((DIFF1>DEA1 and DIFF0<DEA0) or (DIFF2>DEA2 and DIFF1<DEA1 and DIFF0<DEA0) OR (MACD死叉区 and (abs(DIFF0-DEA0)>abs(DIFF1-DEA1)*1.1 or abs(DIFF0-DEA0)>abs(DIFF2-DEA2)*1.1)) OR (MACD金叉区 and (abs(DIFF0-DEA0)<abs(DIFF1-DEA1)*0.9 or abs(DIFF0-DEA0)<abs(DIFF2-DEA2)*0.9))) AND DIFF0<DIFF1;
D1:=C/O>1.05 and c>o AND ((H-L)<=(C-O)*1.36 OR (H-L)=(C-O)) and REF(O,1)<UPPER1 AND REF(C,1)<UPPER1 AND REF(O,2)<UPPER2 AND REF(C,2)<UPPER2 AND J71<105 AND CCI71<220 AND J1<105 AND CCI1<220 and ((DIFF1<DEA1 and DIFF0>DEA0) or (DIFF2<DEA2 and DIFF1>DEA1 and DIFF0>DEA0) or (MACD金叉区 and (abs(DIFF0-DEA0)>abs(DIFF1-DEA1)*1.1 or abs(DIFF0-DEA0)>abs(DIFF2-DEA2)*1.1)) OR (MACD死叉区 and (abs(DIFF0-DEA0)<abs(DIFF1-DEA1)*0.9 or abs(DIFF0-DEA0)<abs(DIFF2-DEA2)*0.9))) AND DIFF0>DIFF1;
D2:=REF(C,1)/REF(O,1)>=1.025 and REF(c,1)>REF(o,1) AND C/O>=1.025 and c>o AND O>REF(O,1) AND C>REF(C,1) AND ((hhv(h,2)-llv(l,2))<=(hhv(C,2)-LLV(O,2))*1.36 OR (hhv(h,2)-llv(l,2))=(hhv(C,2)-LLV(O,2))) and REF(O,1)<UPPER1 AND REF(C,1)<UPPER1 AND REF(O,2)<UPPER2 AND REF(C,2)<UPPER2 AND J71<105 AND CCI71<220 AND J1<105 AND CCI1<220 and ((DIFF1<DEA1 and DIFF0>DEA0) or (DIFF2<DEA2 and DIFF1>DEA1 and DIFF0>DEA0) or (MACD金叉区 and (abs(DIFF0-DEA0)>abs(DIFF1-DEA1)*1.1 or abs(DIFF0-DEA0)>abs(DIFF2-DEA2)*1.1)) OR (MACD死叉区 and (abs(DIFF0-DEA0)<abs(DIFF1-DEA1)*0.9 or abs(DIFF0-DEA0)<abs(DIFF2-DEA2)*0.9))) AND DIFF0>DIFF1;
if holding>0 and ((C<ref(L,enterbars) AND DIFF2>DEA2 and DIFF1<DEA1 and DIFF0<DEA0) OR (C<ref(C,enterbars) AND DIFF2>DEA2 and DIFF1<DEA1 and DIFF0<DEA0) OR (C<ref(L,enterbars)*0.985) OR (C<=ref(C,enterbars)*0.96)) then 止损多单:sell(1,0,thisclose);
if holding>0 and J1>106 AND J0<J1 AND DIFF0<DIFF1 then 多单止盈1:sell(1,0,thisclose);
if holding>0 and REF(H,2)>UPPER2 AND REF(H,1)>UPPER1 AND DIFF0<DIFF1 AND UPPER0<UPPER1 then 多单止盈2:sell(1,0,thisclose);
if holding>0 and REF(H,3)>UPPER3 AND REF(H,2)>UPPER2 AND REF(H,1)>UPPER1 AND H>UPPER 0 AND C<O AND DIFF0<DIFF1 then 多单止盈3:sell(1,0,thisclose);
if holding>0 and REF(H,4)>UPPER4 AND REF(H,3)>UPPER3 AND REF(H,2)>UPPER2 AND REF(H,1)>UPPER1 AND H>UPPER0 and c<o then 多单止盈4:sell(1,0,thisclose);
if holding>0 and REF(H,1)>UPPER1 AND H>UPPER0 AND H<REF(H,1) AND L<REF(L,1) AND C<REF(C,1) AND REF(C,1)<REF(O,1) AND C<O then 多单止盈5:sell(1,0,thisclose);
if holding<0 and ((C>ref(H,enterbars) AND DIFF2<DEA2 and DIFF1>DEA1 and DIFF0>DEA0) OR (C>ref(C,enterbars) AND DIFF2<DEA2 and DIFF1>DEA1 and DIFF0>DEA0) OR (C>ref(H,enterbars)*1.015) OR (C>=ref(C,enterbars)*1.04)) then 止损空单:sellshort(1,0,thisclose);
if holding<0 and J1<-6 AND J0>J1 AND DIFF0>DIFF1 then 空单止盈1:sellshort(1,0,thisclose);
if holding<0 and REF(L,2)<LOWER2 AND REF(L,1)<LOWER1 AND DIFF0>DIFF1 AND LOWER0>LOWER1 then 空单止盈2:sellshort(1,0,thisclose);
if holding<0 and REF(L,3)<LOWER3 AND REF(L,2)<LOWER2 AND REF(L,1)<LOWER1 AND L<LOWER0 AND C>O AND DIFF0>DIFF1 then 空单止盈3:sellshort(1,0,thisclose);
if holding<0 and REF(L,4)<LOWER4 AND REF(L,3)<LOWER3 AND REF(L,2)<LOWER2 AND REF(L,1)<LOWER1 AND L<LOWER0 and c>o then 空单止盈4:sellshort(1,0,thisclose);
if holding<0 and REF(L,1)<LOWER1 AND L<LOWER0 AND H>REF(H,1) AND L>REF(L,1) AND C>REF(C,1) AND REF(C,1)>REF(O,1) AND C>O then 空单止盈5:sell(1,0,thisclose);
if d1 or d2 then begin
sellshort(1,0,thisclose);
buy(holding=0,1,thisclose);
end
if k1 or k2 then begin
sell(1,0,thisclose);
buyshort(holding=0,1,thisclose);
end
请问以上的编写设置,语法上 是否正常?有没有错误?
谢谢老师指导!! |
|