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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → [求助]

   

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


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

主题:[求助]

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


加好友 发短信
等级:新手上路 帖子:96 积分:489 威望:0 精华:0 注册:2011/9/5 19:34:19
[求助]  发帖心情 Post By:2011/9/7 14:51:26    Post IP:58.247.1.214[只看该作者]

如下代码在K线图中无交易信号显示,策略测试也没有交易记录,请金字塔的老师们帮找原因

DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD1:=2*(DIFF-DEA);
LC := REF(CLOSE,1);
m1:=SMA(MAX(CLOSE-LC,0),3,1)/SMA(ABS(CLOSE-LC),3,1)*100;
m2:=-100*(HHV(HIGH,42)-CLOSE)/(HHV(HIGH,42)-LLV(LOW,42))+100;

 

enlong:=count(cross(m1,10),5)>1 and count(cross(m2,10),2)>1 and cross(diff,ref(diff,1))
  or count(cross(m1,10),2)>1 and count(cross(m2,10),5)>1 and cross(diff,ref(diff,1));//开多条件

enshort:=count(cross(90,m1),5)>1 and count(cross(90,m2),2)>1 and cross(ref(diff,1),diff)
  or count(cross(90,m1),2)>1 and count(cross(90,m2),5)>1 and cross(ref(diff,1),diff);//开空条件
exlong1:=cross(90,m1) or cross(90,m2) or cross((enterprice-c),3);//平多条件1
exshort1:=cross(m2,10) or cross(m2,10) or cross((c-enterprice),3);//平空条件1
exlong2:=barslast(enlong)>10 and (c-enterprice)<0;//平多条件2(以限价单来平仓)
exshort2:=barslast(enshort)>10 and (c-enterprice)>0;//平多条件2(以限价单来平仓)
if enlong then
  begin
  buy(holding=0,1,market);
  end
if exshort1 then
  begin
  sell(holding=1,0,market);
  end
if enshort then
  begin
  buyshort(holding=0,1,market);
  end
if exshort1 then
  begin
  sellshort(holding=-1,1,market);
  end
if exlong2 then
  begin
  sell(holding=1,0,limit,enterprice+2*mindiff);
  end
if exshort2 then
  begin
  sellshort(holding=-1,0,limit,enterprice-2*mindiff);
  end


 回到顶部