importance of scripts

 

can somebody explain the meaning of scripts to me and how to write and use it?

i have read about it but did not understand it .

can it be used for auto trading?

expecting helpful reply.

 
kckeller wrote >>

can somebody explain the meaning of scripts to me and how to write and use it?

i have read about it but did not understand it .

can it be used for auto trading?

expecting helpful reply.

Script is mql object executed only once.

For automatic trading you need to create Expert Advisor

Examples are here https://www.mql5.com/en/code

 
kckeller:

can somebody explain the meaning of scripts to me and how to write and use it?

i have read about it but did not understand it .

can it be used for auto trading?

expecting helpful reply.

One example that I am aware of is launching trades. Your EA should do the evaluation of each incoming tick and determine whether the market condition meets your requirements for launching a trade. If the new quote meets your requirements, instead of launching a trade from your EA, call the script (ie launch the script). The script will run parallel to the EA (ie simultaneously) and when it has successfully launched the trade, it will cease to run. If your trade launching script has code in it that handles various errors that may be encountered in trading it may have to go into sleep mode for a short time waiting for the trade server to become available, etc. By launching a script, it is the parallel program that sleeps, not the EA. The EA will continue doing what it is intended to do and that is evaluate incoming ticks.


You can do the same thing with trade modification orders. Basically, any activity that interacts with the broker's trade server, because it will frequently encounter errors that require waiting.


cheers