以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  不知道问题在哪里,总说我end语句不完整  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=8673)

--  作者:tonybig
--  发布时间:2011/10/31 9:04:26
--  不知道问题在哪里,总说我end语句不完整

实在找不到 ,请大神帮忙

 

if holding=0 then begin
    if A1 then
    BUY(A1 ,1,limitr,A3+2*mindiff);
 end

if holding=0 then begin
    if A2 then
    buyshort(A2,1,limitr,A4-2*mindiff);
end

if holding>0 then begin
    if low>=enterprice-2*atr then
    sell(1,holding,limitr,atr));
   
    if A2 then
    sell(A2,holding,limitr,A4-2*mindiff);
    buyshort(A2,1,limitr,A4-3*mindiff);
end


if holding<0 then begin
    if high>=enterprice+2*atr then begin
    sellshort(1,holding,limitr,atr);
   
    if A1 then
    sellshort(A1,holding,limitr,A3+2*mindiff);
    buy(A1,1,limitr,A3+3*mindiff);
   
end//

//盈亏:asset-500000,noaxis,coloryellow,linethick2;

[此贴子已经被作者于2011-10-31 9:05:36编辑过]

--  作者:just
--  发布时间:2011/10/31 9:12:06
--  

if holding=0 then begin
if A1 then BUY(A1 ,1,limitr,A3+2*mindiff); end
if holding=0 then begin
if A2 then buyshort(A2,1,limitr,A4-2*mindiff); end
if holding>0 then begin
if low>=enterprice-2*atr then sell(1,holding,limitr,atr);
if A2 then sell(A2,holding,limitr,A4-2*mindiff);
buyshort(A2,1,limitr,A4-3*mindiff); end
if holding<0 then begin
if high >=enterprice+2*atr then begin
sellshort(1,holding,limitr,atr); end
if A1 then sellshort(A1,holding,limitr,A3+2*mindiff);
 buy(A1,1,limitr,A3+3*mindiff); end// 

这里有两个BEGIN

[此贴子已经被作者于2011-10-31 9:15:02编辑过]

--  作者:tonybig
--  发布时间:2011/10/31 10:35:24
--  

已修改,但仍然还是同样问题
if holding=0 then begin
    if A1 then
    BUY(A1 ,1,limitr,A3+2*mindiff);
 end

if holding=0 then begin
    if A2 then
    buyshort(A2,1,limitr,A4-2*mindiff);
end

if holding>0 then begin
    if low>=enterprice-2*atr then
    sell(1,holding,limitr,atr));
    if A2 then
    sell(A2,holding,limitr,A4-2*mindiff);
    buyshort(A2,1,limitr,A4-3*mindiff);
   
end


if holding<0 then begin
    if high>=enterprice+2*atr then
    sellshort(1,holding,limitr,atr);
    if A1 then
    sellshort(A1,holding,limitr,A3+2*mindiff);
    buy(A1,1,limitr,A3+3*mindiff);
end//


--  作者:jinzhe
--  发布时间:2011/10/31 10:50:20
--  

很多条件是无用而且重复的,给你修改了下。

 

 

if a1 then  BUY(holding=0 ,1,limitr,A3+2*mindiff);


if a2 then buyshort(holding=0,1,limitr,A4-2*mindiff);

 

if low>=enterprice-2*atr then sell(holding>0,holding,limitr,atr);
if A2 then begin
    sell(holding>0,holding,limitr,A4-2*mindiff);
    buyshort(holding=0,1,limitr,A4-3*mindiff);
   
end

 

if high>=enterprice+2*atr then  sellshort(holding<0,holding,limitr,atr);
if A1 then begin
    sellshort(holding<0,holding,limitr,A3+2*mindiff);
    buy(holding=0,1,limitr,A3+3*mindiff);
end

 


--  作者:just
--  发布时间:2011/10/31 10:51:56
--  
以下是引用tonybig在2011-10-31 10:35:24的发言:

已修改,但仍然还是同样问题
if holding=0 then begin
    if A1 then
    BUY(A1 ,1,limitr,A3+2*mindiff);
 end

if holding=0 then begin
    if A2 then
    buyshort(A2,1,limitr,A4-2*mindiff);
end

if holding>0 then begin
    if low>=enterprice-2*atr then
    sell(1,holding,limitr,atr));
    if A2 then
    sell(A2,holding,limitr,A4-2*mindiff);
    buyshort(A2,1,limitr,A4-3*mindiff);
   
end


if holding<0 then begin
    if high>=enterprice+2*atr then
    sellshort(1,holding,limitr,atr);
    if A1 then
    sellshort(A1,holding,limitr,A3+2*mindiff);
    buy(A1,1,limitr,A3+3*mindiff);
end//

 

多一个括号 , 去掉这个括号我这里编译通过。


--  作者:tonybig
--  发布时间:2011/10/31 12:42:40
--  
好的 感谢楼上两位