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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → 求助阿火版主帮写个日内系统

   

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


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

主题:求助阿火版主帮写个日内系统

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 9:55:54 [显示全部帖子]

不知道对否 ,可参考一下我写的


if not(time>=093500) then exit;

exittime:=time>=025800;

n:=barslast(date<>ref(date,1));

dayhigh:=ref(hhv(h,n),1);

daylow:=ref(llv(l,n),1);

h30:=ref(hhv(h,30),1);

l30:=ref(llv(l,30),1);

 

if time>093500 and h>=h30 then buy(holding=0,1,market);

if time>093500 and l<=l30 then buyshort(holding=0,1,market);

if holding>0 then begin

   if enterprice>dayhigh and close<=l30 or enterprice<daylow   then sell(1,holding,market);

   if enterprice<daylow  then buyshort(1,1,market);

end;

 

if holding<0 then begin

   if enterprice<daylow and close>=h30 or enterprice>dayhigh   then sellshort(1,holding,market);

   if enterprice<dayhigh  then buy(1,1,market);

end

 

if time>=145800 and time<=150000 then begin

 sellshort(holding<0,0,close);
 sell(holding>0,0,close);
 
end

 

[此贴子已经被作者于2011-11-7 10:05:32编辑过]

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 10:01:44 [显示全部帖子]

不知哪里有问题,还是很多白色错误信号

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 10:29:13 [显示全部帖子]

jinzhe 哥,您帮我修改的我实在是找不出问题,但是就是不能用, 请您再看下 http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=8786
[此贴子已经被作者于2011-11-7 10:29:44编辑过]

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 16:58:27 [显示全部帖子]

if holding>0 and h>=abs(hl) then begin//因为用了hl的正负号来记录信息,所以需用abs(hl)
 hl:=h;//记录抬升的最高价
 if hl>hi then hl:=-hl;//如果触碰日内最高点,则把hl赋值为负值
end
if holding<0 and l<=abs(hl) then begin
 hl:=l;
 if hl<lo then hl:=-hl;
end

 

 

这两句话不是太理解, 为什么要变成-hl, 则把hl赋值为负值
麻烦讲一下。

[此贴子已经被作者于2011-11-7 16:59:51编辑过]

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 17:16:03 [显示全部帖子]

我感觉把这两句放在上面会不会更好点?

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/7 17:28:52 [显示全部帖子]

我这么搞是否更加方便理解, 没有破坏原有的逻辑?

无持仓开仓:

if holding=0 and entertime and h>hi30 then begin
 buy(1,1,market);
 hl:=h;//记录开仓后的最高价
end

if holding=0 and entertime and l<lo30 then begin
 buyshort(1,1,market);
 hl:=l;
end

持仓后记录是否最高价:

if holding>0 and h>=abs(hl) then begin//因为用了hl的正负号来记录信息,所以需用abs(hl)
 hl:=h;//记录抬升的最高价
 if hl>hi then hl:=-hl;//如果触碰日内最高点,则把hl赋值为负值
end
if holding<0 and l<=abs(hl) then begin
 hl:=l;
 if hl<lo then hl:=-hl;
end
平仓反手指令:
if holding>0 and (l<lo or (l<lo30 and hl<0)) then begin//hl<0代表的开仓后的最高价达到日内最高点
 sell(1,1,market);
 buyshort(entertime,1,market);
 hl:=l;
 goto skip@; //这里要跳转一下,防止当根K线开空立即被下面的平仓语句平了
end

if holding<0 and (h>hi or (h>hi30 and hl<0)) then begin
 sellshort(1,1,market);
 buy(entertime,1,market);
 hl:=h;
end

skip@;


 回到顶部