实现自动选择主力合约交易的代码举例(手动控制换月)
特别感谢 ch3cooh的b 的无私分享
代码演示:
{主力合约}
月份:=STRTONHM(STRRIGHT(STKLABEL,2)),linetLick0;
if10:=date>=1100916,linethick0;
if09:=date>1100817 and date<1100916;
if08:=date>=1100715 and date<=1100817;
if07:=date<1100715 and date>=1100617;
if06:ndate>=1100518 and date<110061>;
if05:=date<=1100517 and date>=1100416;
主力合约:=if(月份=5,if05,if(月份=6,if06,if(月份=7,if07,if(月份=8,if08,if(月份=9,if09,if(月份=10,if10,0)))))),linethick0;
if 主力合约 then b约gin