TradeAlgorithms.mqh文件编译失败,44处错误,这是为什么呢?怎样修改和纠正呢?

 

TradeAlgorithms.mqh文件编译失败,44处错误,这是为什么呢?怎样修改和纠正呢? TradeAlgorithms.mqh文件编译失败,44处错误,这是为什么呢?怎样修改和纠正呢?

//+------------------------------------------------------------------+

//|                                                 Exp_ASCtrend.mq5 |

//|                             Copyright © 2011,   Nikolay Kositsin |

//|                              Khabarovsk,   farria@mail.redcom.ru |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2011, Nikolay Kositsin"

#property link      "farria@mail.redcom.ru"

#property version   "1.00"

//+----------------------------------------------+

//|  EA交易系统指标输入参数                         |

//+----------------------------------------------+

input double MM=-0.1;             // 一笔交易使用的入金,负值 - 交易量大小

input int    StopLoss_=1000;      // 止损点数

input int    TakeProfit_=2000;    // 获利点数

input int    Deviation_=10;       // 最大价格滑点数

input bool   BuyPosOpen=true;     // 允许买入

input bool   SellPosOpen=true;    // 允许卖出

input bool   BuyPosClose=true;    // 允许退出买入持仓

input bool   SellPosClose=true;   // 允许退出卖出持仓

//+----------------------------------------------+

//| ASCtrend 指标输入参数                          |

//+----------------------------------------------+

input ENUM_TIMEFRAMES InpInd_Timeframe=PERIOD_H1; // ASCtrend 指标的时间框架

input int  RISK=4;                               // 风险水平

input uint SignalBar=1;                          // 获取入场信号的柱形索引

//+----------------------------------------------+


int TimeShiftSec;

//---- 为指标句柄声明整型变量

int InpInd_Handle;

//---- 声明开始计算数据的整型变量

int min_rates_total;

//+------------------------------------------------------------------+

//| 交易算法                                                          |

//+------------------------------------------------------------------+

#include <TradeAlgorithms.mqh>

//+------------------------------------------------------------------+

//| EA交易初始化函数                                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---- 获取 ASCtrend 指标句柄

   InpInd_Handle=iCustom(Symbol(),InpInd_Timeframe,"ASCtrend",RISK);

   if(InpInd_Handle==INVALID_HANDLE)

      Print(" Failed to get handle of ASCtrend indicator");


//---- 初始化以秒的形式存储图表周期的变量

   TimeShiftSec=PeriodSeconds(InpInd_Timeframe);


//---- 初始化开始计算数据的变量

   min_rates_total=int(3+RISK*2+SignalBar);

//----

   return(0);


  }

//+------------------------------------------------------------------+

//| EA交易去初始化函数                                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//----

   GlobalVariableDel_(Symbol());

//----


  }

//+------------------------------------------------------------------+

//| EA的订单函数                                                      |

//+------------------------------------------------------------------+

void OnTick()

  {

//---- 检查用于计算的柱形数量是否足够

   if(BarsCalculated(InpInd_Handle)<min_rates_total)

      return;


//---- 为IsNewBar()和SeriesInfoInteger()函数的正常运行,加载历史数据

   LoadHistory(TimeCurrent()-PeriodSeconds(InpInd_Timeframe)-1,Symbol(),InpInd_Timeframe);


//---- 本地变量声明

   double DnVelue[1],UpVelue[1];

//----静态变量声明

   static bool Recount=true;

   static bool BUY_Open=false,BUY_Close=false;

   static bool SELL_Open=false,SELL_Close=false;

   static datetime UpSignalTime,DnSignalTime;

   static CIsNewBar NB;


//+----------------------------------------------+

//| 搜索交易执行信号                               |

//+----------------------------------------------+

   if(!SignalBar || NB.IsNewBar(Symbol(),InpInd_Timeframe) || Recount) // 检查新的柱形

     {

      //---- 交易信号清零

      BUY_Open=false;

      SELL_Open=false;

      BUY_Close=false;

      SELL_Close=false;

      Recount=false;


      //---- 将新数据复制到数组中

      if(CopyBuffer(InpInd_Handle,1,SignalBar,1,UpVelue)<=0)

        {

         Recount=true;

         return;

        }

      if(CopyBuffer(InpInd_Handle,0,SignalBar,1,DnVelue)<=0)

        {

         Recount=true;

         return;

        }


      //---- 获取买入信号

      if(UpVelue[0] && UpVelue[0]!=EMPTY_VALUE)

        {

         if(BuyPosOpen)

            BUY_Open=true;

         if(SellPosClose)

            SELL_Close=true;

         UpSignalTime=datetime(SeriesInfoInteger(Symbol(),InpInd_Timeframe,SERIES_LASTBAR_DATE))+TimeShiftSec;


        }


      //---- 获取卖出信号

      if(DnVelue[0] && DnVelue[0]!=EMPTY_VALUE)

        {

         if(SellPosOpen)

            SELL_Open=true;

         if(BuyPosClose)

            BUY_Close=true;

         DnSignalTime=datetime(SeriesInfoInteger(Symbol(),InpInd_Timeframe,SERIES_LASTBAR_DATE))+TimeShiftSec;


        }


      //---- 为获取持仓平仓信号,查找最近一笔交易的方向

      //if(!MQL5InfoInteger(MQL5_TESTING) && !MQL5InfoInteger(MQL5_OPTIMIZATION)) //如果执行方式在策略测试器中被设置为“随机延迟”

      if((BuyPosOpen && BuyPosClose || SellPosOpen && SellPosClose) && (!BUY_Close && !SELL_Close))

        {

         int Bars_=Bars(Symbol(),InpInd_Timeframe);


         for(int bar=int(SignalBar+1); bar<Bars_; bar++)

           {

            if(SellPosClose)

              {

               if(CopyBuffer(InpInd_Handle,1,bar,1,UpVelue)<=0)

                 {

                  Recount=true;

                  return;

                 }

               if(UpVelue[0]!=0 && UpVelue[0]!=EMPTY_VALUE)

                 {

                  SELL_Close=true;

                  break;


                 }


              }


            if(BuyPosClose)

              {

               if(CopyBuffer(InpInd_Handle,0,bar,1,DnVelue)<=0)

                 {

                  Recount=true;

                  return;

                 }

               if(DnVelue[0]!=0 && DnVelue[0]!=EMPTY_VALUE)

                 {

                  BUY_Close=true;

                  break;


                 }


              }


           }


        }


     }


//+----------------------------------------------+

//| 执行交易                                      |

//+----------------------------------------------+

//---- 平买入持仓

   BuyPositionClose(BUY_Close,Symbol(),Deviation_);


//---- 平卖出持仓

   SellPositionClose(SELL_Close,Symbol(),Deviation_);


//---- 买入

   BuyPositionOpen(BUY_Open,Symbol(),UpSignalTime,MM,0,Deviation_,StopLoss_,TakeProfit_);


//---- 卖出

   SellPositionOpen(SELL_Open,Symbol(),DnSignalTime,MM,0,Deviation_,StopLoss_,TakeProfit_);

//----


  }

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+


附加的文件:
1.png  78 kb
2.png  76 kb
 
從第一個錯誤開始糾錯吧 
原因: