Problem with FTP function

 

Hi,


First, I do a couple of csv files for different magic numbers in this EA. (3 different)

I then call FTP function to send this to my FTP. 

The first goes well and lands at FTP. 

Second I get an errormessage "FTP: change directory failed [path in settings]

Third csv goes well and lands at FTP.


I first thought that the calls was too close to eachother, so I put Sleep(5000) after sending each file.

Still the same issue.

I have also tried to change order in what magic sends as second. Still same issue.


Does anyone has any clue of whats going on here?

This is how I call my functions (NewCandleOnChart does so the code runs once when a new bar is up)

void OnTick()
  {
   if(NewCandleOnChart()==true)
   {
   if(magic1!=0)
   {
   ProfitThisTrade(magic1);
   DailyProfit(magic1);
   AllProfit(magic1);
   writeProfit(magic1);
   sendResults(magic1);
   }
   if(magic2!=0)
   {
   ProfitThisTrade(magic2);
   DailyProfit(magic2);
   AllProfit(magic2);
   writeProfit(magic2);
   sendResults(magic2);
   }
   if(magic3!=0)
   {
   ProfitThisTrade(magic3);
   DailyProfit(magic3);
   AllProfit(magic3);
   writeProfit(magic3);
   sendResults(magic3);
   }
   }
   
  }

This is my call to FTP function.


void sendResults(int MagicNumber)
{
   if(!SendFTP(MagicNumber+".csv",NULL))
      {
      Print("Could not connect to FTP");
      } 
      else
         Print("Sent successfull to FTP");
   Sleep(5000);       
}
Documentation on MQL5: Common Functions / Sleep
Documentation on MQL5: Common Functions / Sleep
  • www.mql5.com
Sleep - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5