- UID
- 2
- 积分
- 2869185
- 威望
- 1384620 布
- 龙e币
- 1484565 刀
- 在线时间
- 13082 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-14
|
源码如下:
- //股指与300ETF之间的价差套利代码演示
- //做空股指
- VERTLINE(time=CLOSETIME(0),hhv(h,240/5),llv(l,240/5),coloryellow,1,vtDASH);
- 股指:"IF00$CLOSE",linethick0;
- 沪深300:"000300$CLOSE",linethick0;
- 差值:股指-沪深300,linethick0;
-
- short:=差值>=20;
- shortend:=差值<=10;
- t1:=time>093500 and time<145500;
-
- if holding=0 and t1 then begin
- buyshort(short,1,thisclose);
- end
-
- if holding<0 and t1 then sellshort(shortend,1,thisclose);
-
-
-
- //做多300ETF www.cxh99.com
-
- VERTLINE(time=CLOSETIME(0),hhv(h,240/5),llv(l,240/5),coloryellow,1,vtDASH);
- 股指:"IF00$CLOSE",linethick0;
- 沪深300:"000300$CLOSE",linethick0;
- 差值:股指-沪深300,linethick0;
-
- long:=差值>=20;
- longend:=差值<=10;
- t1:=time>093500 and time<145500;
-
- if holding=0 and t1 then begin
- buy(long,1,thisclose);//www.cxh99.com
- end
-
- if holding>0 and t1 then sell(longend,1,thisclose);
-
-
- //特别提示,一手股指的合约金额比较大,对应的ETF份数也比较大。这里需要自行调节买卖的ETF份数
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|