以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]这个移动止盈怎么修改?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=51861)

--  作者:rfgvb
--  发布时间:2013/5/10 10:49:32
--  [求助]这个移动止盈怎么修改?

老师  看看

if holding=0 then begin
  BUY(开多条件,手数,THISCLOSE);
  dd:=0;
end
//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;

if holding > 0 and enterbars > 0 then
begin
 win:=c-enterprice; //记录最大盈利
 if win > dd then
  dd:=win;

win2:=dd-win; //最大盈利后的回调幅度
end

d止赢:SELL(win2 >=10 and openprofit > 0,0,THISCLOSE);


if holding=0 then  begin
  BUYSHORT(开空条件,手数,THISCLOSE);
  kd:=0;
end

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

k止赢:SELLshort(win2 >=10 and openprofit > 0,0,THISCLOSE);

 

写出来的效果是回撤10点平仓

 

怎么修改成 盈利10点 回撤到盈利3点平仓

               盈利15点  回撤到盈利6点平仓

               盈利25点  回撤到盈利12点平仓              

注意是回撤到盈利的点数

 

 

 


--  作者:jinzhe
--  发布时间:2013/5/10 10:58:37
--  

写第一个,后面的照着写

 

variable:win=0;

if 开仓条件 and holding=0 then begin

buy;

win:=c-enterprice;

end

 

if c-enterprice>win then win:=c-enterprice;

 

if win>=10*mindiff and c-enterprice<=3*mindiff then sell;


--  作者:rfgvb
--  发布时间:2013/5/10 11:04:31
--  
谢谢 老师  这个移动止盈折磨我好久了   各个关系搞混了