You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It would never trade if I had to wait that long, that's the point of using so many sessions! Obviously each of my EAs sleep for a few milliseconds when "IsTradeContextBusy() == true", but it would never trade if I ran 30. That's why I run three EAs in 50, most of which go bankrupt, and so I need to create new demo accounts too.
Anyway, perhaps you could help me with another question. I have a very simple script which outputs my trades, (outputResults) and I would like to run it once per day. Is there an intelligent way of making it run automatically at say 9am? I could just keep checking the time, and then have it run when the current time equals 9am. But that seems like a huge waste of cpu time, I was wondering if there was something more clever.
Perhaps sleep(), seems you're already familiar with this function. Have it sleep for 24 hours. WHRoeder have posted really good examples of these in the past. I don't have a link handy. Perhaps you could do a search on the forum. Good-Trading.
-Zen-
I like that idea! But do the scripts interfere with the processing threads? Is there a more direct way of triggering the scripts outside the "sand-boxed" MT4 environment?
I am not a commercial undertaking (!), just a guy trying to scalp the forex market! I decided to run 50 different variations of my strategy to see if I could map the volatility over the week. A lot of my strategies work one day and then collapse afterwards... Believe me, trying to load MT4 50 times on your own home-made computer is really painful... anyway, hopefully someone else will be nice enough to give me some hints.
Oh, okay then...
The easiest way to control, from outside MT4, which symbols and EAs are loaded at startup is to create/modify/overwrite the chart .chr files (usually in profiles\default, unless you switch profile). The only issue with this is different symbol-naming on different brokers. A chart file for EURUSD won't work (without modification) on a broker using a naming convention such as EURUSDFXF, EURUSDcx etc.
As 7bit is saying, the only way of launching a script from outside MT4 is to have something running within MT4 which listens for some sort of signal, and then uses the nasty undocumented methods such as https://www.mql5.com/en/forum/115967 for launching a script.
However, in your example of a script which runs once per day, I can't see why you don't just write it as an EA which watches the current time and only does anything once per day. The processor usage is going to be utterly trivial, not "a huge waste of cpu time".
[...] Is there any way to specify which currencies and EAs would run in each session of MT4 from the command-line? On a separate note, is it possible to launch an MT4 script from the command-line, while MT4 is already running? [...]
vgoklani:
I run several (50+) sessions of MT4 simultaneously, and I find the process of individually opening each MT4 with 3+ EAs to be quite tedious. Is there any way to specify which currencies and EAs would run in each session of MT4 from the command-line? On a separate note, is it possible to launch an MT4 script from the command-line, while MT4 is already running?