Tutte le domande dei nuovi arrivati su MQL4 e MQL5, aiuto e discussione su algoritmi e codici - pagina 244

 
for(int i=0;i<=1440;i++)
     {
      datetime bar_time=iTime(NULL,0,i);
      if(bar_time==0) Print(__FUNCTION__+": iTime failed. Error=",GetLastError());
     }

Perché ottengo sempre bar_time 0 e l'errore 4051?

 
igorbel: Perché ottengo sempre bar_time 0 e l'errore 4051?
//+-------------------------------------------------------+
//| почему 4051                                           |
//+-------------------------------------------------------+
#property strict
void OnStart()
{
  Alert("Bars = ",Bars);
  for(int i=Bars-3;i<=Bars+1;i++)  // Догадайтесь, как правильно!!!
  {
    datetime bar_time=iTime(NULL,0,i);
    if(bar_time==0) Alert("Бар = ", i, "  ",__FUNCTION__+": iTime failed. Error=",GetLastError());
    else Alert("Бар = ", i, "  bar_time = ",bar_time);    // Алерт лучше Принт. И подробнее выводите информацию
  }
} 


 

Salve,

Ho un link: http://bhashsms.com/api/sendmsg.php?user=userid&pass=userpass&sender=senderid&phone=mobile&text=alertmessage&priority=ndnd&stype=normal

Questo link invia un messaggio di testo al tuo telefono se compili il tuo nome utente, la password e altri campi. Il link funziona inserendolo nel browser.

Sto cercando di fare così:

void SMSapi(string userID,string password,string senderID,string phone,string text) 
  { 
   int    res;     
   char   data[];  

   string str="user="+userID+
              "&pass="+password+
              "&sender="+senderID+
              "&phone="+phone+
              "&text="+text+
              "&priority=ndnd&stype=normal"; 

   ArrayResize(data,StringToCharArray(str,data,0,WHOLE_ARRAY,CP_UTF8)-1); 

   res=WebRequest("GET","http://bhashsms.com/api/sendmsg.php",NULL,0,data,data,str); 
   Print(res);
}

Ma il risultato = -1. Ho letto che se il link "...sendmsg.php?..." ha il segno "?" in esso, dovrebbe essere una richiesta "GET", ho provato la stessa richiesta "POST" ma il risultato è negativo.

Per favore, aiutatemi a fare una richiesta corretta.

Grazie.

 
STARIJ:



In iTime, l'indicizzazione non è come nelle serie temporali? Non all'indietro (la barra più nuova è zero)?

 
Maksym Mudrakov:

Salve,

Ho un link: http://bhashsms.com/api/sendmsg.php?user=userid&pass=userpass&sender=senderid&phone=mobile&text=alertmessage&priority=ndnd&stype=normal

Questo link invia un messaggio di testo al tuo telefono se compili il tuo nome utente, la password e altri campi. Il link funziona inserendolo nel browser.

Sto cercando di fare così:

Ma il risultato = -1. Ho letto che se il link "...sendmsg.php?..." ha il segno "?" in esso, dovrebbe essere una richiesta "GET", ho provato la stessa richiesta "POST" ma il risultato è negativo.

Per favore, aiutatemi a fare una richiesta corretta.

Grazie.

Ho anche provato una richiesta diversa:

void SMSapi_2(string userID,string password,string senderID,string phone,string text){ 
  
   string cookie=NULL, headers;
   char post[],result[]; 
   int res; 
   int timeout=5000; 
   char   data[];  

   string str="user="+userID+
              "&pass="+password+
              "&sender="+senderID+
              "&phone="+phone+
              "&text="+text+
              "&priority=ndnd&stype=normal"; 
              
   string url="http://bhashsms.com/api/sendmsg.php?"+str;

   res=WebRequest("GET",url,cookie,NULL,timeout,post,0,result,headers);   

   Print(res);
}

non funziona, il risultato è negativo.

 
igorbel: In iTime, l'indicizzazione non è come nelle serie temporali? Non all'indietro (la barra più nuova è zero)?
  for(int i=0;i<=4;i++)
   Alert("Бар = ", i, "  bar_time = ",iTime(NULL,0,i));
Più veloce a controllare che a scuotere il forum
 
STARIJ:
Più veloce a controllare che a scuotere il forum

In ogni caso ci sarà un problema se iniziate il test nel mese corrente e usate PERIOD_MN1. Ho scritto su questo nel post #2429.

 
Nauris Zukas:

In ogni caso ci sarà un problema se iniziate il test nel mese corrente e usate PERIOD_MN1. Ho scritto su questo nel post #2429.


Ricordami. Cercherò di riprodurlo.

(Dammi solo il link).

 
Victor Nikolaev:

Ricordami. Cercherò di riprodurlo.

(Dammi solo il link).

https://www.mql5.com/ru/forum/160683/page243

Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
  • 2017.06.30
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 

Potete dirmi cosa fare se il mercato non funziona nel terminale?