Download MetaTrader 5

Add script to chart by attaching EA (automatically)

To add comments, please log in or register
fx_ta
60
fx_ta 2013.06.14 21:11 

Hi all

How can I attach a script to chart within the init-part of an EA? I've always a coresponding script to each EA I need to attach.

Thanks for help.

Best Regards,

FX_TA

Alain Verleyen
Moderator
31085
Alain Verleyen 2013.06.14 21:16  
fx_ta:

Hi all

How can I attach a script to chart within the init-part of an EA? I've always a coresponding script to each EA I need to attach.

Thanks for help.

Best Regards,

FX_TA

I was answering you when you deleted your first topic. Now I forgot what I was saying...
fx_ta
60
fx_ta 2013.06.14 22:48  

ok... thanks for the information, but it doesn't help me to solve my issue... :-)

I hope someone can help me.

Best regards

FX_TA

Alain Verleyen
Moderator
31085
Alain Verleyen 2013.06.14 22:50  
fx_ta:

ok... thanks for the information, but it doesn't help me to solve my issue... :-)

I hope someone can help me.

Best regards

FX_TA

There is no need to run a script you have already an EA on a chart. Write an include file or a library and use it in your script and in your EA.
fx_ta
60
fx_ta 2013.06.14 23:13  

I know that solution, but it doesn't help me for my problem. I would like regulary send own created files to a FTP server. These logfiles can be reach a size of about 5 MB (I could control the file size, but I don’t like to get smaller, but more files). Sending that file during few seconds. If I realize that with include the program “doesn’t go the next codeline” until the SendFTP function returns successful/error. I implemented a solution with scripts because a separate thread is sending the files which not influences the EA processing.

I don’t see that I can solve that issue with includes or library. Please advise me if I’m wrong.

Documentation on MQL5: Common Functions / SendFTP
Documentation on MQL5: Common Functions / SendFTP
  • www.mql5.com
Common Functions / SendFTP - Documentation on MQL5
Alain Verleyen
Moderator
31085
Alain Verleyen 2013.06.14 23:23  
fx_ta:

I know that solution, but it doesn't help me for my problem. I would like regulary send own created files to a FTP server. These logfiles can be reach a size of about 5 MB (I could control the file size, but I don’t like to get smaller, but more files). Sending that file during few seconds. If I realize that with include the program “doesn’t go the next codeline” until the SendFTP function returns successful/error. I implemented a solution with scripts because a separate thread is sending the files which not influences the EA processing.

I don’t see that I can solve that issue with includes or library. Please advise me if I’m wrong.

You are right if you need 2 threads that doesn't help. I don't think you can start a script from an EA. But do you really need the script on the same chart ? You can have a chart with a running script (or EA) to send your files, and your trading EA on another chart.

fx_ta
60
fx_ta 2013.06.14 23:30  

yes, that's right with a second EA. I was thinking about that, but the solution with the script was the better solution for me (personal opinion), because there is always a corresponding script to an EA. That mean 5 EA's = 5 different scripts. But maybe I have to think about again and redesign/implement one EA which handle all the files from the "6 trading EA's". Attach EA and Script to the chart manually is not a good option.

 Thank you very much for that discussion. 

Alain Verleyen
Moderator
31085
Alain Verleyen 2013.06.14 23:33  
You are welcome. Tell us if you find a better way, but in my opinion the best solution is to have 1 script (or EA) to send all your files.
Simon Gniadkowski
Moderator
18002
Simon Gniadkowski 2013.06.14 23:56  
fx_ta:

yes, that's right with a second EA. I was thinking about that, but the solution with the script was the better solution for me (personal opinion), because there is always a corresponding script to an EA. That mean 5 EA's = 5 different scripts. But maybe I have to think about again and redesign/implement one EA which handle all the files from the "6 trading EA's". Attach EA and Script to the chart manually is not a good option.

 Thank you very much for that discussion. 

Find an FTP application that you can configure to send any file of a certain name in a certain directory,  when you want the EA to initiate the send all it would need to do is use FileMove() to rename the file,  the FTP application does the rest.
fx_ta
60
fx_ta 2013.06.15 09:28  

Thanks for your input RaptorUK. That's also a good idea.  Obviously I was too focused designing a great solution with MQL5. :-) My belive was, that there is a solution to attach scripts. It works very great with SendFTP. I point I need to controll is any check that all the files I have created will be delivered without any error to the FTP server. I have implemented a control log for that. But I think I will find a good solution to check that also with another tool. I will think about that, depending on the solution I will choose.

To add comments, please log in or register