设定 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);//止损空头
多头是虚拟持仓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编辑过]
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