欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [原创]套利策略

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有10199人关注过本帖树形打印复制链接

主题:[原创]套利策略

帅哥哟,离线,有人找我吗?
z7c9
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[原创]套利策略  发帖心情 Post By:2013/3/29 6:03:03 [只看该作者]

runmode:0;

symbol1:='y13';
symbol2:='p13';

lots1:=1;
lots2:=1;

close1:=callstock(symbol1,vtclose,6,0);
close2:=callstock(symbol2,vtclose,6,0);

spread:=close1-close2;

length:=20;

myma:=ma(spread,length);

if stricmp(stklabel,symbol1)=0 then begin
 if holding=0 then begin
  if spread>myma then
   buy(1,lots1,limitr,close);
 end
 
 if holding=0 then begin
  if spread<myma then
   buyshort(1,lots1,limitr,close);
 end
 
 if holding>0 then begin
  if spread<myma then begin
   sell(1,lots1,limitr,close);
   buyshort(1,lots1,limitr,close);
  end 
 end
 
 if holding<0 then begin
  if spread>myma then begin
   sellshort(1,lots1,limitr,close);
   buy(1,lots1,limitr,close);
  end 
 end
end

if stricmp(stklabel,symbol2)=0 then begin
 if holding=0 then begin
  if spread<myma then
   buy(1,lots2,limitr,close);
 end
 
 if holding=0 then begin
  if spread>myma then
   buyshort(1,lots2,limitr,close);
 end
 
 if holding>0 then begin
  if spread>myma then begin
   sell(1,lots2,limitr,close);
   buyshort(1,lots2,limitr,close);
  end 
 end
 
 if holding<0 then begin
  if spread<myma then begin
   sellshort(1,lots2,limitr,close);
   buy(1,lots2,limitr,close);
  end 
 end
end

盈亏:asset-500000,noaxis,colorred,linethick2;

 

 

runmode:0;

y盈亏:=stkindi('y13','tt.盈亏',0,6,0),noaxis;
p盈亏:=stkindi('p13','tt.盈亏',0,6,0),noaxis;

总体盈亏:y盈亏+p盈亏,noaxis,linethick2;

 

 


图片点击可在新窗口打开查看此主题相关图片如下:5555.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
独孤求败
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:73 积分:177 威望:0 精华:0 注册:2012/12/30 1:44:06
  发帖心情 Post By:2013/3/29 7:16:11 [只看该作者]

不错

 回到顶部
帅哥哟,离线,有人找我吗?
solarhe2006
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:252 积分:1001 威望:0 精华:0 注册:2010/2/15 16:47:58
  发帖心情 Post By:2013/3/30 14:16:34 [只看该作者]

http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=50390

runmode:0;

symbol1:='y13';
symbol2:='p13';

lots1:=1;
lots2:=1;

close1:=callstock(symbol1,vtclose,6,0);
close2:=callstock(symbol2,vtclose,6,0);

spread:=close1-close2;

length:=20;

myma:=ma(spread,length);

if stricmp(stklabel,symbol1)=0 then begin
 if holding=0 then begin
  if spread>myma then
   buy(1,lots1,limitr,close);
 end
 
 if holding=0 then begin
  if spread<myma then
   buyshort(1,lots1,limitr,close);
 end
 
 if holding>0 then begin
  if spread<myma then begin
   sell(1,lots1,limitr,close);
   buyshort(1,lots1,limitr,close);
  end 
 end
 
 if holding<0 then begin
  if spread>myma then begin
   sellshort(1,lots1,limitr,close);
   buy(1,lots1,limitr,close);
  end 
 end
end

if stricmp(stklabel,symbol2)=0 then begin
 if holding=0 then begin
  if spread<myma then
   buy(1,lots2,limitr,close);
 end
 
 if holding=0 then begin
  if spread>myma then
   buyshort(1,lots2,limitr,close);
 end
 
 if holding>0 then begin
  if spread>myma then begin
   sell(1,lots2,limitr,close);
   buyshort(1,lots2,limitr,close);
  end 
 end
 
 if holding<0 then begin
  if spread<myma then begin
   sellshort(1,lots2,limitr,close);
   buy(1,lots2,limitr,close);
  end 
 end
end

盈亏:asset-500000,noaxis,colorred,linethick2;

 

 

runmode:0;

y盈亏:=stkindi('y13','tt.盈亏',0,6,0),noaxis;
p盈亏:=stkindi('p13','tt.盈亏',0,6,0),noaxis;

总体盈亏:y盈亏+p盈亏,noaxis,linethick2;

 


 回到顶部
帅哥哟,离线,有人找我吗?
wilsonax
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:47 积分:10 威望:0 精华:0 注册:2013/1/29 12:20:19
  发帖心情 Post By:2013/10/10 22:36:00 [只看该作者]

有个问题:
y盈亏:=stkindi('y13','tt.盈亏',0,6,0),noaxis;

这里面的“tt”是什么?

 回到顶部
帅哥哟,离线,有人找我吗?
wilsonax
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:47 积分:10 威望:0 精华:0 注册:2013/1/29 12:20:19
  发帖心情 Post By:2013/10/17 9:14:40 [只看该作者]

有个问题:
y盈亏:=stkindi('y13','tt.盈亏',0,6,0),noaxis;

这里面的“tt”是什么?

 回到顶部