公式1:
nn1:=barslast(开多a);
nn2:=barslast(开空a);
mm1:=barslast(开多b);
mm2:=barslast(开空b);
公式2:
nn1:stkindi('','公式1.nn1',0,datatype);
nn2:stkindi('','公式1.nn2',0,datatype);
mm1:stkindi('','公式1.mm1',0,datatype);
mm2:stkindi('','公式1.mm2',0,datatype);
if nn1<nn2 and stricmp(stklabel,'品种a') then buy(holding=0,1,market);
if nn1>nn2 and stricmp(stklabel,'品种b') then buy(holding=0,1,market);
if mm1<mm2 and stricmp(stklabel,'品种a') then buyshort(holding=0,1,market);
if mm1>mm2 and stricmp(stklabel,'品种b') then buyshort(holding=0,1,market);