orders not executed in real - page 2

 
Creative Studio:
Obviously, even during the very long debugging phase I have printed everything to get out of the problem. But here I do not understand what I should check because in testing everything works without problems. How do I figure out where the problem comes from?

no useful help can be received without seeing the codes. all answers are wild guesses. you can summary your code before sending it here.
probably just those parts related to your order sending or condition checking. no one knows for sure.

 
Have you used other timeframes or other symbols in your conditions?
 
Creative Studio: Obviously, even during the very long debugging phase I have printed everything to get out of the problem. But here I do not understand what I should check because in testing everything works without problems. How do I figure out where the problem comes from?
Just a "wild guess" - does your EA check for a maximum spread? Did you perhaps set this limit too low for the real account which makes it not trade at all?
 

Another wild guess could be the use of

if(OrdersTotal()==0)
  {
   //Place Trade
  }

OP - modify your code so that when a signal is verified an arrow is drawn on the chart. That way, if you see the arrows are where they should be you will know that the signal conditions checking algorithm is not the problem. So that will mean it has to be something to do with the order placement.

 
Code2219 or probably 2319:

no useful help can be received without seeing the codes. all answers are wild guesses. you can summary your code before sending it here.
probably just those parts related to your order sending or condition checking. no one knows for sure.

     

Petr Nosek:
Have you used other timeframes or other symbols in your conditions?


Fernando Carreiro:
Just a "wild guess" - does your EA check for a maximum spread? Did you perhaps set this limit too low for the real account which makes it not trade at all?


 NB: only the "g" pattern is allowed .

order sending function:

 Buy (g_Lotti, Prezzo("Bid")-(g_SL*Poin), Prezzo("Bid")+(g_TakeProfit*Poin), g_MagicNumber, "g", "B11");


void Buy(double lot,double _SL,double _TP,int Magic,string pattern, string Tipo="---", double prezzoapertura=0.0)
  {
        if (Period()==PERIOD_M30) Periodo="_M30";
   else if (Period()==PERIOD_H1)  Periodo="__H1";
   else if (Period()==PERIOD_M15) Periodo="_M15";
   else if (Period()==PERIOD_H4)  Periodo="__H4";
   
        if (pattern=="g")   g_Commento="DC__Buy___" +Periodo+ Tipo;
   else if (pattern=="R1S") g_Commento="DC__Buy___" +Periodo+ "R1S";
   
   
   if(ConfermaMargine(Symbol(),OP_BUY,_SL)) { 

   if(MarketInfo(Symbol(),MODE_SPREAD)*Point>(Prezzo("Ask")-_SL)) 
       { Print(g_Commento +" - Spread più alto dello stoploss. SL = spreed se minore di" + IntegerToString(SL_MaxSpreed));
         
            if (MarketInfo(Symbol(),MODE_SPREAD)*Point>SL_MaxSpreed) { 
                  Print(g_Commento +" - Spread più alto di " + IntegerToString(SL_MaxSpreed) +". Non apro");return;}          //Se lo spread è più alto dello stop non apro
          else    _SL=MarketInfo(Symbol(),MODE_SPREAD)*Point+1;  Print("SL 2: "+(string)(_SL));}
         
        if(pattern=="g"   && _SL>=Prezzo("Bid")-STOPLEVEL)                       _SL= Prezzo("Bid")-STOPLEVEL; //Controllo stoplevel, distanza minima dal prezzo, dove non si può inserire lo STOP LOSS.
   else if(pattern=="R1S" && _SL>=(Prezzo("Bid")+(g_GapPerdita*Poin))-STOPLEVEL) _SL=(Prezzo("Bid")+(g_GapPerdita*Poin))-STOPLEVEL;
   _SL=NormalizeDouble(_SL,Digits); 
   
   int ticket=-1,x=0,RipetiInvio=0,TentativoPendente=5;
   
      while(ticket<0){
           // Considero broker ECN, non invio SL
           if(pattern=="g")
               ticket=OrderSend(Symbol(),OP_BUY,lot,Prezzo("Ask"),g_Slippage,0,0,g_Commento,Magic,0,clrBlue);            
      else if(pattern=="R1S")
               ticket=OrderSend(Symbol(),OP_BUYSTOP,lot,prezzoapertura,g_Slippage,0,0,g_Commento,Magic,0,clrBlue);

          if(ticket<0 &&!g_ECN) {Print(g_Commento + " Errore ",GetLastError()," nell\'invio dell'ordine BUY.");return;}
     else if(ticket<0 && g_ECN) {     if(pattern=="g")    CreaFile(nome," |-> Non ha piazzato ORDINE BASE BUY per "+(string)GetLastError(),"","","","","");    
                                 else if(pattern=="R1S") { 
                                                          while (ticket<0 && TentativoPendente<15) {
                                                                  ticket=OrderSend(Symbol(),OP_BUYSTOP,lot,prezzoapertura+(TentativoPendente*Poin),g_Slippage,0,0,g_Commento,Magic,0,clrBlue);
                                                                  TentativoPendente++;}
                                                               
                                                            if (ticket<0) {CreaFile(nome," |-> Non ha piazzato pendente buy per "+(string)GetLastError(),"","","","","");
                                                                           AllarmePendenteBuyFallito=true;  }
                                                          else             CreaFile(nome," |-> Piazzato pendente buy aumentando il gap di "+(string)TentativoPendente+" pip","","","","","");}
                                 Sleep(1000);}
     if(ticket>0){
       s=OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); // NON PIAZZA MAI TP A NESSUN ORDINE HO MESSO 0. DECOMMENTA SE VUOI TP
       s=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(_SL,Digits),0,OrderExpiration(),clrNONE);
       RipetiInvio=0;
       while(!s && RipetiInvio<10){
             s=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(_SL,Digits),0,OrderExpiration(),clrNONE);
             // Versione sintentica if-else     Condizione ? Si : No
                  if(pattern=="g")             
                     CreaFile(nome,"Ordine principale BUY non piazzato SL. Errore: "+(string)GetLastError(),"","","","","");
             else if(pattern=="R1S")
                     CreaFile(nome,"Ordine Pendente BUY non piazzato SL. Errore: "+(string)GetLastError(),"","","","","");
               
             _SL=_SL-1*Poin;
             Sleep(1000);
             RipetiInvio++; }
      }
      
       if(ticket>0 || x>=10) break;
         else x++;
    }
    
    if(ticket>0){
    //Screenshot("Apertura "+pattern);
    
         if(pattern=="g"){
         CreaFile(nome,(string)OrderTicket(),TimeToStr(OrderOpenTime(),TIME_DATE|TIME_MINUTES),(string)OrderLots(),OrderSymbol(),OrderComment(), "OP_BUY", true );
         InfoOrdineAperto[1]=OrderOpenPrice();
         SLBuy=_SL;
         g_OverOpen=(int)MarketInfo(Symbol(),MODE_SPREAD);  
         SignalTradeB=false;
         SignalTrade1B=false; SignalTrade2B=false; SignalTrade3B=false; SignalTrade21B=false;
         OrderOpenTimeBuy=OrderOpenTime();
            }
    }
    
    }//Fine Controllo Margine
    else CreaFile(nome,g_Commento + " |-> Errore "+(string)GetLastError()+" nell\'invio dell'ordine BUY. Non c'e margine. Errore 134.","","","","",""); 
    
  }

function ConfermaMargine


bool ConfermaMargine(string Simbolo,int OrdineType,double LotSize) { 
  
   if(AccountStopoutMode()==0 && MathRound(AccountMargin()+AccountFreeMargin()-AccountFreeMarginCheck(Simbolo,OrdineType,LotSize))!=0 && (100*AccountEquity()/(AccountMargin()+AccountFreeMargin()-AccountFreeMarginCheck(Simbolo,OrdineType,LotSize)))<AccountStopoutLevel() && GetLastError()==134)
     {
      return false;
     }
   else if(AccountStopoutMode()==1 && AccountFreeMarginCheck(Simbolo,OrdineType,LotSize)<AccountStopoutLevel() && GetLastError()==134)
     {
      return false;
     }
   return true;
  }

Conditions are comparisons made on the results of the following indicators:

if (IsNewBar()){    

   
// ======== INIDCATORE ROSSO ===================================================================      
   for(int i=0; i<(int)(SizeBufferStocRosso); i++)  
      BufferStoRosso[i]             = iStochastic(NULL,0,STO_Rosso_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,i);
      
   for (int i=0; i<6; i++) 
      BufferiMaExpStoRosso[i]       = iMAOnArray(BufferStoRosso,0,iMaExpStoRossoPeriod,0,MODE_EMA,i);                 
      
// ======== INIDCATORE CELESTE =================================================================      
   for(int i=0; i<(int)(SizeBufferStocCeleste); i++)  
      BufferStoCeleste[i]           = iStochastic(NULL,0,STO_Celeste_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,i);
      
   for(int i=0; i<iMaExpStoCelestePeriod; i++) 
      BufferiMaExpStoCeleste[i]     = iMAOnArray(BufferStoCeleste,0,iMaExpStoCelestePeriod,0,MODE_EMA,i);               

// ======== INIDCATORE GRIGIO ==================================================================      
   for(int i=0; i<(int)(SizeBufferStocGrigioG); i++)   
      BufferStoGrigioG[i]            = iStochastic(NULL,0,STO_GrigioG_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,0,MODE_MAIN,i);
   
   for(int i=0; i<(int)(SizeBufferStocGrigioG); i++) 
      BufferiMaExpStoGrigioG[i]      = iMAOnArray(BufferStoGrigioG,0,iMaExpStoGrigioGPeriod,0,MODE_EMA,i);    
               
// ======== INIDCATORE BLU =====================================================================            
   for(int i=0; i<(int)(SizeBufferStocBluG); i++)   
      BufferStoBluG[i]              = iStochastic(NULL,0,STO_BluG_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,i);
   
   //for(int i=0; i<(int)(SizeBufferStocBluG); i++) 
   //   BufferiMaExpStoBluG[i]        = iMAOnArray(BufferStoBluG,0,iMaExpStoBluGPeriod,0,MODE_EMA,i);   
      
   for(int i=0; i<(int)(SizeBufferStocBluG); i++) 
      BufferRsiStoBluG[i]           = iRSIOnArray(BufferStoBluG,0,KPeriodRsiBluG,i);
      
   //for(int i=0; i<(int)(SizeBufferStocBluG); i++) 
   //   BufferiMaSmaRsiBluG[i]         = iMAOnArray(BufferRsiStoBluG,0,iMaSmaRsiBluGPeriod,0,MODE_SMA,i);
      
   for(int i=0; i<(int)(SizeBufferStocBluG); i++) {
      BufferBBUpSmaBluG[i]           = iBandsOnArray(BufferRsiStoBluG,0,KPeriodBBBluG,DeviationBBBluG,0,MODE_UPPER,i);
      BufferBBDwSmaBluG[i]           = iBandsOnArray(BufferRsiStoBluG,0,KPeriodBBBluG,DeviationBBBluG,0,MODE_LOWER,i); }
      

   
   } else {
               // Valore Linea rossa in Candela 0 Aggiornata al tick
               BufferStoRosso[0]                = iStochastic(NULL,0,STO_Rosso_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,0); 
               BufferiMaExpStoRosso[0]          = iMAOnArray(BufferStoRosso,0,iMaExpStoRossoPeriod,0,MODE_EMA,0); 
               // Valore Linea celeste in Candela 0 Aggiornata al tick
               BufferStoCeleste[0]              = iStochastic(NULL,0,STO_Celeste_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,0);
               BufferiMaExpStoCeleste[0]        = iMAOnArray(BufferStoCeleste,0,iMaExpStoCelestePeriod,0,MODE_EMA,0);               
               //Valore Linea grigia tratteggiata in Candela 0 Aggiornata al tick
               BufferStoGrigioG[0]              = iStochastic(NULL,0,STO_GrigioG_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,0,MODE_MAIN,0);
               BufferiMaExpStoGrigioG[0]        = iMAOnArray(BufferStoGrigioG,0,iMaExpStoGrigioGPeriod,0,MODE_EMA,0); 
               //Valore Linea blu tratteggiata in Candela 0 Aggiornata al tick
               BufferStoBluG[0]                 = iStochastic(NULL,0,STO_BluG_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,0);
               //BufferiMaExpStoBluG[0]           = iMAOnArray(BufferStoBluG,0,iMaExpStoBluGPeriod,0,MODE_EMA,0);
               BufferRsiStoBluG[0]              = iRSIOnArray(BufferStoBluG,0,KPeriodRsiBluG,0); 
               //BufferiMaSmaRsiBluG[0]           = iMAOnArray(BufferRsiStoBluG,0,iMaSmaRsiBluGPeriod,0,MODE_SMA,0);
               BufferBBUpSmaBluG[0]             = iBandsOnArray(BufferRsiStoBluG,0,KPeriodBBBluG,DeviationBBBluG,0,MODE_UPPER,0);
               BufferBBDwSmaBluG[0]             = iBandsOnArray(BufferRsiStoBluG,0,KPeriodBBBluG,DeviationBBBluG,0,MODE_LOWER,0);
              
               }

on init code

if(KPeriodRsiBluG >= KPeriodBBBluG) SizeBufferBlu=KPeriodRsiBluG; else SizeBufferBlu=KPeriodBBBluG;   
   
      
// ======== VARIABILI INIDCATORE ROSSO ===================================================================      
   SizeBufferStocRosso =(3.45*(iMaExpStoRossoPeriod+1))+2;
   ArrayResize(BufferStoRosso,         (int)(SizeBufferStocRosso));               
   ArraySetAsSeries(BufferStoRosso,  true);

// ======== VARIABILI INIDCATORE CELESTE =================================================================    
   SizeBufferStocCeleste=(3.45*(iMaExpStoCelestePeriod+1))+2;
   ArrayResize(BufferStoCeleste,       (int)(SizeBufferStocCeleste));              
   ArrayResize(BufferiMaExpStoCeleste,iMaExpStoCelestePeriod);                     
   ArraySetAsSeries(BufferStoCeleste,        true);
   ArraySetAsSeries(BufferiMaExpStoCeleste,  true);

// ======== VARIABILI INIDCATORE GRIGIO ==================================================================    
   SizeBufferStocGrigioG=(3.45*(iMaExpStoGrigioGPeriod+1))+2;
   ArrayResize(BufferStoGrigioG,        (int)(SizeBufferStocGrigioG));               
   ArrayResize(BufferiMaExpStoGrigioG,  (int)(SizeBufferStocGrigioG));         
   ArraySetAsSeries(BufferStoGrigioG,         true);
   ArraySetAsSeries(BufferiMaExpStoGrigioG,   true);
   
// ======== VARIABILI INIDCATORE BLU =====================================================================    
   SizeBufferStocBluG=(4.25*(SizeBufferBlu+1))+2;
   ArrayResize(BufferStoBluG,        (int)(SizeBufferStocBluG));               
         
   ArraySetAsSeries(BufferStoBluG,         true);
   
   ArrayResize(BufferRsiStoBluG,        (int)(SizeBufferStocBluG));
   ArraySetAsSeries(BufferRsiStoBluG,      true);
   
   ArrayResize(BufferBBUpSmaBluG,       (int)(SizeBufferStocBluG));
   ArrayResize(BufferBBDwSmaBluG,       (int)(SizeBufferStocBluG));
   ArraySetAsSeries(BufferBBUpSmaBluG,     true);
   ArraySetAsSeries(BufferBBDwSmaBluG,     true);


Reason: