以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]求助,哪有有问题,能帮忙更改一下吗  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=73874)

--  作者:利物莫的门徒
--  发布时间:2015/1/3 21:01:58
--  [求助]求助,哪有有问题,能帮忙更改一下吗
 H1 := ref(HHV(High,Length),1);
L1  := ref(LLV(Low,Length),1);

VARIABLE:BreakUnderCounter = 0 ;
VARIABLE:BreakUnderCounter = 0 ;

if High > H1 then Begin
BreakoutCounter := 1 ;
BreakUnderCounter := 0 ;
end;

if Low < L1 then Begin
BreakUnderCounter := 1 ;
BreakOutCounter := 0 ;
end;

if BreakOutCounter >= BrkOutNo then Begin
Buy(holding=0,1,market);
BreakOutCounter = 1 ;
end;

if BreakUnderCounter >= BrkOutNo then Begin
buyshort(holding=0,1,market);
BreakUnderCounter = 1 ;
end;

if c< LlV(Low,TrailLen) then begin 
sell(holding>0,0,market);
end;

if c>hhv(high,TrailLen) then begin
sellshort(holding<0,0,market);
end;

资产:asset,noaxis,COLORGRAY; 

--  作者:jinzhe
--  发布时间:2015/1/4 13:58:33
--  
Length,BrkOutNo,TrailLen未定义,定义了之后就正常
--  作者:利物莫的门徒
--  发布时间:2015/1/4 17:08:24
--  [原创]
我自己肯定定义了啊,但是图表显示无信号
--  作者:jinzhe
--  发布时间:2015/1/5 9:19:37
--  
那么把你的定义也一起贴上来
--  作者:利物莫的门徒
--  发布时间:2015/1/5 20:13:48
--  
Length 10  ,BrkOutNo 2,TrailLen 4 定义了之后还是无显示,是申明全局变量有问题的吗?
--  作者:jinzhe
--  发布时间:2015/1/6 9:02:21
--  
BreakoutCounter ,BreakUnderCounter 这两个变量只有0和1两个值,开仓条件是要让这两个变量大于2,所以恒不成立
--  作者:利物莫的门徒
--  发布时间:2015/1/6 10:23:27
--  
哦,好的,谢谢版主,我去改下试试
--  作者:利物莫的门徒
--  发布时间:2015/1/6 10:29:31
--  
我的意思是定
BreakoutCounter ,BreakUnderCounter 这两个变量没成立一次,就把变量加一,一直到大于2次,请问是不是需要把它定义成数组变量才行呢?

--  作者:jinzhe
--  发布时间:2015/1/6 10:33:48
--  

改成这样

if High > H1 then Begin
BreakoutCounter := BreakoutCounter +1 ;
BreakUnderCounter := 0 ;
end;

if Low < L1 then Begin
BreakUnderCounter := BreakUnderCounter+1 ;
BreakOutCounter := 0 ;
end;

if BreakOutCounter >= BrkOutNo then Begin
Buy(holding=0,1,market);
BreakOutCounter := 1 ;
end;

if BreakUnderCounter >= BrkOutNo then Begin
buyshort(holding=0,1,market);
BreakUnderCounter := 1 ;
end;