以文本方式查看主题

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

--  作者:flushentity
--  发布时间:2015/6/4 13:24:18
--  开盘分钟数
请教一段代码

当最新价高于当日开盘~开盘后10分钟内的最高价,开多,收盘前五分钟平仓。
当最新价低于当日开后~开盘后10分钟内的最低价,开空,收盘前五分钟平仓。

金字塔时间,用在1分钟周期的K线上。

--  作者:flushentity
--  发布时间:2015/6/4 13:27:42
--  
忘记了还有止损,做多,以当日最低价止损。做空,以当日最高价止损。
--  作者:jinzhe
--  发布时间:2015/6/4 13:34:13
--  
处理中,请稍等
--  作者:pyd
--  发布时间:2015/6/4 13:48:35
--  

止损条件不合理吧,收盘前怎么知道当天已经最低最高价。

止损条件重新描述下(一般是多少个点止损)

 

[此贴子已经被作者于2015/6/4 13:49:04编辑过]

--  作者:flushentity
--  发布时间:2015/6/4 13:54:00
--  
做多,以开仓前的最低价止损。做空,以开仓前的最高价止损。
--  作者:pyd
--  发布时间:2015/6/4 15:02:50
--  

hh:VALUEWHEN(todaybar=10,hhv(h,10));
ll:VALUEWHEN(todaybar=10,llv(l,10));
gg:hhv(h,todaybar);//当天最高价
dd:llv(l,todaybar);//当天最低价
if c>hh then buy(holding=0,1,market);
if c<ll then buyshort(holding=0,1,market);

//多损
la:ref(llv(l,todaybar-enterbars),enterbars);//开仓前最低价
if l<=la then sell(holding>0,holding,market);
//空损
ha:ref(hhv(h,todaybar-enterbars),enterbars);//开仓前最高价
if h>ha then sellshort(holding<0,holding,market);

//收盘前5分钟平仓
m5:=(t0totime(timetot0(closetime(0))-60*5));
if time>=m5 then begin
Sell( holding>0,1,market);
sellshort(holding<0,1,market);
end