Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共7 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:为什么会开平同时下单,老师看下

1楼
splisun 发表于:2016/7/11 9:28:14
多头止盈:=h>ref(close,enterbars)*1.005 and enterbars>1;
多头止损:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止盈:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止损:=h>ref(close,enterbars)*1.005 and enterbars>1;
//********************交易系统*****提前n秒下单*******************************
input:tq(5,3,60,1);//定义变量
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
  if holding=0 and 开多 then buy(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding=0 and 开空 then buyshort(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding>0 and 多头止损 then sell(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding<0 and 空头止损 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;
end

//***************************提前n秒下单**********************************
if abb then begin
  if holding>0 and 多头止盈 then sell(1,1,thisclose),ignorecheckprice,orderqueue;//多头平仓
  if holding<0 and 空头止盈 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;//空头平仓
end



图片点击可在新窗口打开查看此主题相关图片如下:2016-07-11_092649.png
图片点击可在新窗口打开查看

2楼
jinzhe 发表于:2016/7/11 9:35:39
因为k线图上同时出了开和平的信号,说明此时开平条件是同时满足的
3楼
splisun 发表于:2016/7/11 9:44:39
止损、止盈要开仓后波动0.5%并且要走一根K线以后,怎么可能同时开平呢
4楼
jinzhe 发表于:2016/7/11 9:47:30

因为代码里面的enterbars判断是写在开仓之前的,所以止损判断里面就变成了判断上一次开仓的周期而不是现在开仓的周期

 

直接把开仓周期判断,写在平仓语句里面,不要提前写

5楼
splisun 发表于:2016/7/11 9:55:50
在改成这样才行吗?
多头止盈:=h>ref(close,enterbars)*1.005;
多头止损:=l<ref(close,enterbars)*0.995;
空头止盈:=l<ref(close,enterbars)*0.995;
空头止损:=h>ref(close,enterbars)*1.005;
6楼
jinzhe 发表于:2016/7/11 10:03:24
多头止盈:=h>ref(close,enterbars)*1.005 and enterbars>1;
多头止损:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止盈:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止损:=h>ref(close,enterbars)*1.005 and enterbars>1;
//********************交易系统*****提前n秒下单*******************************
input:tq(5,3,60,1);//定义变量
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
  if holding=0 and 开多 then buy(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding=0 and 开空 then buyshort(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding>0 and 多头止损 and enterbars>1 then sell(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding<0 and 空头止损 and enterbars>1 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;
end

//***************************提前n秒下单**********************************
if abb then begin
  if holding>0 and 多头止盈 and enterbars>1 then sell(1,1,thisclose),ignorecheckprice,orderqueue;//多头平仓
  if holding<0 and 空头止盈 and enterbars>1 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;//空头平仓
end
7楼
splisun 发表于:2016/7/11 10:06:35
多谢,测试
共7 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.08594 s, 3 queries.