how to run script on MT4 1045 build

要添加评论,请登录注册
alan
45
alan  

今天在运行了一个script 显示不能打开,代码如下,请帮忙看一下问题出现在什么地方。谢谢

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

//|                                                      current.mq4 |

//|                        Copyright 2017, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

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

#property copyright "Copyright 2017, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict

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

//| Script program start function                                    |

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

void OnStart()

  {

int a=0;

int cnt, total;

while(OrdersTotal()>0)

   {

      total=OrdersTotal();

      for(cnt=total-1;cnt>=0;cnt--)

         {

            OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

            if(OrderType()==OP_SELL&&OrderSymbol()==Symbol())

               {

                  OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_ASK),5,CLR_NONE);

               }

            if(OrderType()==OP_BUY&&OrderSymbol()==Symbol())

               {

                  OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_BID),5,CLR_NONE);

               }

         }

        a=a+1;

        if(a==20)

         {

          return;

          }

         RefreshRates();

   }



return(0);

  

  }

//+------------------------------------------------------------------+
自动交易和策略测试
自动交易和策略测试
  • www.mql5.com
MQL5:MetaTrader 5客户端内置的交易策略语言。语言允许编写您自己的自动交易系统,技术指标,脚本和函数程序库
Ziheng Zhuang
30708
Ziheng Zhuang  

最后后一行代码 return(0);

改成 return;

然后重新编译下。

要添加评论,请登录注册