[ARQUIVO] Qualquer pergunta de novato, de modo a não desorganizar o fórum. Profissionais, não passem por aqui. Em nenhum lugar sem você - 3. - página 638

 
aumentar o limite do prazo superior/corrente privado +1.
 
Então, meu irmão jogou alguns jogos em tanques até agora. As ordens não excluem, pelo menos ficou um pouco melhor. Agora, o código é, a saber, eu peguei ambos, e acrescentei i=OrdensTotal()-1; esta linha no laço em teoria deveria obispecar sua continuação até que tudo não seja morto, mas isto não aconteceu. Aqui:
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);
         } } }
        
NÃO A ORDEM REMOVIDA NÃO DEIXA A NOVA ORDEM SER!!! socorro!!!
 
//+------------------------------------------------------------------+
//|  Удаляет рыночные и отложенные ордера.                           |
//|  Как отдельные по тикету, так и по фильтру в цикле поиска        |
//|  Фильтры по магику,типу,символу. Если вызвать с символом "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);}
 
 
Uau, tantas linhas! Obrigado!!!!
 
Cavalheiros especialistas, favor aconselhar como carregar um bom histórico de cotação para o terminal. Para o teste do meu primeiro robô é necessário. As citações para EUR-USD estão em 4 dígitos.
 
Sancho77:

Eu tentei de ambas as maneiras:

Ainda sem reação.




Funciona);
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:
Cavalheiros especialistas, aconselham como carregar um bom histórico de cotações para o terminal. Para o teste do meu primeiro robô é necessário. As citações para EUR-USD estão em 4 dígitos.
Se você quiser jogar no testador, baixe o histórico da MetaQuotes através da F2. Para operações bem-sucedidas em tempo real, você precisa de cotações do servidor de sua corretora. Se sua corretora não possui tal serviço "Quote Archive" (pode estar em alguns sites de corretoras), o histórico tem que ser coletado em tempo real - são informações estratégicas. Esta é uma ferramenta automática para coletar citações.
 

Bom dia a todos!

Pergunta sobre a função iMAOnArray(array[], total, período, ma_shift, ma_method, shift)

Você pode me dizer se o array[] deve ser um array tampão ou pode ser qualquer um? O problema é que quando

Eu crio e inicializo um array em um programa, esta função não funciona. Mas quando eu ligo viaSetIndexBuffer

... tudo funciona como deveria.

 
r772ra:

Funciona)));
Muito obrigado! Realmente funcionou, mas foi estranho, eu estava sempre testando no M15, mas depois decidi experimentar no H1 e o sinal apareceu. Depois voltei à M15 - funcionou))))
Razão: