以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  一个关于止盈的问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=10571)

--  作者:kingmoonwang
--  发布时间:2012/3/14 22:59:11
--  一个关于止盈的问题

求一个止盈的写法。

最高盈利达1000点以后,如果出现某收盘价跌破20周期最低点,则以此收盘价止盈。自己写了如下,但应用于图不出现止盈。请高手帮忙看看。或者帮忙写个策略。多谢。

 

variable: hprice=0;

 

if holding=0 then begin
 if Longcond then begin
  buy(1,1,thisclose);
  hprice:=h;
 end

end

 

 

HLN:=ref(LLV(LOW,20),1);

 

if holding>0 and h>=hprice then begin
hprice:=h;
if hprice-enterprice>1000 then begin
if c<HLN then begin
 多止盈: sell(1,holding,thisclose);
 end
 end

[此贴子已经被作者于2012-3-14 23:05:53编辑过]

--  作者:rushtaotao
--  发布时间:2012/3/15 8:40:47
--  
稍后工作人员将会给出答复,请稍等
--  作者:just
--  发布时间:2012/3/15 9:09:07
--  

variable: hprice=0;
HLN:=ref(LLV(LOW,20),1);

longcond:=cross(ma(c,5),ma(c,10));

 if Longcond then begin
  buy(holding=0,1,thisclose);
  hprice:=h;
end


if holding>0 and h>=hprice then begin
hprice:=h;
end
if hprice-enterprice>50 then begin
if c<HLN then begin
 多止盈: sell(1,holding,thisclose);
end
end