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
还是有问题
sellshort(holding<0 and enterbars>1,holding,limitr,thisclose);
请您看看函数参数,不能这么用
对应错误位置,改成以下
sellshort(holding<0 and enterbars>1,holding,limitr,c-2*mindiff);
其它错误,不在一一举例.
也请注意参考ignorecheckprice函数
fly兄您好,我是专业版付费用户100200,
我刚自学金字塔2个星期,自然有很多不明白的地方,视频,资料我没日没夜的看,但这种东西毕竟有限。
希望咱们金字塔员工能够耐心的讲解一下,
我换上c-2*mindiff;,问题依然存在。
今天没朋友上班吗?
按你策略描述和编写,连蒙带猜,修改如下:
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