以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  止损问题请教阿火,admin及各位高手  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=10570)

--  作者:cxyr99
--  发布时间:2012/3/14 22:56:34
--  止损问题请教阿火,admin及各位高手

 下列代码   我想用两个条件得出不同的退出价exitprice   但是都使用同一变量名在随后的sell语句中退出 。测试时第一部分可以止损,

但第二部分使用均线止损满足条件没有平仓信号显示无法平仓    我查看说明好像是跟序列运行模式有关  导致用close赋给变量无效

 应该怎么解决。

 

 

 exitprice{变量初始化}

 

  if  条件1    then

        {  exitprice:= stoplossprice  } 

 

  if  条件2    then

 

       { if  cross(ma(close,60),close) then


           exitprice: = close;  }

      

   

sell(1,exitprice)


--  作者:cxyr99
--  发布时间:2012/3/14 23:10:25
--  

管理员,不好意思,这个问题不小心发到策略发布区去了,阿火在的话请帮忙

继续问题:

想搞清楚 第2部分用均线平仓是没信号的,我觉得是满足条件时得不到exitprice,和说明书里序列运行模式有关,但不知道怎么改写才对

 

 if  cond1    then   begin

 

               ·········语句··········

 

              exitprice:= stoplossprice ;

 end 

        

  if  cond2    then  begin

       

              if  cross(ma(close,60),close) then


              exitprice:= close ;

 end 

 

      

   

sell(1,exitprice)

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

--  作者:阿火
--  发布时间:2012/3/15 7:00:26
--  

cond3:=cross(ma(close,60),close);

 if  cond2    then  begin

       

              if  cond3  then


              exitprice:= close ;

 end