SendFTP ,can't get it to work.

 

Hello

I having difficulty to get the SendFTP command to work on a custom indicator I am writing.

For testing purposes I am just using this code, that should just create a snapshot and FTP it. The snapshot

does get created however it does not get FTP and returns false

ScreenShot("screen3.gif",640,480,-1,2,CHART_CANDLE);
SendFTP("screen3.gif");
   
Alert(SendFTP("screen3.gif"));

Regarding the FTP settings

I have entered successfully my server details in the FTP options

Tools/Options/FTP.

I have also tested it and I did receive the statement file on my server.

Can anyone suggest any reason as to why I can't get it to work.

Thank you

 
What is returned by SendFTP() ? if false, what is the error code ?
 
Since you received the statement on your server you should check your server log and also look at the console whilst sending the file, probably it will show the error like connection refused due to incorrect credentials or non existent destination the fact that your server recieves the call indicates that the problem resides on the server side and not the sending indicator so more examination of the logs is needed to be able to find the answer.
 
Alain Verleyen:
What is returned by SendFTP() ? if false, what is the error code ?

When using SendFTP() , nothing is returned or printed in the Experts Logo or the Journal,

The Alert(SendFTP()) returns a  pop message false

 
Marco vd Heijden:
Since you received the statement on your server you should check your server log and also look at the console whilst sending the file, probably it will show the error like connection refused due to incorrect credentials or non existent destination the fact that your server recieves the call indicates that the problem resides on the server side and not the sending indicator so more examination of the logs is needed to be able to find the answer.

I fairly new to servers so please bare with me a little here.

The fact that I received the file when I run a Test under Tools/Options/FTP shouldn't it mean that the connection is working and that the settings are correct?

What is the difference from using the SendFTP () command that prevents if from doing it the same?

I am unable to detect a way to check the Logs of the server when an external client is used to send a file. Can you advise how I can advise how I can do that?

I have Cpanel with a file manager software for uploading files and FTPzila.

The MT4 will print under the logs File Publishing/Ok ,when I run the test , while when I use the SendFTP() nothing gets printed in the MT4 logs.


Thank you

 
Michalis Phylactou:

When using SendFTP() , nothing is returned or printed in the Experts Logo or the Journal,

The Alert(SendFTP()) returns a  pop message false

So SendFTP() is returning false.

The means there is an error, you need to print the error code with GetLastError(), then check what this error is meaning.

 
Alain Verleyen:

So SendFTP() is returning false.

The means there is an error, you need to print the error code with GetLastError(), then check what this error is meaning.


ScreenShot("screen3.gif",640,480,-1,2,CHART_CANDLE);
if (!SendFTP("screen3.gif"));
Alert( GetLastError());

Thank you for your support.

I have modified the code as above.

The pop up message returns 4055

From what I see is

ERR_CUSTOM_INDICATOR_ERROR4055Custom indicator error.

Can you advise further?
 
Michalis Phylactou:

Thank you for your support.

I have modified the code as above.

The pop up message returns 4055

From what I see is

ERR_CUSTOM_INDICATOR_ERROR4055Custom indicator error.

Can you advise further?

Update


I have used the exact same code but instead of custom indicator I put the code in an EA and it works just fine.

Any reason why this function works with EA while not with custom indicator ?


Thank you

 
Michalis Phylactou:
...
ERR_CUSTOM_INDICATOR_ERROR4055Custom indicator error.

Can you advise further?
Yes. SendFTP() can not be used from custom indicator .
 
Alain Verleyen:
Yes. SendFTP() can not be used from custom indicator .

Ok, wasted a few hours on something so simple  :)


I see it works with script. Do you know of a way to have the indicator call a script?

I can have the indicator call the script whenever I want it to ftp the file.

 
Michalis Phylactou:

Ok, wasted a few hours on something so simple  :)

Sorry, I was thinking to show you how to figure out the problem rather than telling you the answer directly. It's documented here : Functions prohibited in Indicators and Expert Advisors.

I see it works with script. Do you know of a way to have the indicator call a script?

I can have the indicator call the script whenever I want it to ftp the file.

Yeah...not easy. You should think to use an EA.
Program Running - MQL4 programs - MQL4 Reference
Program Running - MQL4 programs - MQL4 Reference
  • docs.mql4.com
Program Running - MQL4 programs - MQL4 Reference
Reason: