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


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

   

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


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

主题:[求助]移动止盈问题

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


加好友 发短信
等级:新手上路 帖子:35 积分:31 威望:0 精华:0 注册:2011/11/30 14:35:54
  发帖心情 Post By:2014/4/17 9:40:30    Post IP:61.154.239.10[只看该作者]

整个程序总体是这样的顺序
VARIABLE: maxprofit=0;
{这部分是引用昨日数据}
HH:=hhv(昨高,n);
HC:=hhv(昨收,n);
LC:=LLV(昨收,n);
LL:=LLV(昨低,n);
we:=max(HH-LL,HC-LL)
s:开盘价+k1*we;
x:开盘价-k2*we
z:(s+x)/2;
//交易条件
a1:=c>上轨 and holding=0;
a2:=c<下轨 and holding=0;
//交易系统

开多:buy(a1=1 and (t1 or t2) and cyc>1,1,market);
开空:buyshort(a2=1 and (t1 or t2) and cyc>1,1,market);

win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
 win:=(c-enterprice)/enterprice*100; //记录最大盈利
 if win>maxprofit then begin
  maxprofit:=win; 
  u:maxprofit;
  end
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
 p:win2;
end
if holding < 0 and enterbars > 0 then
begin
 win:=(enterprice-c)/enterprice*100; //记录最大盈利
 if win> maxprofit then begin
  maxprofit:=win;
  i:maxprofit;
  end
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
 d:win2;
end
//出现最高盈利后,回落到盈利的60%平仓出场
止赢多:SELL(win2>=60 and openprofit > 0, 0);// and openprofit > 0
止盈空:sellshort(win2>60 and openprofit > 0,0);


 回到顶部