以文本方式查看主题

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

--  作者:grand_buzhi
--  发布时间:2011/7/28 22:08:27
--  新手请教版主

初学金字塔,很多问题没有解决,请教如下:

想实现一个想法,第一根K线是阳线时第二根K线开盘开多,第一根K线是阴线时,第二根K线开盘开空,临近收盘平仓。但是应用在股指期货1分钟K线上发现开盘开仓可以实现,但是收盘时平仓似乎不能实现。经常发现同时持有多空仓的情况。怎么也找不到原因,究竟哪里出错呢?麻烦版主或其他高手给看看,谢啦!

 

runmode:0;

 

if holding=0 then do begin
if time=0916 and open<close then buy(1,1,limit,open-mindiff);
if time=0916 and open>close then buyshort(1,1,limit,open+mindiff);
end;

 

if holding>0 and time=1500 then sell(1,1,limit,open+mindiff);
if holding<0 and time=1500 then sellshort(1,1,limit,open+mindiff);


--  作者:just
--  发布时间:2011/7/29 9:25:22
--  

问题正在查找中 稍后回复


--  作者:jinzhe
--  发布时间:2011/7/29 9:49:21
--  


runmode:0;

 //股指1分钟周期
r1:=ref(open,1)<ref(close,1);
r2:=ref(open,1)>ref(close,1);
h1:holding,linethick0;
if holding=0  and time=091700 then  begin
  buy(r1,1,thisclose);
  buyshort(r2,1,thisclose);
end;

if holding>0 and time>=151400 then sell(1,0,thisclose);
if holding<0 and time>=151400 then sellshort(1,0,thisclose);

[此贴子已经被作者于2011-7-29 10:05:49编辑过]

--  作者:just
--  发布时间:2011/7/29 10:08:00
--  

runmode:0;
if time=091600 and c>o  then begin
buy(1,1,limit,close+mindiff);
end
if time=091600 and c<o  then begin
buyshort(1,1,limit,close-mindiff);
end

if time=150000  then begin
sell(holding>0,0,limit,close-mindiff) ;
sellshort(holding<0,0,limit,close+mindiff);
end

 

 

价格问题,还有你这个必须使用K线走完模式


[此贴子已经被作者于2011-7-29 10:27:06编辑过]

--  作者:grand_buzhi
--  发布时间:2011/7/29 11:39:48
--  

金哲给的代码已经实现了这个想法了,感谢这么快回复!