-- 作者:pyd
-- 发布时间:2014/9/16 16:22:57
--
账户:\'1000\';//换成自己的交易账号 品种1:\'c01\'; 品种2:\'c05\';
C1:"c01$CLOSE"; C2:"c05$CLOSE"; tt:DYNAINFO(207)>=090000; A:C1-C2;//开盘差价
c01:CALLSTOCK(\'c01\',vtclose,6,-1); c05:CALLSTOCK(\'c05\',vtclose,6,-1); b:c01-c05;//昨收盘差价
if tt and a>b then TBUYSHORT(1,1,MKT ,0,0,账户,品种1 ); if tt and a<b then TBUY(1,1,MKT ,0,0,账户,品种2 );
//单腿砍仓 IF TSELLHOLDINGEX(账户,品种1,0 )=1 AND TBUYHOLDINGEX(账户,品种2,0 )=0 AND TREMAINQTY( 1,账户,品种2)=1 THEN BEGIN TSELLSHORT(1,1,MKT ,0,0,账户,品种1); END
IF TBUYHOLDINGEX(账户,品种2,0)=1 AND TSELLHOLDINGEX(账户,品种1,0)=0 AND TREMAINQTY( 1,账户,品种1)=1 THEN BEGIN TSELL(1,1,MKT ,0,0,账户,品种1 ); END
//14:59平仓 if DYNAINFO(207)>=145900 then tsellshort(1,1,MKT ,0,0,账户,品种1); if DYNAINFO(207)>=145900 then tsell(1,1,MKT ,0,0,账户,品种2);
|
-- 作者:pyd
-- 发布时间:2014/9/18 16:36:08
--
代码供参考
账户:\'1000\';//换成自己的交易账号 品种1:\'c01\'; 品种2:\'c05\';
C1:CALLSTOCK(\'c01\',vtopen,6,0); C2:CALLSTOCK(\'c05\',vtopen,6,0); A:C1-C2;//开盘差价 c01:CALLSTOCK(\'c01\',vtclose,6,-1); c05:CALLSTOCK(\'c05\',vtclose,6,-1); b:c01-c05;//昨收盘差价
if a>b then begin TBUYSHORT(TSELLHOLDINGEX(账户,品种1,0)=0,1,MKT ,0,0,账户,品种1 ); tbuy(TBUYHOLDINGEX(账户,品种2,0)=0,1,MKT ,0,0,账户,品种2 ); end if a<b then begin TBUY(TBUYHOLDINGEX(账户,品种1,0)=0,1,MKT ,0,0,账户,品种1 ); tbuyshort(TSELLHOLDINGEX(账户,品种2,0)=0,1,MKT ,0,0,账户,品种2 ); end //单腿砍仓 IF TSELLHOLDINGEX(账户,品种1,0 )=1 AND TBUYHOLDINGEX(账户,品种2,0 )=0 AND TREMAINQTY( 1,账户,品种2)=1 THEN BEGIN TSELLSHORT(1,1,MKT ,0,0,账户,品种1); END
IF TBUYHOLDINGEX(账户,品种2,0)=1 AND TSELLHOLDINGEX(账户,品种1,0)=0 AND TREMAINQTY( 1,账户,品种1)=1 THEN BEGIN TSELL(1,1,MKT ,0,0,账户,品种2 ); END
IF TSELLHOLDINGEX(账户,品种2,0)=1 AND TBUYHOLDINGEX(账户,品种1,0)=0 AND TREMAINQTY( 1,账户,品种1)=1 THEN BEGIN TSELLSHORT(1,1,MKT ,0,0,账户,品种2); END
IF TBUYHOLDINGEX(账户,品种1,0)=1 AND TSELLHOLDINGEX(账户,品种2,0)=0 AND TREMAINQTY( 1,账户,品种2)=1 THEN BEGIN TSELL(1,1,MKT ,0,0,账户,品种1); END
//14:59平仓 if DYNAINFO(207)>=145900 then begin tsellshort(1,1,MKT ,0,0,账户,品种1); tsellshort(1,1,MKT ,0,0,账户,品种2); tsell(1,1,MKT ,0,0,账户,品种1); tsell(1,1,MKT ,0,0,账户,品种2); end
|