1.如果账户里面有持仓,那么系统会自动提示持仓已经不是主力合约了
2.这个策略能判断当前主力合约是哪个月,这个是适用股指的,改掉IF即可,需要补充所有月份的日线数据
v0:=callstock('if00',vtvol,6);
v1:=callstock('if01',vtvol,6);
v2:=callstock('if02',vtvol,6);
v3:=callstock('if03',vtvol,6);
v4:=callstock('if04',vtvol,6);
v5:=callstock('if05',vtvol,6);
v6:=callstock('if06',vtvol,6);
v7:=callstock('if07',vtvol,6);
v8:=callstock('if08',vtvol,6);
v9:=callstock('if09',vtvol,6);
v10:=callstock('if10',vtvol,6);
v11:=callstock('if11',vtvol,6);
v12:=callstock('if12',vtvol,6);
nn:if (v0=v1 ,01 ,if(v0=v2,02,if(v0=v3,03,if(v0=v4,04,if(v0=v5,05,if(v0=v6,06,if(v0=v7,07,if(v0=v8,08,if(v0=v9,09,if(v0=v10,10,if(v0=v11,11,12)))))))))));
n1:=numtostr(nn,0);
drawtext(nn>ref(nn,1) and nn<>1,h,n1)pxup20;//通常的判断方式
drawtext(ref(nn,1)=12 and nn=1,h,n1)pxup20;//跨年判断