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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → 和风版海龟源码 支持多空

   

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


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

主题:和风版海龟源码 支持多空

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


加好友 发短信
等级:新手上路 帖子:37 积分:189 威望:0 精华:0 注册:2010/12/24 12:56:02
和风版海龟源码 支持多空  发帖心情 Post By:2011/6/8 20:52:25 [只看该作者]

支持多空双向开仓,到价开仓(非收盘开仓)

 


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


加好友 发短信
等级:新手上路 帖子:37 积分:189 威望:0 精华:0 注册:2010/12/24 12:56:02
  发帖心情 Post By:2011/6/8 20:53:35 [只看该作者]

以下内容为程序代码:

1
2 input:inb(20,1,500,1),outb(10,1,500,1),risk(2,0,10,0.1);
3 //和风版海龟源码
4 variable:times=0,i=0,n=0;
5 rn:=ema(ref(tr,1),20);
6 n:=valuewhen(holding=0,rn);
7 rh:=ref(h,1);
8 rl:=ref(l,1);
9 h1:hhv(rh,inb);
10 h2:hhv(rh,outb),linedot;
11 l1:llv(rl,inb);
12 l2:llv(rl,outb),linedot;
13 lotst:asset*risk*0.01/(n*2*multiplier),linethick0;
14 lots:=if(risk=0,1,lotst); //如果risk取0,表示固定开1手
15 tbc:=h<>l;//判断是否停板
16 partline(holding>0,enterprice-2*n);
17 if barpos<inb+1 then exit;
18 if holding=0 and tbc then //不是停板才可以交易
19 begin
20 if h>h1 then //开多
21 begin
22 buyp:=max(o,h1);
23 buy(1,lots,limitr,buyp);
24 times:=1;
25 while h>enterprice+n*0.5 and times<4 do
26 begin
27 buyp:=max(o,enterprice+n*0.5);
28 buy(1,lots,limitr,buyp);
29 times:=times+1;
30 end;//连续开仓
31 end;//开多结束
32 else if l<l1 then //开空
33 begin
34 sellp:=min(o,l1);
35 buyshort(1,lots,limitr,sellp);
36 times:=1;
37 while l<enterprice-n*0.5 and times<4 do
38 begin
39 sellp:=min(o,enterprice-n*0.5);
40 buyshort(1,lots,limitr,sellp);
41 times:=times+1;
42 end;//连续开仓
43 end;
44 end;//holding=0
45
46 if holding>0 and tbc then //已有多仓
47 begin
48 exitlongp:=max(enterprice-2*n,l2);
49 if l<exitlongp and enterbars<>0 then //出场
50 begin
51 exitp:=min(o,exitlongp);
52 sell(1,0,limitr,exitp);
53 times:=0;
54 end;//出场
55 else
56 begin
57 while h>enterprice+n*0.5 and times<4 do //开多
58 begin
59 buyp:=max(o,enterprice+n*0.5);
60 buy(1,lots,limitr,buyp);
61 times:=times+1;
62 end;//连续开仓
63 end;//else
64
65
66 end;//holding>0
67
68 if holding<0 and tbc then //已有空仓
69 begin
70 exitlongp:=min(enterprice+2*n,h2);
71 if h>exitlongp and enterbars<>0 then //出场
72 begin
73 exitp:=max(o,exitlongp);
74 sellshort(1,0,limitr,exitp);
75 times:=0;
76 end;//出场
77 else
78 begin
79 while l<enterprice-n*0.5 and times<4 do //开多
80 begin
81 sellp:=min(o,enterprice-n*0.5);
82 buyshort(1,lots,limitr,sellp);
83 times:=times+1;
84 end;//连续开仓
85 end;//else
86 end;//holding<0
87
88
89

版主评定:好评,获得5个金币奖励好评,获得5个金币奖励
(理由:好文章)
 回到顶部
帅哥哟,离线,有人找我吗?
solarhe2006
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


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

input:inb(20,1,500,1),outb(10,1,500,1),risk(2,0,10,0.1);
//和风版海龟源码
variable:times=0,i=0,n=0;
rn:=ema(ref(tr,1),20);
n:=valuewhen(holding=0,rn);
rh:=ref(h,1);
rl:=ref(l,1);
h1:hhv(rh,inb);
h2:hhv(rh,outb),linedot;
l1:llv(rl,inb);
l2:llv(rl,outb),linedot;
lotst:asset*risk*0.01/(n*2*multiplier),linethick0;
lots:=if(risk=0,1,lotst); //如果risk取0,表示固定开1手
tbc:=h<>l;//判断是否停板
partline(holding>0,enterprice-2*n);
if barpos<inb+1 then exit;
if holding=0 and tbc then //不是停板才可以交易
begin
if h>h1 then //开多
begin
buyp:=max(o,h1);
buy(1,lots,limitr,buyp);
times:=1;
while h>enterprice+n*0.5 and times<4 do
begin
buyp:=max(o,enterprice+n*0.5);
buy(1,lots,limitr,buyp);
times:=times+1;
end;//连续开仓
end;//开多结束
else if l<l1 then //开空
begin
sellp:=min(o,l1);
buyshort(1,lots,limitr,sellp);
times:=1;
while l<enterprice-n*0.5 and times<4 do
begin
sellp:=min(o,enterprice-n*0.5);
buyshort(1,lots,limitr,sellp);
times:=times+1;
end;//连续开仓
end;
end;//holding=0

if holding>0 and tbc then //已有多仓
begin
exitlongp:=max(enterprice-2*n,l2);
if l<exitlongp and enterbars<>0 then //出场
begin
exitp:=min(o,exitlongp);
sell(1,0,limitr,exitp);
times:=0;
end;//出场
else
begin
while h>enterprice+n*0.5 and times<4 do //开多
begin
buyp:=max(o,enterprice+n*0.5);
buy(1,lots,limitr,buyp);
times:=times+1;
end;//连续开仓
end;//else


end;//holding>0

if holding<0 and tbc then //已有空仓
begin
exitlongp:=min(enterprice+2*n,h2);
if h>exitlongp and enterbars<>0 then //出场
begin
exitp:=max(o,exitlongp);
sellshort(1,0,limitr,exitp);
times:=0;
end;//出场
else
begin
while l<enterprice-n*0.5 and times<4 do //开多
begin
sellp:=min(o,enterprice-n*0.5);
buyshort(1,lots,limitr,sellp);
times:=times+1;
end;//连续开仓
end;//else
end;//holding<0


 回到顶部
美女呀,离线,留言给我吧!
背影很杀
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:99 积分:535 威望:0 精华:0 注册:2011/5/12 7:07:38
  发帖心情 Post By:2011/6/12 18:59:02 [只看该作者]

请问楼主,能不能上个图!谢谢啦!

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


加好友 发短信
等级:论坛游民 帖子:121 积分:446 威望:0 精华:0 注册:2010/7/28 15:47:11
  发帖心情 Post By:2011/6/24 13:09:24 [只看该作者]

谢谢分享!

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


加好友 发短信
等级:新手上路 帖子:2 积分:2 威望:0 精华:0 注册:2011/7/10 19:01:07
  发帖心情 Post By:2011/8/6 18:17:16 [只看该作者]

谢谢分享


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


加好友 发短信
等级:论坛游侠 帖子:232 积分:644 威望:0 精华:0 注册:2011/1/26 11:39:34
  发帖心情 Post By:2011/8/21 20:48:27 [只看该作者]

谢谢分享,真棒

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


加好友 发短信
等级:新手上路 帖子:14 积分:36 威望:0 精华:0 注册:2011/10/6 17:54:24
  发帖心情 Post By:2011/10/6 18:06:42 [只看该作者]

谢谢分享!

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


加好友 发短信
等级:新手上路 帖子:9 积分:9 威望:0 精华:0 注册:2012/3/7 11:02:34
  发帖心情 Post By:2012/3/7 13:54:12 [只看该作者]

?在哪里呢啊 ?

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


加好友 发短信
等级:新手上路 帖子:7 积分:11 威望:0 精华:0 注册:2011/3/31 21:09:11
  发帖心情 Post By:2012/4/1 15:08:06 [只看该作者]

谢谢分享!

 回到顶部
总数 27 1 2 3 下一页