以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  请来看看!~~  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=8866)

--  作者:tonybig
--  发布时间:2011/11/8 15:36:53
--  请来看看!~~

1分周期

 

当今天开盘价大于昨天收盘价,那么最高价大于该10点前的的最高价多头开仓,最低价跌破昨天最低价反手开空。

 

当今天开盘价低于昨天收盘价,那么最低价小于该10点前的最低价空头开仓,最高价大于昨天最高反手做多。

不知问题在哪里,请帮忙检查一下

 

 

runmode:0;
nn:=barslast(date<>ref(date,1)+1);
predayhigh:=valuewhen(date<>ref(date,1),ref(hhv(h,nn),1));
predaylow:=valuewhen(date<>ref(date,1),ref(llv(l,nn),1));
predayclose:=valuewhen(date<>ref(date,1),ref(c,1));

dayopen:=valuewhen(date<>ref(date,1),o);;

 

sg:valuewhen(time>=090000 and time<=100000,hhv(h,nn+1));//上轨

xg:valuewhen(time>=090000 and time<=100000,llv(l,nn+1));//下轨

enteruperband: = h>=sg;
enterlowerband:= l<=xg;

myentrytime:=time>=100000 and time<=145800;
myexittime:= time>=145800;


if dayopen>predayclose and myentrytime then begin
   if enteruperband then buy(holding=0,1,limitr,sg);
   if l<=predaylow  then begin
    sell(holding>0 and enterbars>1,holding,limitr,thisclose);
    buyshort(holding=0,1,limitr,predaylow); 
    end;
end

if dayopen<predayclose and myentrytime then begin
   if enterlowerband then buyshort(holding=0,1,limitr,xg);
   if h>=predayhigh then begin
     sellshort(holding<0 and enterbars>1,holding,limitr,thisclose);
     buy(holding=0,1,limitr,predayhigh);
     end
end

 

 


--  作者:tonybig
--  发布时间:2011/11/8 15:45:16
--  

还是有问题

[此贴子已经被作者于2011-11-8 15:56:56编辑过]

--  作者:fly
--  发布时间:2011/11/8 17:10:04
--  

sellshort(holding<0 and enterbars>1,holding,limitr,thisclose);

请您看看函数参数,不能这么用

对应错误位置,改成以下

sellshort(holding<0 and enterbars>1,holding,limitr,c-2*mindiff);

 

其它错误,不在一一举例.

也请注意参考ignorecheckprice函数


--  作者:tonybig
--  发布时间:2011/11/8 17:32:28
--  

fly兄您好,我是专业版付费用户100200, 

 

我刚自学金字塔2个星期,自然有很多不明白的地方,视频,资料我没日没夜的看,但这种东西毕竟有限。

希望咱们金字塔员工能够耐心的讲解一下,

 

 

我换上c-2*mindiff;,问题依然存在。

[此贴子已经被作者于2011-11-8 17:58:39编辑过]

--  作者:tonybig
--  发布时间:2011/11/9 14:54:11
--  

今天没朋友上班吗?


--  作者:fly
--  发布时间:2011/11/9 15:35:43
--  

按你策略描述和编写,连蒙带猜,修改如下:

 

runmode:0;
m:=barslast(date<>ref(date,1))+1;
predayhigh:=valuewhen(date<>ref(date,1),ref(hhv(h,m),1));
predaylow:=valuewhen(date<>ref(date,1),ref(llv(l,m),1));
predayclose:=valuewhen(date<>ref(date,1),ref(c,1));
dayopen:=valuewhen(date<>ref(date,1),o);

 

h10:valuewhen(time<=100000,hhv(h,m));//上轨
l10:valuewhen(time<=100000,llv(l,m));//下轨

 

//建立多头进场条件
//开盘价大于昨天收盘价,那么最高价大于该10点前的的最高价多头开仓
long:=h>h10 AND dayopen>predayclose and time>=100000 and time<=145800;
if long then buy(holding=0, 1, limitr, h10);

 

//开盘价低于昨天收盘价,最高价大于昨天最高反手做多
long2:=h>=predayhigh and dayopen<predayclose and time>=100000 and time<=145800;
if long then
 begin
 sellshort(holding<0, 0,limitr,c+2*mindiff);
 buy(holding=0, 1,limitr,max(predayhigh,o));
 end


//建立空头进场条件
//开盘价低于昨天收盘价,那么最低价小于该10点前的最低价空头开仓
short:=l<l10 AND dayopen<predayclose and time>=100000 and time<=145800;
if short then buyshort(holding=0, 1, limitr, l10);

 

//开盘价大于昨天收盘价,最低价跌破昨天最低价反手开空。
short2:=l<=predaylow and dayopen>predayclose and time>=100000 and time<=145800;
if short2 then
     begin
     sell(holding>0 and enterbars>1,0,limitr,c-2*mindiff);
     buyshort(holding=0,1,limitr,min(predaylow,o)); 
     end


--  作者:tonybig
--  发布时间:2011/11/9 15:40:59
--  
图片点击可在新窗口打开查看  fly兄  下个月去上海中期培训,  请你们吃饭哈