以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]出场点不受加仓的影响  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=148068)

--  作者:宁静致远1
--  发布时间:2017/2/22 15:01:18
--  [求助]出场点不受加仓的影响
老师,我想让我的出场点不受加仓的影响,该怎么设置,不然加仓之后,出场点都变了。
if  DEA>0  and macd>0 and macd>ref(macd,1)   and (ref(c,1)-ref(c,2))/ref(c,2)<0 and isup and (c-ref(c,1))/ref(c,1)<0.005 and abb  then buy(holding=0,ss,marketr);
if  DEA>0 and (c-ref(c,1))/ref(c,1)<0   and macd>0   and abb  and holding=ss and openprofit>0 and enterbars>=3  then buy(holding=ss,m,marketr);
if  c<enterprice-15 and abb or macd<ref(macd,1) and abb   and holding>0 then sell(1,0,marketr);

--  作者:jinzhe
--  发布时间:2017/2/22 15:27:56
--  
nn:=barslast(cross(holding<>0,0.5));
if  (c<ref(enterprice,nn+1) and abb) or (macd<ref(macd,1) and abb)   and holding>0 then sell(1,0,marketr);

--  作者:宁静致远1
--  发布时间:2017/2/22 15:41:46
--  
看不太懂,麻烦老师直接帮我加到下面的平仓条件中吧,谢谢啦
多头平仓条件if  majj<ref(majj,1) and abb or c<enterprice-5 and abb  and holding>0 then sell(1,0,marketr);
空头平仓条件if  majj>ref(majj,1) and abb or c>enterprice+5 and abb  and holding<0  then sellshort(1,0,marketr);

--  作者:jinzhe
--  发布时间:2017/2/22 15:44:57
--  
nn:=barslast(cross(holding<>0,0.5));
 
if  ((majj<ref(majj,1) and abb) or (c<ref(enterprice,nn+1)-5 and abb )) and holding>0 then sell(1,0,marketr);
if  ((majj>ref(majj,1) and abb) or (c>ref(enterprice,nn+1)+5 and abb )) and holding<0  then sellshort(1,0,marketr);