Rss & SiteMap

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

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

标题:提前2秒平仓

1楼
惊弓之鸟 发表于:2015/6/4 8:28:01
模型是K线走完模式,我想加入提前2秒下单,用固定轮询来实现;

 

请老师把这个条件input:TQ(2,1,60,1);
                   ABB:=(time0-timetot0(dynainfo(207))<=2) or not(islastbar);,帮我写入模型里;

 

 

 if enterbars>0 and h>hh then hh:=h;
if T4 and ref(h>ref(hhv(h,todaybar),1),1) and close<ref(C,1) then begin sell(holding>0, 1, marketr);
hh:=0;
end
 
if enterbars>0 and l<ll then ll:=l;
if T4 and ref(l<ref(llv(l,todaybar),1),1) and close>ref(C,1) then begin sellshort(holding<0, 1, marketr);
ll:=0;
end

2楼
pyd 发表于:2015/6/4 8:32:14

ABB:=(time0-timetot0(dynainfo(207))<=2) or not(islastbar);

if enterbars>0 and h>hh then hh:=h;
if T4 and ref(h>ref(hhv(h,todaybar),1),1) and   close<ref(C,1) and abb then begin sell(holding>0, 1, marketr);
hh:=0;
end
 
if enterbars>0 and l<ll then ll:=l;
if T4 and ref(l<ref(llv(l,todaybar),1),1) and close>ref(C,1) and abb then begin sellshort(holding<0, 1, marketr);
ll:=0;
end

[此贴子已经被作者于2015/6/4 8:32:41编辑过]
3楼
惊弓之鸟 发表于:2015/6/4 9:09:51

好的 谢谢!

 

下面这个指令本来是盘中触发就执行的,我想把它改为K线走完前2秒平仓 ,这样加入ABB可以吗?

 

if ABB AND  H>=AVGenterprice+98  and holding>0 then begin sell(1,1,limitr,close);
a:=1;
end

if ABB AND  L<=AVGenterprice-98 and holding<0 then begin sellshort(1,1,limitr,close);
b:=1;
end

4楼
pyd 发表于:2015/6/4 9:30:42
可以,加到开平仓条件里就可以
[此贴子已经被作者于2015/6/4 9:30:50编辑过]
5楼
惊弓之鸟 发表于:2015/6/4 10:06:50
好的 谢谢!
6楼
惊弓之鸟 发表于:2015/6/4 10:32:29

这个这样加可以吗? 是加在OR 的后面;

if h>hh  and enterbars=0  then hh:=h;
if  h/C>1.0050 and ref(C/O,1)>=1.0046  and (L<ref(L,1) or C<ref(O,1)) and abb then begin sell(holding>0, 1, marketr);
end
 
if l<ll   and enterbars=0 then ll:=l;
if close/low>1.0050 and ref(O/C,1)>=1.0046  and (H>ref(H,1) or C>ref(O,1)) and abb then begin sellshort(holding<0, 1, marketr);
end

7楼
pyd 发表于:2015/6/4 11:01:50

是or前作为一种平仓条件,or后是第二种平仓条件?是不是加在or后面要看你想怎么表达了

8楼
惊弓之鸟 发表于:2015/6/4 11:08:59

我就是想让这个指令在K线走完前2秒钟才平仓;

如果不加ABB,盘中就会触发平仓的;

 

我是这个意思;

 

哦 还有一点 ,我刚发现 ,or 是被大括弧包起来的;

9楼
pyd 发表于:2015/6/4 11:15:25

只是在原来基础上加个时间控制的话可以用括号把前边条件整个括起来

if h>hh and enterbars=0 then hh:=h;
if (h/C>1.0050 and ref(C/O,1)>=1.0046 and (L<ref(L,1) or C<ref(O,1))) and abb then begin sell(holding>0, 1, marketr);
end

if l<ll and enterbars=0 then ll:=l;
if (close/low>1.0050 and ref(O/C,1)>=1.0046 and (H>ref(H,1) or C>ref(O,1))) and abb then begin sellshort(holding<0, 1, marketr);
end


10楼
wenarm 发表于:2015/6/4 11:20:24
你说的运算符是优先级的问题,and的优先级高于or的优先级。在运算中,如果两个运算符都出现且你的条件是需要先执行or后执行and就需要加括号提高or的优先级。
共15 条记录, 每页显示 10 条, 页签: [1] [2]


Powered By Dvbbs Version 8.3.0
Processed in 0.02344 s, 2 queries.