Hello
I want to emphasize at the outset that I am a novice in mql5.
I have the following problem:
- I just wish my expert system exported my data to a txt file every minute but exactly on time 55 seconds, eg 1.55, 2.55, 3.55 and so on. I do not want to use the onTick section because not every second transaction is realized, I need timer or something else. So far, I used to schedule tasks with the following vbs file:
f7 run compiler with own indicator.
but it is a very ineffective way.
Further when the export file is closed MQL runs the bat file.
Thank for your help.
Have you seen the OnTimer( ) event handler ?
Hello
I want to emphasize at the outset that I am a novice in mql5.
I have the following problem:
- I just wish my expert system exported my data to a txt file every minute but exactly on time 55 seconds, eg 1.55, 2.55, 3.55 and so on. I do not want to use the onTick section because not every second transaction is realized, I need timer or something else. So far, I used to schedule tasks with the following vbs file:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShell = CreateObject("WScript.Shell")
rem oShell.SendKeys "% (s)"
WshShell.AppActivate "metaeditor"
WshShell.SendKeys "{f7}"
WshShell.SendKeys "^s"
oShell.SendKeys "% (m)"
f7 run compiler with own indicator.
but it is a very ineffective way.
Further when the export file is closed MQL runs the bat file.
Thank for your help.
You can use the timer events, as suggested by Malacarne. However, the timer can run your code every minute, there is no way to control when it start, so you cannot be sure to run it at 1.55, 2.55, etc...
I let you think about that. Feel free to ask if you can't find how to deal with that
Hello
I want to emphasize at the outset that I am a novice in mql5.
I have the following problem:
- I just wish my expert system exported my data to a txt file every minute but exactly on time 55 seconds, eg 1.55, 2.55, 3.55 and so on. I do not want to use the onTick section because not every second transaction is realized, I need timer or something else. So far, I used to schedule tasks with the following vbs file:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShell = CreateObject("WScript.Shell")
rem oShell.SendKeys "% (s)"
WshShell.AppActivate "metaeditor"
WshShell.SendKeys "{f7}"
WshShell.SendKeys "^s"
oShell.SendKeys "% (m)"
f7 run compiler with own indicator.
but it is a very ineffective way.
Further when the export file is closed MQL runs the bat file.
Thank for your help.
Use OnTimer() with EventSetTimer(1).
The following code is a solution to lack of control the first entry that does not have to coincide with start of bar
void OnTimer() { int static contTime= 0; contTime= newBar(PERIOD_M1)? 0: contTime++; if(contTime==55) make... return; }
Use OnTimer() with EventSetTimer(1).
The following code is a solution to lack of control the first entry that does not have to coincide with start of bar
And what if there is a missing bar ?
The deformation of the programmer... who strives for perfection.
What do you do working at this hour?
The deformation of the programmer... who strives for perfection.
What do you do working at this hour?
I will try once again to present my plan
I need a way to export the data and run the bat file in the specified time, for example 12.00.55, 12.01.55 As I wrote earlier.
I have a few ideas:
-so far I've done this using a vbs script to run the compiler metaedytor that run indicator that exported the data and run the bat file.
Maybe exist another way to do it e.g.
*expert advisor to compile indicator at a specific time (if this is possible!)
*expert advisor for a specific time exports data and runs the bat file.
*for example, a java program using the communication interface MetaEditor (if there is) run indicator.
-I also tried to run the bat file: "C:\Program Files\FxPro - MetaTrader 4\mql.exe" "C:\Program Files\FxPro - MetaTrader 4\MQL4\Indicators\testW2.mq4" /i:"C:\Program Files\FxPro - MetaTrader 4\MQL4" but does not work!.
I have no more ideas
I am a beginner in MQL (general in programming also) so please write as simple as possible with full progrma (not clippings).
I am very grateful for any help.
I am positively surprised by the fast response :) Really !!!
I will try once again to present my plan
I need a way to export the data and run the bat file in the specified time, for example 12.00.55, 12.01.55 As I wrote earlier.
I have a few ideas:
-so far I've done this using a vbs script to run the compiler metaedytor that run indicator that exported the data and run the bat file.
Maybe exist another way to do it e.g.
*expert advisor to compile indicator at a specific time (if this is possible!)
*expert advisor for a specific time exports data and runs the bat file.
*for example, a java program using the communication interface MetaEditor (if there is) run indicator.
-I also tried to run the bat file: "C:\Program Files\FxPro - MetaTrader 4\mql.exe" "C:\Program Files\FxPro - MetaTrader 4\MQL4\Indicators\testW2.mq4" /i:"C:\Program Files\FxPro - MetaTrader 4\MQL4" but does not work!.
I have no more ideas
I am a beginner in MQL (general in programming also) so please write as simple as possible with full progrma (not clippings).
I am very grateful for any help.
You already received an answer on how to run a code every minute within mql5 (also valid for mql4), so what is the problem to use it ? Maybe the solution isn't clear enough ?
Really, I don't understand why you are asking again when you already got a response.
Please also note the following...
Forum on trading, automated trading systems and testing trading strategies
Hello,
This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.
- They are more people who can answer there.
- They are more people who can have similar problem there.
- A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.
I understand you but the solution was not satisfactory for me and I wanted to better explain the problem.
I think my program is better.
void OnTimer() { string tts = TimeToStr(TimeLocal(), TIME_SECONDS); string ttss = StringSubstr(tts,6,-2); long ttssi = StringToInteger(ttss); //int static contTime = 0; // if (PERIOD_M1 == 0) contTime = 0; else if (ttssi == 55) ShellExecuteW(0,0,"____experbat.bat","","d:\\fx\\code\\",1) ; Print("--",ttssi ); return; }Please evaluate them.
I have another question
it is possible that an expert advisor called (compile) indicator?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I want to emphasize at the outset that I am a novice in mql5.
I have the following problem:
- I just wish my expert system exported my data to a txt file every minute but exactly on time 55 seconds, eg 1.55, 2.55, 3.55 and so on. I do not want to use the onTick section because not every second transaction is realized, I need timer or something else. So far, I used to schedule tasks with the following vbs file:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShell = CreateObject("WScript.Shell")
rem oShell.SendKeys "% (s)"
WshShell.AppActivate "metaeditor"
WshShell.SendKeys "{f7}"
WshShell.SendKeys "^s"
oShell.SendKeys "% (m)"
f7 run compiler with own indicator.
but it is a very ineffective way.
Further when the export file is closed MQL runs the bat file.
Thank for your help.