M1:=if(MONTH()>1,MONTH()-1,1);
HY1:='IF' + If(M1>9,numtostr(M1,0),'0'+numtostr(M1,0)); //当前月合约
HY2:='IF' + If(M1+1>9,numtostr(M1+1,0),'0'+numtostr(M1+1,0));//下月合约
HY0:='IF00';
VHY0:=CALLSTOCK(HY0,VTVOL,6,0),linethick0;
VHY1:=CALLSTOCK(HY1,VTVOL,6,0),linethick0;
VHY2:=CALLSTOCK(HY2,VTVOL,6,0),linethick0;
if VHY1=VHY0 then CurMonth:=Month();
if VHY2=VHY0 then CurMonth:=Month()+1;
主力:curmonth,linethick0;
curmonth1:if(CurMonth<12,curmonth+1,1),linethick0;
thisif:='if'+If(curmonth>9,numtostr(curmonth,0),'0'+numtostr(curmonth,0));
nextif:='if'+If(curmonth1>9,numtostr(curmonth1,0),'0'+numtostr(curmonth1,0));
c1:CALLSTOCK('if00',vtclose,1,0);
if00c:CALLSTOCK(thisif,vtclose,1,0);
问题:if00c同c1的输出为什么不一样?
你代码逻辑有问题,你自己输出的处理条件
EXPLAIN(1,thisif);
EXPLAIN(1,nextif);
对应的不是主力合约
1,可以使用msgout输出当前主力具体合约看下,尝试把第一条语句改为M1:=if(MONTH()>1,MONTH(),1);
2,针对12月份的,防止出现下个月合约为IF13,需要单独判定下if m1=12 then HY2:='IF01';
1可以考虑直接使用DYNAINFO(210)
[此贴子已经被作者于2017-3-7 10:37:55编辑过]