不明白又是回测又是交易其他合约的
回测和交易没关系吧?
意思是要测试一下下单映射之后的盈利?
这个要引用指数上的开仓条件和平仓条件进行测评了
比如测试的公式名字叫CS,代码中有这么一段:
kd:开多条件;
hh1:holding;
if kd and hh1=0 then buy........;
kk:开空条件;
hh2:holding;
if kk and hh2=0 then buy........;
pd:平多条件;
hh3:holding;
if pd and hh3>0 then sell........;
pk:平空条件;
hh4:holding;
if pk and hh4<0 then sellshort........;
然后新建一个公式,用来测评
kd:stkindi('if13','公式1.kd',0,datatype);
hh1:stkindi('if13','公式1.hh1',0,datatype);
if kd and hh1=0 then buy........;
kk:stkindi('if13','公式1.kk',0,datatype);
hh2:stkindi('if13','公式1.hh2',0,datatype);
if kk and hh2=0 then buy........;
pd:stkindi('if13','公式1.pd',0,datatype);
hh3:stkindi('if13','公式1.hh3',0,datatype);
if pd and hh3>0 then sell........;
pk:stkindi('if13','公式1.pk',0,datatype);
hh4:stkindi('if13','公式1.hh4',0,datatype);
if pk and hh4<0 then sellshort........;