您现在的位置:程序化交易>> 期货公式>> 交易开拓者(TB)>> 开拓者知识>>正文内容

编译一个止损策略,一下子出现4、5种error,请问怎么破?程序如下 [开拓者 TB]

  • 咨询内容: 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 我勒个去,傻眼了,求各位大侠指点迷津

     

  • TB技术人员: data_of_body 应该是个用户函数吧,你有没啊

     

  • TB客服: data_of_body不是系统函数,不能直接用啊!而且程序里也不应该直接用open、close这样的写法,否则测试就失真了,这相当于未来函数了。

     

  • 网友回复: 慢慢改

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容