- Please edit your post and use the </> (Alt-S) for your code sample. Don't just paste code as plain text. It makes the code difficult to read.
- MessageBox() function does not work in the Strategy Tester.
- Comment() will only apear on the chart when testing in Visual Mode.
- Print() will apear in the tester's Journal log, but only for single tests. It will not appear during optimisations.
- Timer and ChartEvent events are not handled in the MT4 Strategy Tester.
- docs.mql4.com
- Please edit your post and use the </> (Alt-S) for your code sample. Don't just paste code as plain text. It makes the code difficult to read.
- MessageBox() function does not work in the Strategy Tester.
- Comment() will only apear on the chart when testing in Visual Mode.
- Print() will apear in the tester's Journal log, but only for single tests. It will not appear during optimisations.
- Timer and ChartEvent events are not handled in the MT4 Strategy Tester.
Thank you Fernando. I appreciate your help.
Now I understand it a little bit better. :)
- Please edit your post and use the </> (Alt-S) for your code sample. Don't just paste code as plain text. It makes the code difficult to read.
- MessageBox() function does not work in the Strategy Tester.
- Comment() will only apear on the chart when testing in Visual Mode.
- Print() will apear in the tester's Journal log, but only for single tests. It will not appear during optimisations.
- Timer and ChartEvent events are not handled in the MT4 Strategy Tester.
Hello Fernando,
Now I changed the code. However, I do not see any note when it is running in the strategy tester. How can someone test an EA, when the signals wished to be shown are nowhere listed or recorded.
I also changed the EventSetTimer to 15 sec or 1,800 sec. Nothing changes. I also do not use optimization, but use the virtual mode.
I would like to see something like this:
Time Messages
2022.12.06 22:20:00 CHECK
2022.12.06 22:2x:xx CHECK
2022.12.06 22:2x:xx CHECK
#property strict int OnInit() { EventSetTimer(1800); Comment ("CHECK"); Print ("CHECK"); return(INIT_SUCCEEDED); } // expert deinitialization function void OnDeinit(const int reason) { } // expert tick function void OnTick() { } // timer function void OnTimer() { return;
No such problem on my test with your code. Are you looking at the Strategy Tester Journal log?
Also, I have already stated that Timer Events are not simulated in in MT4 Strategy Tester, so setting EventSetTimer has no effect on the tester.
No such problem on my test with your code. Are you looking at the Strategy Tester Journal log?
Also, I have already stated that Timer Events are not simulated in in MT4 Strategy Tester, so setting EventSetTimer has no effect on the tester.
Dear Fernando,
Perfect. Thank you a lot. Now, I see it better. At the same time, I am looking for a real log book.
I used the following code for BTCUSD, which also can be run on the weekend. However, there is no log book/journal available which shows when the close of candle 1 is higher or lower than the close of candle 2.
Is there anywhere aa log book, showing an overview/list like this for e.g.:
Time Messages
2022.12.xx 20:1x:xx short
2022.12.xx 21:1x:xx short
2022.12.xx 22:1x:xx long
#property strict double closex; double closey; int x; int y; int OnInit() { return(INIT_SUCCEEDED); } // expert deinitialization function void OnDeinit(const int reason) { } // expert tick function void OnTick() { } // timer function void OnTimer() { EventSetTimer(3600); x=1; y=x+1; closex = iClose(Symbol(),Period(),x); closey = iClose(Symbol(),Period(),y); if (closex > closey) { Comment ("long"); Print ("long"); } else Comment ("short"); Print ("short"); return; }
On live trading, the Print() output appears in the Experts log, not the Journal log.
On live trading, the Print() output appears in the Experts log, not the Journal log.
Hello Fernando,
Somehow I do not understand fully the testing, neither live nor backtesting. However, I changed the code and with your advice to look on the "Experts" the signals appeared every 15 sec.
This gives me the chance to continue.
Thank you so much.
#property strict double closex; double closey; int x; int y; int OnInit() { EventSetTimer(15); return(INIT_SUCCEEDED); } // expert deinitialization function void OnDeinit(const int reason) { } // expert tick function void OnTick() { } // timer function void OnTimer() { x=1; y=x+1; closex = iClose(Symbol(),Period(),x); closey = iClose(Symbol(),Period(),y); if (closex > closey) { Comment ("long"); Print ("long"); } else Comment ("short"); Print ("short"); return; }
- 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 everyone,
I would appreciate your help since I am not so familiar with mql4.
Thank you in advance.
My goal:
To show the message "CHECK" somewhere when testing in the strategy tester.
I run the code several times in several time frames and markets. Nevertheless, the message was not shown in the:
1) journal, report or results of the tester
2) journal, expert, alerts, mailbox, news of the terminal
3) log files
However, when the code was running live, it worked and I got a message every 15 secs.
And exactly, this ("CHECK") is what I want to see to figure out if the code works over a longer period of time.