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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 帮帮忙呀,实在无法解决该问题!

   

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


  共有3439人关注过本帖平板打印复制链接

主题:帮帮忙呀,实在无法解决该问题!

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


加好友 发短信
等级:小飞侠 帖子:1966 积分:0 威望:0 精华:1 注册:2013/6/15 21:56:35
  发帖心情 Post By:2014/5/23 21:48:53    Post IP:118.181.105.109[只看该作者]

取以前15根1分钟K线的最高价和最低价为上轨下轨,
当时间大于9点30分时,
如果MA1大于MA2,且最高价突破上轨,开多
如果MA2大于MA1,且最低价跌破下轨,开空。

这个策略这样写

t1:=time>093000 and time<145000
rh:=ref(hhv(h,15),1);
rL:=ref(llv(L,15),1);

ma10:=ma(c,10);
ma20:=ma(c,20);

if t1 and h>rh and ma10>ma20 then
begin
sellshort(holding<0,0,limitr,rh-0.2);
buy(holding=0,1,limitr,rh-0.2);
end
if t1 and l<rL and ma10<ma20 then
begin
sell(holding>0,0,limitr,rL+0.2);
buyshort(holding=0,1,limitr,rL+0.2);
end
if time>145000 then
begin
sell(holding>0,0,limitr,c);
sellshort(holding<0,0,limitr,c);
end
------------------------------------------
以上是你要的程序,但是你这是一种自欺欺人的做法,你的交易结果是不可能达到这个程序的测试结果的,也就是说如果怎么干你的实盘结果和你的测试结果就没有任何关系。
那么按你的意思也应该写成这样
t1:=time>093000 and time<145000
rh:=ref(hhv(h,15),1);
rL:=ref(llv(L,15),1);

ma10:=ma(c,10);
ma20:=ma(c,20);

if t1 and h>=rh and ma10>ma20 then
begin
sellshort(holding<0,0,limitr,rh+0.4);
buy(holding=0,1,limitr,rh+0.4);
end
if t1 and l<=rL and ma10<ma20 then
begin
sell(holding>0,0,limitr,rL-0.4);
buyshort(holding=0,1,limitr,rL-0.4);
end
if time>145000 then
begin
sell(holding>0,0,limitr,c-0.2);
sellshort(holding<0,0,limitr,c+0.2);
end
----------------------------------------------------------------
这样写也有问题,可能会出现没有成交价格的问题所以按你的策略意思应该这样写;
t1:=time>093000 and time<145000
rh:=ref(hhv(h,15),1);
rL:=ref(llv(L,15),1);

ma10:=ma(c,10);
ma20:=ma(c,20);

if t1 and h>=rh and ma10>ma20 then
begin
sellshort(holding<0,0,limitr,max(rh,o)+0.4);
buy(holding=0,1,limitr,max(rh,o)+0.4);
end
if t1 and l<=rL and ma10<ma20 then
begin
sell(holding>0,0,limitr,min(rL,o)-0.4);
buyshort(holding=0,1,limitr,min(rL,o)-0.4);
end
if time>145000 then
begin
sell(holding>0,0,limitr,c-0.2);
sellshort(holding<0,0,limitr,c+0.2);
end
-------------------------------------------------------
这样的写法其实还是有问题的,会到致你的测试信号和实盘信号有差别(由于这个程序程序的特例差别不是太大)。也就是说你这个小小的程序还含有未来数据。这个你自己琢磨吧。

版主评定:好评,获得10个金币奖励好评,获得10个金币奖励
(理由:奖励谢谢对小白用户的耐心指教)
 回到顶部
总数 15 1 2 下一页