以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  K线走完模式,止损单没有触发  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=10467)

--  作者:clivelong
--  发布时间:2012/3/8 10:30:37
--  K线走完模式,止损单没有触发
帮忙看看这个  K线走完模式,但我想盘中及时的触发止损,但止损但单没有盘中触发,而是等待K线走完了才下单,看看怎么改才能及时触发止损
 
stoploss:=15;

ma1:ma(c,5);
ma2:ma(c,10);

longcond:=cross(ma1,ma2) ;
shortcond:=cross(ma2,ma1);

 sell(holding>0 and L<enterprice-stopLoss,0,limitr,enterprice-stopLoss),orderqueue;

 sellshort(holding<0 and h>enterprice+stopLoss,0,limitr,enterprice+stopLoss),orderqueue;

if shortcond then begin
  sell(1,1,thisclose);
  buyshort(1,1,thisclose);
end

if longcond then begin
  sellshort(1,1,thisclose);
  buy(1,1, thisclose);
end

hold:holding,noaxis ,linethick0 ;

 
[此贴子已经被作者于2012-3-8 10:31:36编辑过]

--  作者:阿火
--  发布时间:2012/3/8 10:37:47
--  
方法见 交易策略发布区 阿火秘笈