等级: 专业版
- 注册:
- 2022-1-11
- 曾用名:
|
ZH1:'18138872889';
PZ1:'P01';
VARIABLE:A=0;
//条件判断
MA5:MA(CLOSE,3);
MA10:MA(CLOSE,5);
A1:=CROSS(MA5,MA10);
A2:=CROSS(MA10,MA5);
A11:=CROSS(MA5,MA10) and C>O;
A21:=CROSS(MA10,MA5) and C<O;
//控制日内交易次数
IF TTOTALDAYTRADE>=300 THEN EXIT;
//交易系统
TSELLSHORT(A1,TSELLHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //平空仓
TBUY(A1 AND TBUYHOLDINGEX( ZH1,PZ1 ,0 )=0,1,LMT,CLOSE,0,ZH1,PZ1 ); //开多1仓
TSELL(A2,TBUYHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //平多仓
TBUYSHORT(A2 AND TBUYHOLDINGEX( ZH1,PZ1 ,0 )=0,1,LMT,CLOSE,0,ZH1,PZ1 ); //开空1仓
//加仓
IF TBUYHOLDINGEX( ZH1,PZ1 ,0 )<4 THEN BEGIN
开多2:TBUY(A11=1,2,LMT,CLOSE,ZH1,PZ1); //开多2仓
END
IF TBUYHOLDINGEX( ZH1,PZ1 ,0 )<4 THEN BEGIN
开空2:TBUYSHORT(A21=1,2,LMT,CLOSE,ZH1,PZ1); //开空2仓
END
//固定止损止盈
IF DYNAINFO( 7)-TAVGENTERPRICEEX2(ZH1 ,PZ1 ,0 )>15*MINDIFF THEN BEGIN
TSELL(1,TBUYHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //固定止多盈
END
IF TAVGENTERPRICEEX2(ZH1 ,PZ1 ,0 )-C>10*MINDIFF THEN BEGIN
TSELL(1,TBUYHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //固定止多损
END
IF DYNAINFO( 7)-TAVGENTERPRICEEX2(ZH1 ,PZ1 ,1 )>15*MINDIFF THEN BEGIN
TSELL(1,TSELLHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //固定止空盈
END
IF TAVGENTERPRICEEX2(ZH1 ,PZ1 ,1 )-C>10*MINDIFF THEN BEGIN
TSELL(1,TSELLHOLDINGEX( ZH1,PZ1 ,0 ),MKT,0,ZH1,PZ1); //固定止空损
END
//监控未成交单
WCJ:=TREMAINQTY( 1, ZH1,PZ1);
IF WCJ<>0 THEN BEGIN
A:=WCJ;
END
//对为成交单撤单,并追单
IF WCJ>0 THEN BEGIN
TCANCELEX(1,1,ZH1,PZ1 );
TBUY(WCJ=0,A,MKT,0,ZH1,PZ1);
END
//监控持仓和资金状况
当前持仓量:=TBUYHOLDINGEX( ZH1,PZ1 ,0 );
当前可用资金:=TACCOUNT(19);
DEBUGOUT('当前持仓量%.2f',当前持仓量 );
DEBUGOUT('当前可用资金%.2f',当前可用资金 );
//收盘前强平
IF CURRENTTIME>=150000 THEN BEGIN
TSELL(1,0,MKT,0,ZH1,PZ1);
END
|
|