设为首页收藏本站

 找回密码
 注册
查看: 1767|回复: 3
打印 上一主题 下一主题

编译一个止损策略,一下子出现4、5种error,请问怎么破?程序如下 [复制链接]

Rank: 1

精华
0
UID
148688
积分
2
帖子
1
主题
1
阅读权限
10
注册时间
2012-10-17
最后登录
2013-11-11
跳转到指定楼层
1#
发表于 2013-8-15 15:24:12 |只看该作者 |倒序浏览
Params
        Numeric Length(20);                       
        Numeric Offset(2);
        Numeric type(0);                        //调用期货的品种0-IF,1-Rb
        Numeric Timeframe(1440);        //调用数据的时间周期30min-30,1hour-60,1day-1440
        NumericRef StopLossLine;                //止损线
        NumericRef StopInterestLine;        //止盈线       

Vars
        Bool CloseOut;
        NumericSeries UpLine;                //上轨
        NumericSeries DownLine;                //下轨
        NumericSeries MidLine;        //中间线
        Numeric Band;
        Numeric RLine_between_gm;
        Numeric RLine_between_ml;
        Numeric GLine_between_gm;
        Numeric GLine_between_ml;
        BoolSeries switch(False);                        //止盈启动开关
        NumericSeries stpline;
       
Begin
        MidLine = AverageFC(Close,Length);
        Band = StandardDev(Close,Length,2);
        UpLine = MidLine + Offset * Band;
        DownLine = MidLine - Offset * Band;
       
        data_of_body(type,Timeframe,RLine_between_gm,RLine_between_ml,GLine_between_gm,GLine_between_ml);
        IF(MarketPosition==1)
        {
                StopLossLine=MidLine;
                stpline=StopLossLine;
                StopInterestLine=Low[1];
                IF(!switch And High[1]>UpLine[1])
                        switch=True;
                IF(switch And Low<StopInterestLine)
                {
                        CloseOut=True;
                        switch=False;
                }
                Else IF(Close[1]<stpline[1])
                        CloseOut=True;
                Else IF((Open-Close)>GLine_between_gm And Low<StopLossLine)
                        CloseOut=True;
                Else
                        CloseOut=False;
        }
        IF(MarketPosition==-1)
        {
                StopLossLine=MidLine;
                stpline=StopLossLine;
                StopInterestLine=High[1];
                IF(!switch And Low[1]<DownLine[1])
                        switch=True;
                IF(switch And High>StopInterestLine)
                {
                        CloseOut=True;
                        switch=False;
                }
                Else IF(Close[1]>stpline[1])
                        CloseOut=True;
                Else IF((Close-Open)>RLine_between_gm And High>StopLossLine)
                        CloseOut=True;
                Else
                        CloseOut=False;
        }
        Return CloseOut;
End
编译的时候出现error C2143 C2059 C4430 C2065 我勒个去,傻眼了,求各位大侠指点迷津

Rank: 1

精华
0
UID
119317
积分
35
帖子
15
主题
9
阅读权限
10
注册时间
2013-5-23
最后登录
2014-7-30
2#
发表于 2013-8-16 16:01:53 |只看该作者
data_of_body 应该是个用户函数吧,你有没啊

使用道具 举报

Rank: 1

精华
0
UID
140626
积分
2
帖子
2
主题
0
阅读权限
10
注册时间
2012-9-18
最后登录
2015-4-14
3#
发表于 2013-8-16 20:50:59 |只看该作者
data_of_body不是系统函数,不能直接用啊!而且程序里也不应该直接用open、close这样的写法,否则测试就失真了,这相当于未来函数了。

使用道具 举报

Rank: 7Rank: 7Rank: 7

精华
0
UID
101507
积分
3699
帖子
194
主题
25
阅读权限
80
注册时间
2012-3-1
最后登录
2016-6-4
4#
发表于 2013-8-17 09:30:08 |只看该作者
慢慢改

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-23 17:15

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部