Is there a function for executing this chart/indicator or EA every minute on second "00" even though there is not tick?
I´m a newbie to MT4, so there are a lot of features that I may miss...
A new bar is starting with the first tick when there is no tick there is no new bar
so if there is no data at "00" then there is no "Do Event" command in MetaTrader
The CurrentTime of your broker is not displaying every second...
A new bar is starting with the first tick when there is no tick there is no new bar
so if there is no data at "00" then there is no "Do Event" command in MetaTrader
The CurrentTime of your broker is not displaying every second...
Thank you for your replies...
But If I use for ex. "CHFJPY", there is a tick every minute (somewhere), then I could hold on to that tick and force MT4 to wait for a new minute. When a new minute begins I read all data for the previous minute (for all diffrent quotes) and Export it to MySQL. This works but MT4 freezes during my WHILE-loop and thats why I want to "Do Events" while waiting for a new minute.
I don´t use brokertime I use systemtime...
Any Ideas?
Thank you for your replies...
But If I use for ex. "CHFJPY", there is a tick every minute (somewhere),
Not always, sometimes there will be no ticks maybe for more than a minute . . other times there will be many ticks for each minute.
Yes, But if I choose a symbol/quote with a high frequenze of trading, there will often be a tick somwhere during one the one minute period.
And when I get a tick:
currSec = (59 - (TimeLocal()-(TimeMinute(TimeLocal())*60)));
time_waiting = TimeLocal() + currSec;
while ( TimeLocal() <= time_waiting ) {
// Do Events...
}
// Reading all quotes and export to MySQL
Yes, But if I choose a symbol/quote with a high frequenze of trading, there will often be a tick somwhere during one the one minute period.
And when I get a tick:
currSec = (59 - (TimeLocal()-(TimeMinute(TimeLocal())*60)));
time_waiting = TimeLocal() + currSec;
while ( TimeLocal() <= time_waiting ) {
// Do Events...
}
// Reading all quotes and export to MySQL
But is there something I can use like a "Do Events" function or someting else preventing MT4 to freeze.
But is there something I can use like a "Do Events" function or someting else preventing MT4 to freeze.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I´m a newbie to MT4, so there are a lot of features that I may miss...
Background:
I export all the quotes to a MySQL-database, when a new minute/bar occurs. But there is a problem...
If the new minute/bar tick will occur at 12:10:00 (HH:MM:SS) that would be perfect, but the new minute/tick could occur at 12:10:15, then I´m delayed by 15 seconds.
Because I´m lazy/smart/dumb?, I´ve done all the "export to MySQL" in ONE CHART with ONE SCRIPT to all the quotes (about 23 quotes). I have a rollover function that fixes "S&P500-SEP11" to "S&P500DEC" and so on (when it occurs).
Otherwise I could have a script for every chart and export every tick, then I shouldn´t have this problem. But because I´m in to futures and I don´t want to remove and apply my script everytime a rollover occur, I have to make a function that executes every new minute on second "00".
Right now I apply my Indicator/scipt on a forexchart "CHFJPY". I use this only because there is a lot of trading.
I could do a WHILE-loop (this works), but then MetaTrader freezes for 59.99 seconds every minute :)
My questions:
Is there a "Do Event" command in MetaTrader?
Is there a "Hey let´s do this waiting in another thread" and let MetaTrader work normally in the main thread?
I´ve been reading a lot of forums (and done some other programming) and my conclution is if I change my script from beeing and indicator to an EA (I know nothing about EA yet) and using "Sleep" it would freeze everyting like my WHILE-loop or is this a better way?
Is there a function for executing this chart/indicator or EA every minute on second "00" even though there is not tick?
Sorry for my poor language...