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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 止损止盈问题。

   

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


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

主题:止损止盈问题。

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


加好友 发短信
等级:黑侠 帖子:649 积分:0 威望:0 精华:0 注册:2014/6/3 6:48:31
止损止盈问题。  发帖心情 Post By:2015/1/14 15:36:33    Post IP:175.10.96.159[显示全部帖子]

一下代码是坛子里的止损止盈的例子, 可以在 手工开单,程序化只负责止损止盈不?比如监控仓位,然后根据

自己的条件进行止损,

 

 

 

//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;

if holding > 0 and enterbars > 0 then
begin
 win:=(c-enterprice)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win; 
  
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end

if holding < 0 and enterbars > 0 then
begin
 win:=(enterprice-c)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
  
 win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end

//出现浮动亏损比如2%平仓
止损:SELL(win < -2,0);
 
//出现最高盈利后,回落到盈利的60%平仓出场
止赢:SELL(win2 >= 60 and openprofit > 0, 0);


 回到顶部