沪镍2分钟波段策略
PARAM1:=105; PARAM2:=-25; NX1:=7; NX2:=8; NX3:=9;
NN:=BARSLAST(DATE<>REF(DATE,1))+1; YC:=REF(C,NN);
YO:=REF(REF(O,NN-1),NN); YYC:=REF(REF(C,NN),NN); TDO:=REF(O,NN);
TDOMAX:=MAX1(TDO,REF(TDO,NN),REF(REF(TDO,NN),NN)); TDOMIN:=MIN1(TDO,REF(TDO,NN),REF(REF(TDO,NN),NN)); LOTS:=300000/(0.1*UNIT*CLOSE);
MA5BD:=(ABS(REF(O,SUMBARS(NN=1,2))-REF(C,SUMBARS(NN=1,1)+1))+ABS(REF(O,SUMBARS(NN=1,3))-REF(C,SUMBARS(NN=1,2)+1))+ABS(REF(O,SUMBARS(NN=1,4))-REF(C,SUMBARS(NN=1,3)+1))+ABS(REF(O,SUMBARS(NN=1,5))-REF(C,SUMBARS(NN=1,4)+1))+ABS(REF(O,SUMBARS(NN=1,6))-REF(C,SUMBARS(NN=1,5)+1)))/5; HHS:=REF(HHV(H,10),NX2)*(1000+NX3)/1000; LLS:=REF(LLV(L,10),NX2)*(1000-NX3)/1000;
BUYMARKET:=IF(YYC/YC>=1,1,0);
BUYMARKETBUYPRICE:=IF(BUYMARKET=1,TDOMAX+PARAM2*MA5BD/100,TDOMAX);
BUYMARKETSHORTPRICE:=IF(BUYMARKET=1,TDOMIN-PARAM1*MA5BD/100,TDOMIN);
SHORTMARKET:=IF(YYC/YC<1,1,0);
SHORTMARKETBUYPRICE:=IF(SHORTMARKET=1,TDOMAX+PARAM1*MA5BD/100,TDOMAX);
SHORTMARKETSHORTPRICE:=IF(SHORTMARKET=1,TDOMIN-PARAM2*MA5BD/100,TDOMIN);
JUMPK:=ABS((REF(O,NN-1)-YC)/YC*1000); NNN:=IF(JUMPK>3,9,0);
KEY:=ABS(YC-YO)<=0.2*MA5BD AND ABS(YC-YO)>=0*MA5BD; KEY1:=ABS(YC-YO)<=2.5*MA5BD AND ABS(YC-YO)>=0.25*MA5BD;
LASTMAXBKPRICE:=IF(COUNTSIG(BK,REF(NN,NN)*3)>0,HHV(BKPRICE,REF(NN,NN)*3)*(1000+0)/1000,C);
LASTMINSKPRICE:=IF(COUNTSIG(SK,REF(NN,NN)*3)>0,LLV(SKPRICE,REF(NN,NN)*3)*(1000-0)/1000,C);
LASTMAXBPPRICE:=IF(COUNTSIG(BP,REF(NN,NN)*3)>0,HHV(REF(C,BARSBP),REF(NN,NN)*3)*(1000+0)/1000,C);
LASTMINSPPRICE:=IF(COUNTSIG(SP,REF(NN,NN)*3)>0,LLV(REF(C,BARSSP),REF(NN,NN)*3)*(1000-0)/1000,C);
XX1:=IF(LASTOFFSETPROFIT<0 AND ISLASTBP=1,BARSBP,1000); XX2:=IF(LASTOFFSETPROFIT<0 AND ISLASTSP=1,BARSSP,1000); YY1:=IF(ISLASTBPK=1,BARSBK,1000); YY2:=IF(ISLASTSPK=1,BARSSK,1000); NN>=NNN
AND
BKVOL=0
AND KEY=1
AND
BUYMARKET=1
C>=BUYMARKETBUYPRICE AND
C>=LASTMAXBKPRICE
C>=LASTMAXBPPRICE AND XX1>REF(NN,NN),BK(LOTS); NN>=NNN
AND
SKVOL=0
AND
KEY=1
AND
BUYMARKET=1
C<=BUYMARKETSHORTPRICE AND
C<=LASTMINSKPRICE
C<=LASTMINSPPRICE AND XX2>REF(NN,NN),SK(LOTS);
NN>=NNN AND BKVOL=0 AND KEY=1 AND SHORTMARKET=1 C>=SHORTMARKETBUYPRICE
AND
C>=LASTMAXBKPRICE
C>=LASTMAXBPPRICE AND XX1>REF(NN,NN),BK(LOTS);
NN>=NNN AND SKVOL=0 AND KEY=1 AND SHORTMARKET=1 C<=SHORTMARKETSHORTPRICE
AND
C<=LASTMINSKPRICE
C<=LASTMINSPPRICE AND XX2>REF(NN,NN),SK(LOTS); NN>=NNN
AND
BKVOL=0
AND KEY1=1
AND
BUYMARKET=1
C>=BUYMARKETBUYPRICE AND
C>=LASTMAXBKPRICE
C>=LASTMAXBPPRICE AND XX1>REF(NN,NN),BK(LOTS); NN>=NNN
AND
SKVOL=0
AND
KEY1=1
AND
BUYMARKET=1
C<=BUYMARKETSHORTPRICE AND
C<=LASTMINSKPRICE
C<=LASTMINSPPRICE AND XX2>REF(NN,NN),SK(LOTS);
AND AND
AND AND
AND AND
AND AND
AND AND
AND AND