[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 638

 
increase the limit on the private upper/current timeframe +1.
 
So, my brother has played a few games in tanks so far. Orders do not delete, at least it got a little better. Now the code is, namely, I dabbed both, and I added i=OrdersTotal()-1; this line in the loop in theory should obispechit its continuation until all is not killed, but this has not happened. Here:
if(Summaprofita()>=Profit_v_balans )
        {
         for(int i=OrdersTotal()-1;i>=0;i--)
           {
              bool error=true;
            OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
            
            if( magic==OrderMagicNumber( ) && OrderSymbol()==Symbol())
              {
              
                 OrderClose( OrderTicket( ), OrderLots( ), OrderClosePrice( ) , 0, CLR_NONE); error=false;
                           Sleep(1000);
             OrderDelete(OrderTicket());error=false;
             
              if(OrderType()==OP_BUY)
              {
               OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
               
              }
            if(OrderType()==OP_SELL)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);
               
              }
              i=OrdersTotal()-1;
            Sleep(1000);
         } } }
        
NOT THE REMOVED ORDER DOESN'T LET THE NEW ORDER BE!!! help!!!
 
//+------------------------------------------------------------------+
//|  Удаляет рыночные и отложенные ордера.                           |
//|  Как отдельные по тикету, так и по фильтру в цикле поиска        |
//|  Фильтры по магику,типу,символу. Если вызвать с символом "All" - |
//|  То удалит все, подобно функции DeleteAll()                      |
//+------------------------------------------------------------------+
bool OrdClose(int magik  = -1,
              int type   = -1,//=10 удаление всех рыночных; =11 удаление всех отложенных 
              int ticket = -1,
           string symb   = "",
           double cLot   = -1      
              ){int   digit = MarketInfo(Symbol(),MODE_DIGITS);double lot;
//+------------------------------------------------------------------+
   if(cLot==0){return;}
   if(symb==""){symb=Symbol();}
   int slip = MarketInfo(symb,MODE_SPREAD);
   double ltstp = MarketInfo(Symbol(),MODE_LOTSTEP);
   if(ltstp == 0.1){int ltdg = 1;}
   if(ltstp == 0.01){   ltdg = 2;} 
   if(ticket>0){
      GetLastError();
      RefreshRates();
      if(OrderSelect(ticket,SELECT_BY_TICKET)){
         if(OrderCloseTime()!=0){return;}
         if(OrderType()<2){
                lot = OrderLots();
                if(cLot>0){
                        lot = NormalizeDouble(cLot,ltdg);
                        if(lot>OrderLots()){lot=OrderLots();}
                        if(lot<MarketInfo(Symbol(),MODE_MINLOT)){lot=MarketInfo(Symbol(),MODE_MINLOT);}
                }
            if(!OrderClose(OrderTicket(),
                                     lot,
       NormalizeDouble(OrderClosePrice(),MarketInfo(symb,MODE_DIGITS)),
                                    slip,
                                   Green
                          )
            ){
               Print(GetLastError());
               return(false);              
            }else{
               Print("Order "+GetNameOP(OrderType())+" closed");
               return(true);
            }                          
         }else{
            if(!OrderDelete(OrderTicket(),GetOrdCl(type))){
               Print(GetLastError());
               return(false);              
            }else{
               Print("Order "+GetNameOP(OrderType())+" closed");
               return(true);
            }
         }
      }
   }else{
//+------------------------------------------------------------------+
   for(int i=OrdersTotal()-1;i>=0;i--){
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
         if(OrderCloseTime()!=0){continue;}
         if(symb!="All"){
            if(OrderSymbol()!=symb){continue;}
            if(type>=0&&type<6){if(OrderType()!=type){continue;}}
            if(type==10){if(OrderType()>1){continue;}}
            if(type==11){if(OrderType()<2){continue;}}
            if(magik>0){if(OrderMagicNumber()!=magik){continue;}}
         }
         if(OrderType()<2){
                lot = OrderLots();
                if(cLot>0){
                        lot = NormalizeDouble(cLot,ltdg);
                        if(lot>OrderLots()){lot=OrderLots();}
                        if(lot<MarketInfo(Symbol(),MODE_MINLOT)){lot=MarketInfo(Symbol(),MODE_MINLOT);}
                }
                Print("Close ",type,"  ",OrderType());
            if(!OrderClose(OrderTicket(),
                                     lot,
       NormalizeDouble(OrderClosePrice(),MarketInfo(symb,MODE_DIGITS)),
                                    slip,
                                   Green
                          )
            ){
               Print(GetLastError());
               return(false);              
            }else{
               Print("Order "+GetNameOP(OrderType())+" closed");
            }                          
         }else{
            if(!OrderDelete(OrderTicket(),GetOrdCl(type))){
               Print(GetLastError());
               return(false);              
            }else{
               Print("Order "+GetNameOP(OrderType())+" closed");
            }
         }
      }
   }          
//-----+
}   
return(true);}
 
Description of the teams :https://www.mql5.com/ru/forum/137651/page3
 
Wow, so many lines! Thanks!!!!
 
Gentlemen experts, please advise how to upload a good quote history to the terminal. For the test of my first robot is required. The quotes for EUR-USD are in 4 digits.
 
Sancho77:

I've tried it both ways:

Still no reaction.




It works);
int start()
  {
//----
     Comment("Signal = ",Signal());       
//----
   return(0);
  }
//+------------------------------------------------------------------+

  int Signal()
  {
  double dn_stop_1 = iCustom(NULL,0,"NRTR_ATR_STOP",ATR,Coeficient,0,1); // синий, снизу
  double up_stop_1 = iCustom(NULL,0,"NRTR_ATR_STOP",ATR,Coeficient,1,1); // красный, сверху
              
   if (dn_stop_1!=0.0) return(1);
   if (up_stop_1!=0.0) return(-1);
   
   return(0);
   } 
 
Myth63:
Gentlemen experts, please advise how to upload a good quote history to the terminal. For the test of my first robot is required. The quotes for EUR-USD are in 4 digits.
If you want to play in the tester, download the history from MetaQuotes through F2. For successful real-time operations you need quotes from your brokerage company's server. If your brokerage company does not have such service "Quote Archive" (it can be on some brokerage companies web sites), the history has to be collected in real time - it is strategic information. This is an automatic tool to collect quotes.
 

Good day to all!

Question about iMAOnArray(array[], total, period, ma_shift, ma_method, shift)function

Can you tell me if array[] must be a buffer array or can be any? The problem is that when

I create and initialize an array in a program, this function doesn't work. But when I bind viaSetIndexBuffer

... everything works as it should.

 
r772ra:

It works));
Thank you very much! It really worked, but it was weird, I was always testing on M15, but then I decided to try it on H1 and the signal appeared. Then I went back to M15 - it worked)))
Reason: