以文本方式查看主题

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

--  作者:dalunihao
--  发布时间:2013/10/24 14:01:03
--  求止盈的编写
你好,老师,麻烦您用if then帮我编写个代码:
如图A多头,如果开多之后,(最高价)A减去开仓价,大于5个点且小于40个点,则当C减去开仓价小于等于5 止盈平仓。如果A减去开仓价,大于40个点,则当C减去开仓价小于等于30时, 止盈平仓。(空单也是如此)
图片点击可在新窗口打开查看此主题相关图片如下:001.jpg
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2013/10/24 14:14:28
--  

hh:=hhv(h,enterbars+1);

if hh>enterprice+5*mindiff and hh<enterprice+40*mindiff and c-enterprice<5*mindiff then sell(1,0,market);

if hh>enterprice+40*mindiff and c>enterprice+30*mindiff then sell(1,0,market);

 

空单的思路说一下

 

 

 


--  作者:dalunihao
--  发布时间:2013/10/24 14:19:57
--  
先谢谢老师。空头的思路是:
如图做空,如果开空之后,开仓价减去(最低点)A,大于5个点且小于40个点,则当开仓价减去close小于等于5
图片点击可在新窗口打开查看此主题相关图片如下:88888.jpg
图片点击可在新窗口打开查看
止盈平仓。如果开仓价减去A点,大于40个点,则当开仓价减去Close小于等于30时, 止盈平仓。

--  作者:jinzhe
--  发布时间:2013/10/24 14:46:44
--  

ll:=llv(l,enterbars+1);

 

if enterprice-ll>5*mindiff and enterprice-ll<40*mindiff and enterprice-clsoe<=5*mindiff then sellshort(1,0,thisclose);

 

if enterprice-ll>40*mindif and enterprice-close<=30*minff then sellshort(1,0,thisclose);


--  作者:lxihua5201
--  发布时间:2013/10/24 14:53:59
--  
variable:n=o;
if l>n then begin
N:l;
end

if enterprice-n>5*mindiff and n-enterprice<40*mindiff and enterprice-c<5*mindiff then sell(1,0,market);

if enterprice-n>40*mindiff and enterprice-c<=30*mindiff then sell(1,0,market);