以文本方式查看主题

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

--  作者:舍得~~
--  发布时间:2018/12/10 11:06:53
--  关于止损问题
开仓盈利10个点后,自动设置止损在开仓价位置;图表自动交易怎么写?
--  作者:FireScript
--  发布时间:2018/12/10 11:29:42
--  
以多头为例,空头可以仿照这个写下。
zy:holding>0 and (hhv(h,ENTERBARS+2)-ENTERPRICE)>10*MINDIFF and c<=ENTERPRICE;

if  zy then sell(holding>0,holding,market);
--  作者:舍得~~
--  发布时间:2018/12/10 12:58:09
--  

老师,上面以空头为例也帮我写一下,谢谢


--  作者:FireScript
--  发布时间:2018/12/10 13:45:54
--  
 zy2:holding<0 and (ENTERPRICE-llv(l,ENTERBARS+2))>10*MINDIFF and c>=ENTERPRICE;

if  zy2 then sellshort(holding<0,holding,market);
--  作者:舍得~~
--  发布时间:2018/12/27 9:07:18
--  

zy:holding>0 and (hhv(h,ENTERBARS+2)-ENTERPRICE)>10*MINDIFF and c<=ENTERPRICE;
if  zy then sell(holding>0,holding,market);
zy2:holding<0 and (ENTERPRICE-llv(l,ENTERBARS+2))>10*MINDIFF and c>=ENTERPRICE;
if  zy2 then sellshort(holding<0,holding,market); 
老师:在上面语句中加入,开仓盈利50个点后止损移动到开仓价+5个点,多仓,空仓头都写一下,谢谢
--  作者:FireScript
--  发布时间:2018/12/27 9:15:52
--  
 修改下数值就可以了。

zy3:holding>0 and (hhv(h,ENTERBARS+2)-ENTERPRICE)>50*MINDIFF and c<=ENTERPRICE+5*MINDIFF;
if  zy3 then sell(holding>0,holding,market);
zy4:holding<0 and (ENTERPRICE-llv(l,ENTERBARS+2))>50*MINDIFF and c>=ENTERPRICE-5*MINDIFF;
if  zy4 then sellshort(holding<0,holding,market);