以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- [求助] (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=139837) |
-- 作者:zxlwrz123 -- 发布时间:2016/9/21 10:35:43 -- [求助] 设定 x 的止盈线,设定x1 的止损线, 过滤条件为波幅 30 点。 这样写对吗,总是符号搞错 if c>enterprice*(1+x) and holding>0 then sell(1,0,marketr);//多头止盈 if c<enterprice*(1-x1) and holding>0 then sellshort(1,0,marketr);//止损多头 if c<enterprice*(1+x) and holding<0 then sellshort(1,0,marketr);///空头止盈 if c>enterprice*(1-x1) and holding<0 then sell(1,0,marketr);//止损空头 |
-- 作者:pyd -- 发布时间:2016/9/21 10:39:12 -- 多头是虚拟持仓holding是正的,空头是负的,大于号小于号写错了。 平多前holding>0,平空前holding<0。 if c>enterprice*(1+x) and holding>0 then sell(1,0,marketr);//多头止盈
if c<enterprice*(1-x1) and holding<0 then sellshort(1,0,marketr);//止损多头
if c<enterprice*(1+x) and holding<0 then sellshort(1,0,marketr);///空头止盈
if c>enterprice*(1-x1) and holding>0 then sell(1,0,marketr);//止损空头
[此贴子已经被作者于2016-9-21 10:40:09编辑过]
|
-- 作者:zxlwrz123 -- 发布时间:2016/9/21 10:47:54 -- ![]() if c>enterprice*(1+x) and holding>0 then sell(1,0,marketr);//多头止盈 if c<enterprice*(1-x1) and holding<0 then sell(1,0,marketr);//止损多头 if c<enterprice*(1+x) and holding<0 then sellshort(1,0,marketr);///空头止盈 if c>enterprice*(1-x1) and holding>0 then sellshort(1,0,marketr);//止损空头 能不能在进行止盈或者止损以后再不进行开仓操作,直到进行平仓 if time>=150000 then begin 收盘平多:sell(1,手数,market); 收盘平空:sellshort(1,手数,market); end |
-- 作者:wenarm -- 发布时间:2016/9/21 10:58:27 -- 你修改自己定义的开仓条件。 |
-- 作者:jinzhe -- 发布时间:2016/9/21 11:14:31 -- 你另外发的帖子里面已经有回答了 |