以文本方式查看主题

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

--  作者:宁静致远1
--  发布时间:2017/3/3 12:45:02
--  [求助]提前平仓

麻烦一下老师,我想设置在9:00-9:30和21:00-21:30这两个交易时间段提前250秒平仓,该怎么表达?

If c<enterprice-5     and holding>0 then sell(1,0,marketr);

If c>enterprice+5      and holding<0  then sellshort(1,0,marketr);


--  作者:jinzhe
--  发布时间:2017/3/3 13:19:16
--  
当前周期是多少?
--  作者:宁静致远1
--  发布时间:2017/3/3 13:29:32
--  
5分钟周期的
--  作者:jinzhe
--  发布时间:2017/3/3 13:36:26
--  

tq:=Not(islastbar) or (timetot0(dynainfo(207))>=time0-250);

If c<enterprice-5     and holding>0 and tq and ((time>090000 and time<=093000)  or (time>210000 and time<=213000)) then sell(1,0,marketr);

If c>enterprice+5      and holding<0  and tq and ((time>090000 and time<=093000)  or (time>210000 and time<=213000)) then sellshort(1,0,marketr);


--  作者:宁静致远1
--  发布时间:2017/3/3 14:10:40
--  
测试了一下,发现当根K线开仓之后马上平仓了,不知道为什么
--  作者:jinzhe
--  发布时间:2017/3/3 14:17:57
--  
说明满足你讲的了
--  作者:宁静致远1
--  发布时间:2017/3/3 15:00:52
--  
当根K线开仓之后马上平仓,连第二根K线都没走下去
--  作者:jinzhe
--  发布时间:2017/3/3 15:12:27
--  

说明满足你的条件了


--  作者:宁静致远1
--  发布时间:2017/3/3 15:16:37
--  
该成金字塔时间就可以使用,老师能不能把它该成北京时间也可以用的代码
--  作者:jinzhe
--  发布时间:2017/3/3 15:19:33
--  
这段就是北京时间的代码,金字塔时间你按F10,对照着改