 
等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
- gxx978
|
修正了部分语法错误,添加了手数的定义,如下:
INPUT:P(5,1,100,1)M(4,1,100,1),N(9,1,100,10),P1(3,2,40,4),P2(3,2,40,4),SS(1,1,10000,1);
INPUT:手数(1,1,100,1);
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;
RSV:= (HHV(HIGH,N)-CLOSE)/(HHV(HIGH,N)-LLV(LOW,N))*100;
LWR1:SMA(RSV,P1,1);
LWR2:SMA(LWR1,P2,1);
KD:=PDI>10 AND LWR1>70;//开多条件
PD:=PDI>50 AND LWR1<30;//平多条件
KK:=MDI>10 AND LWR2<15;//开空条件
PK:=MDI<50 AND LWR2>70;//平空条件
IF KD THEN BUY(1,手数,MARKET);//开多条件
IF KK THEN BUYSHORT(1,手数,MARKET);//开空条件
IF PD THEN SELL(1,HOLDING,MARKET);//平多条件
IF PK THEN SELLSHORT(1,HOLDING,MARKET);//平空条件
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;//输出当前资产,但不影响坐标最高最低值 |
|