why the closeall.script only close one order in real account???

 

why the closeall.script only close one order??? 

Hello,why the script cant close all orders once, it only close one order once in Real account.

But,i test it in Demo account, it can work well.

Thanks.

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

//|                                                         7788.mq4 |

//|                        Copyright 2018, MetaQuotes Software Corp. |

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

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

#property copyright "Copyright 2018, MetaQuotes Software Corp.0000000000000000000000000000000??????????"

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

#property version   "1.00"

#property strict

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

//| Script program start function                                    |

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

void OnStart()

  {

//---

     closeCurrent();

   

  }

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

void closeCurrent()

  {

       int t=OrdersTotal();

       for(int i=t-1;i>=0;i--)

         {

           if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)

             {

               if(OrderType()<=1 && OrderSymbol()==Symbol())

                 {

                   OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,Green);

                 }

             }

         }

  }

//----------------------------------------------------------------------------
 
When you compile, you will get a warning that OrderClose() should be checked. So print the reason why when it fails.