以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]下面语句该如何编写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=80774)

--  作者:zhuangjyuan
--  发布时间:2015/7/11 22:48:27
--  [求助]下面语句该如何编写

盈利20点以内,则以最新价触碰开仓价,以开仓价止损

 盈利20-50个点,则以最新价触碰MA20均线,以MA20价格止损

盈利50个点以上,则以最新价触碰MA10均线,以MA10价格止损

请问语句该如何编写比较好



--  作者:jinzhe
--  发布时间:2015/7/13 8:54:05
--  

 以多头为例:

 

if hhv(h,enterbars+1)<=enterprice+20*mindiff and close<=enterprice then sell(1,0,limitr,enterprice);

if hhv(h,enterbars+1)>enterprice+20*mindiff and hhv(h,enterbars+1)<=enterprice+50*mindiff  and close<=ma20 then sell(1,0,limitr,ma20);

if hhv(h,enterbars+1)>enterpricer+50*mindif and close<=ma10 then sell(1,0,limitr,ma10);