等级: 新手上路
- 注册:
- 2021-8-23
- 曾用名:
|
//*****************************
账户:'1000';
套利品种1:'IF11';
套利品种2:'IF12';
//定义DMI指标
P:=14;
N:=6;
M:=7;
TR1:= SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),P);
HD:= HIGH-REF(HIGH,1);
LD:= REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 AND HD>LD,HD,0),P);
DMM:= SUM(IF(LD>0 AND LD>HD,LD,0),P);
PDI: DMP*100/TR1;
MDI: DMM*100/TR1;
ADX: MA(ABS(MDI-PDI)/(MDI+PDI)*100,200);
ADXR:(ADX+REF(ADX,M))/2;
//开仓
IF ALL(c>o ,3 ) THEN BEGIN
TBUYSHORT(1,1,MKT ,0,0,1000,IF11);
TBUY(1,1,MKT ,0,0,1000,IF12);
END
//清仓
IF (OPENPROFIT-2*TACCOUNT(31))>50 THEN BEGIN
SELL(1,HOLDING,MARKET);
SELLSHORT(1,HOLDING,MARKET);
END
另外加一行程序
以上作为整个循环,如果没有循环完成不进入下一次循环
|
|