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


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

   

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


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

主题:关于止盈止损

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


加好友 发短信
等级:黑侠 帖子:791 积分:856 威望:0 精华:0 注册:2011/11/16 23:34:34
关于止盈止损  发帖心情 Post By:2012/11/23 12:24:15    Post IP:221.179.30.111[只看该作者]

我使用后台多策略,所以单独将止盈止损做了一个策略如下:

variable:maxprofit=0;

debugout('最新开仓价tenterprice=%2.f',tenterprice);


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

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

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

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

 

其中止盈和止损两个参数放在参数表中,但实际运行时好象都完全不起作用,不知为何


 回到顶部
总数 18 1 2 下一页