以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  这个cross怎么移到外面  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=78151)

--  作者:黄金精算师
--  发布时间:2015/4/30 9:09:25
--  这个cross怎么移到外面

看了下移到外面的,不太会,这个cross怎么移到外面,帮改一下

 

if cross(h,r6) then
begin
buy(holding=0,tn,limitr,r6);
end
if cross(r7,l) then
begin
buyshort(holding=0,tn,limitr,r7);
end
if holding>0 and cross(r5,l) then
begin
sell(1,0,limitr,r5);
end
if holding<0 and cross(h,r5) then
begin
sellshort(1,0,limitr,r5);
end
end


--  作者:jinzhe
--  发布时间:2015/4/30 9:16:58
--  

if aaa then begin

 if cross(x,y) then ......

end

 

改成

 

xx:=cross(x,y)

if aaa then begin

    if xx then .........

end

 

 

 

[此贴子已经被作者于2015/4/30 9:17:09编辑过]

--  作者:黄金精算师
--  发布时间:2015/4/30 9:58:56
--  

这一句改了,还是译不过

if cross(h,r6) then
begin

 

//-----------------------这出错
出错条件:=cross(h,r6);
if 出错条件 then
begin


--  作者:jinzhe
--  发布时间:2015/4/30 10:05:44
--  

cc:=cross(h,r6);

if cc then
begin

 

//-----------------------这出错
出错条件:=cc;
if 出错条件 then
begin


--  作者:黄金精算师
--  发布时间:2015/4/30 10:17:45
--  
这个也编不过
--  作者:黄金精算师
--  发布时间:2015/4/30 10:19:21
--  

单独能过,全部是这样的,帮看一下

input:n(13,1,20,1);

//中轴偏移值

input:m(70,-200,200,1);

//回撤止赢点数

input:m1(24,5,30,1);

//交易手数:
tn:=1;

r1:=barslast(day-ref(day,1)<>0);

r5:ref(o,r1)+0.1*m;
r6:r5+n;
r7:r5-n;

if time>091500 and time<150000 then
begin

if r1=0 and holding=0 then
begin
buy(h>r6,tn,limitr,r6);
buyshort(l<r7,tn,limitr,r7);
end
//-----------------------这出错
出错条件:=cross(h,r6);
if 出错条件 then
begin
buy(holding=0,tn,limitr,r6);
end
if cross(r7,l) then
begin
buyshort(holding=0,tn,limitr,r7);
end
if holding>0 and cross(r5,l) then
begin
sell(1,0,limitr,r5);
end
if holding<0 and cross(h,r5) then
begin
sellshort(1,0,limitr,r5);
end
end

//回撤止赢

r10:=enterbars;

r11:=llv(l,r10+1);

r12:=hhv(h,r10+1);
if time>091500 and time<150000 then
begin
if holding>0 and r12-c>m1 and r10>=1 then

begin

sell(1,0,thisclose);

end

if holding<0 and c-r11>m1 and r10>=1 then

begin

sellshort(1,0,thisclose);

end
end
//收盘前清仓
if time>=151000 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
end

持仓:holding,colorwhite,linethick0;
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,noaxis,colorred

 


--  作者:jinzhe
--  发布时间:2015/4/30 10:21:25
--  

input:n(13,1,20,1);

//中轴偏移值

input:m(70,-200,200,1);

//回撤止赢点数

input:m1(24,5,30,1);

//交易手数:
tn:=1;

r1:=barslast(day-ref(day,1)<>0);

r5:ref(o,r1)+0.1*m;
r6:r5+n;
r7:r5-n;
cc:=cross(h,r6);
cc1:=cross(r7,l);
cc2:=cross(r5,l);
cc3:=cross(h,r5);
if time>091500 and time<150000 then
begin

if r1=0 and holding=0 then
begin
buy(h>r6,tn,limitr,r6);
buyshort(l<r7,tn,limitr,r7);
end
//-----------------------这出错
出错条件:=cc;
if 出错条件 then
begin
buy(holding=0,tn,limitr,r6);
end
if cc1 then
begin
buyshort(holding=0,tn,limitr,r7);
end
if holding>0 and cc2 then
begin
sell(1,0,limitr,r5);
end
if holding<0 and cc3 then
begin
sellshort(1,0,limitr,r5);
end
end

//回撤止赢

r10:=enterbars;

r11:=llv(l,r10+1);

r12:=hhv(h,r10+1);
if time>091500 and time<150000 then
begin
if holding>0 and r12-c>m1 and r10>=1 then

begin

sell(1,0,thisclose);

end

if holding<0 and c-r11>m1 and r10>=1 then

begin

sellshort(1,0,thisclose);

end
end
//收盘前清仓
if time>=151000 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
end

持仓:holding,colorwhite,linethick0;
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,noaxis,colorred


--  作者:jinzhe
--  发布时间:2015/4/30 10:22:00
--  
一共有4个地方要改,而且没改的地方有提示的,请用户下次使用时多加用心,不要碰到问题就放弃
--  作者:黄金精算师
--  发布时间:2015/4/30 10:33:41
--  
哦,原来上面还有几个要写才行呀,谢谢