以文本方式查看主题

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

--  作者:fxrock4
--  发布时间:2016/8/18 10:58:10
--  收盘前
A条件开仓的单至交易所收盘前5分钟平仓(包括日盘和夜盘)。怎么写,多谢。
--  作者:jinzhe
--  发布时间:2016/8/18 11:02:30
--  

 t1:=time>opentime(1) and time0<=timetot0(closetime(1))-5*60;

t2:=time>opentime(2) and time0<= timetot0(closetime(0))-5*60;

开仓条件加入  (t1 or t2)


--  作者:fxrock4
--  发布时间:2016/8/18 11:30:49
--  
//开仓
t1:=time>opentime(1) and time0<=timetot0(closetime(1))-5*60;
t2:=time>opentime(2) and time0<= timetot0(closetime(0))-5*60;

if 跳升 and (t1 or t2)  and  holding=0  then begin
   buy(holding=0,50%,market),pertrader;
   

end

===========开仓后就平仓了。哪不对呢?

[此贴子已经被作者于2016-8-18 11:31:24编辑过]

--  作者:jinzhe
--  发布时间:2016/8/18 11:31:51
--  

开仓后立即平仓说明你的平仓条件是很容易满足的

[此贴子已经被作者于2016-8-18 11:32:22编辑过]

--  作者:fxrock4
--  发布时间:2016/8/18 12:23:56
--  
平仓条件就是收盘前5分钟。按你上面的没到收盘前5分钟就平仓。
[此贴子已经被作者于2016-8-18 12:24:35编辑过]

--  作者:jinzhe
--  发布时间:2016/8/18 13:13:37
--  

if (time0=timetot0(closetime(1))-5*60) or (time0=timetot0(closetime(0))-5*60) then begin

    sell(1,0,market);

    sellshort(1,0,market);

end