Anyone here know how to call a script from an EA ?
if (TimeCurrent() > UpdateFiles) {
"RUN THE UPDATE SCRIPT HERE";
}
Thanks,
KK
if (TimeCurrent() > UpdateFiles) {
"RUN THE UPDATE SCRIPT HERE";
}
Thanks,
KK
Keep it simple stoopid....
Basic Alt Key/Entry Script - Simplest Script Ever 1 reply
MT4 script help 2 replies
i like to add an indicator script into my own script. what would be the best idea? 3 replies
Candelstick script 2 replies
Help with using a script in Metatrader 6 replies
DislikedAnyone here know how to call a script from an EA ?
if (TimeCurrent() > UpdateFiles) {
"RUN THE UPDATE SCRIPT HERE";
}
Thanks,
KKIgnored
DislikedYou can assign a hotkey to your script, and then have your EA simulate 'pressing' the hotkey which will trigger your script to run as a process outside of your EA. That way the EA and the script are independent of each other.
This should give you a 'poor mans' version of multi threading in Metatrader.
There are script for 'pressing' keys throughout the forum.
-JuanIgnored
DislikedJust out of morbid curiousity, why would you want to run a script?
Wouldn't you be better off moving your logic from your script into a single function in a library file, and then importing the file in a script (for 1 time usage) and into an EA (for per tick analysis)?
Is there something a script can do that an EA can't?
(I guess this is the programmer in me talking...use libraries and import when necessary)Ignored
DislikedThere was another thread where someone wanted to do something similar. I asked the poster the same thing "why not just use an include file", he told me that his script could take a while to do its logic and he potentially wanted it to run several times in a loop for a specified period of time.
I.e. The EA fires off the script when the price gets to a certain point, the script then runs for the next 60 seconds constantly looking for followup signals.
There can be other clever uses for firing off a script in this fashion. Metatrader is surprisingly robust for these sorts of things.Ignored
DislikedI use FILES to pass parameters between EA/Script/Indicators around.
ie.
I have all the EA, Scripts running in place already. The slave process in standby. When the master EA wants to call or have the script process something, it will create a file with all the parameters therein. The Script opens the file and process accordingly.
With this method, I can have as many EA running around; I can have my Charts focused or unfocused or even minimized.
One of the simple EA-Script combo i use is an Audible+Email Alarm Script.
Hotkey sounds simpler. But I wonder if it would work if your charts is not focused? ie, you want it to execute on GBPUSD but the chart on focus is USDJPY.Ignored