Board logo

标题: [金字塔源码] 金字塔股指与300ETF之间的价差套利代码 [打印本页]

作者: 龙听    时间: 2018-9-30 13:38     标题: 金字塔股指与300ETF之间的价差套利代码

源码如下:
  1. //股指与300ETF之间的价差套利代码演示

  2. //做空股指
  3. VERTLINE(time=CLOSETIME(0),hhv(h,240/5),llv(l,240/5),coloryellow,1,vtDASH);
  4. 股指:"IF00$CLOSE",linethick0;
  5. 沪深300:"000300$CLOSE",linethick0;
  6. 差值:股指-沪深300,linethick0;

  7. short:=差值>=20;
  8. shortend:=差值<=10;
  9. t1:=time>093500 and time<145500;

  10. if holding=0 and t1 then begin
  11. buyshort(short,1,thisclose);
  12. end

  13. if holding<0 and t1 then sellshort(shortend,1,thisclose);



  14. //做多300ETF www.cxh99.com

  15. VERTLINE(time=CLOSETIME(0),hhv(h,240/5),llv(l,240/5),coloryellow,1,vtDASH);
  16. 股指:"IF00$CLOSE",linethick0;
  17. 沪深300:"000300$CLOSE",linethick0;
  18. 差值:股指-沪深300,linethick0;

  19. long:=差值>=20;
  20. longend:=差值<=10;
  21. t1:=time>093500 and time<145500;

  22. if holding=0 and t1 then begin
  23. buy(long,1,thisclose);//www.cxh99.com
  24. end

  25. if holding>0 and t1 then sell(longend,1,thisclose);


  26. //特别提示,一手股指的合约金额比较大,对应的ETF份数也比较大。这里需要自行调节买卖的ETF份数
复制代码





欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2