What I meant with that is, since recent updates of MT5, at least, and for instance, for Brazil, the Currency Box keeps empty, and the Strategy Tester fails... I have to type - in my case BRL - in order to have it run properly... Maybe it is your case... You just have to check in what currency your Broker Signal is from...
;)
That's because if you trade PETR4 (for example), the profit currency is BRL. If you try USD, as your broker doesn't provide USDBRL conversion rate, the strategy tester is unable to calculate profit and so no trade appears.
That's why I suggested the OP to use USD, as Usa500 is I suppose using USD as profit currency. As it doesn't work, must be an other problem.
ActivTrades, demo account. Just created a fresh demo account today, cause I thought it could have something to do with the old one soon running out in 3 days.
Usually, their demo servers are very reliable. What do you think could cause "my" ST to go crazy?
Btw. looks like it doesn't matter what settings I pick, all the same:
Unfortunately I can't get a demo account on ActivTrades ("not allowed for your country"). If you provide me a login/password, I will check, otherwise I can't help.
Yes, I noticed that bug, especially in the MetaEditor -> Extras -> Options. There the currency selection always falls back to USD.
My demo account with the broker is in EUR currency. I'm pretty sure that last update (which was how long ago? A month or more?) did not have any impact on my simulations (and I was very busy with those). I have 4 machines working in parallel while one of them is nonstop daytrading.
It all started like 2-3 days ago and I dont know why..
History Usa500: load 27 bytes of history data to synchronize in 0:00:00.000
So the strategy tester is not able to generate sufficient ticks for the test. By default, if you do a optimization run, results with negative outcome will be discarded. This is why sometimes you don't get any results at all, because all of them were negative or empty (no trades).
You may need to assure the chart has enough data to run a test.
HTH
Quick update: My EA seems to have some issue with updating Global Variables, but only in that "optimization mode" of the ST. The GVs are properly updated during a single Strategy Tester run. Very weird.
Sadly, in that "optimization mode" no logs are printed within OnTick() or OnCalculate(..) regarding the employed indicator. The only debug messages seem to occur during OnInit() and OnDeinit(). Well, this is quite some challenge now.
On my machine that runs the EA nonstop (currently with outdated sources) the Strategy Tester works fine and the log shows the history of Usa500 having so few bytes there, as well. interestingly, the time for synchronization is not 0:00:00.000. Hmmmm...
NP 007:25:58.918 Startup MetaTester 5 x64 build 1940 (02 Nov 2018)
HD 007:25:58.926 Server MetaTester 5 started on 127.0.0.1:3000
PO 007:25:58.926 Startup initialization finished
NM 007:25:59.647127.0.0.1 login (build 1940)
HK 007:25:59.742 Network 3860 bytes of account info loaded
KM 007:25:59.742 Network 1482 bytes of tester parameters loaded
GH 007:25:59.742 Network 27836 bytes of input parameters loaded
MR 007:25:59.746 Network 5059 bytes of symbols list loaded
IH 007:25:59.749 Tester expert file added: Experts\Advisors\OPATraders\OPA1Trader.ex5. 540016 bytes loaded
MF 007:25:59.749 Tester program file added: Indicators\VIX_Indicator\VIX_Indicator.ex5. 27292 bytes loaded
HO 007:25:59.749 Tester program file added: Indicators\OptimisticPessimisticArea\OPAIndicator.ex5. 142389 bytes loaded
NP 007:25:59.749 Network 37968 bytes of optimized inputs info loaded
CI 007:25:59.755 Tester successfully initialized
JL 007:25:59.755 Network 718 Kb of total initialization data received
HE 007:25:59.755 Tester Intel Core i5-5300U @ 2.30GHz, 16259 MB
NN 007:25:59.756 Tester optimization pass 0 started (batch of 3 tasks)
JD 007:25:59.818 Symbols Usa500: symbol to be synchronized
CL 007:25:59.818 Symbols Usa500: symbol synchronized, 3864 bytes of symbol info received
DR 007:25:59.849 History Usa500: load 27 bytes of history data to synchronize in0:00:00.016
LG 007:25:59.849 History Usa500: history synchronized from2017.04.03 to 2018.02.01
RJ 307:25:59.851 Tester Usa500: start time changed to 2017.04.0800:00 to provide data at beginning
KN 007:25:59.851 History Usa500,H1: history cache allocated for13062 bars and contains 115 bars from2017.04.0300:00 to 2017.04.0722:00
FS 007:25:59.851 History Usa500,H1: history begins from2017.04.0300:00
GG 007:25:59.938 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Execution mode: SYMBOL_TRADE_EXECUTION_REQUEST
GF 007:25:59.938 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 The account of the client <....>
FM 007:25:59.938 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Account currency - EUR, MarginCall and StopOut levels are setin percentage
HL 007:25:59.938 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 MarginCall=70, StopOut=50
DL 007:25:59.938 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Using regular Trailing stop loss mechanism.
DD 007:25:59.943 Symbols UsaVixJan19: symbol to be synchronized
CP 007:25:59.943 Symbols UsaVixJan19: symbol synchronized, 3464 bytes of symbol info received
GM 007:25:59.962 History UsaVixJan19: load 37 bytes of history data to synchronize in0:00:00.016
QE 007:25:59.962 History UsaVixJan19: history synchronized from2016.01.04 to 2018.02.01
NK 007:26:00.063 VIX_Indicator (UsaVixJan19,H1) 2017.04.0800:00:00 [VIX-Indicator:] Initializing on period H1
QF 007:26:00.067 History UsaVixJan19,H1: history cache allocated for13062 bars and contains 1229 bars from2016.01.0400:00 to 2017.04.0722:00
QH 007:26:00.067 History UsaVixJan19,H1: history begins from2016.01.0400:00
RL 007:26:00.186 OPAIndicator (Usa500,H1) 2017.04.0800:00:00 OPA-Indicator successfully initialized.
LR 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Initializing indicator 'MovingAverage' on period H1
NL 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Execution mode: SYMBOL_TRADE_EXECUTION_REQUEST
CE 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 The account of the client <.....>
JR 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Account currency - EUR, MarginCall and StopOut levels are setin percentage
HO 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 MarginCall=70, StopOut=50
DM 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Using regular Trailing stop loss mechanism.
RJ 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Number of deals in position: 0
KI 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Number of buy deals: 0
KP 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Number of sell deals: 0
RL 007:26:00.186 OPA1Trader (Usa500,H1) 2017.04.0800:00:00 Last deal in current position: 1970.01.0100:00:00
FH 007:26:00.600 Symbols EURUSD: symbol to be synchronized
OQ 007:26:00.600 Symbols EURUSD: symbol synchronized, 3544 bytes of symbol info received
HQ 007:26:01.202 History EURUSD: load 27 bytes of history data to synchronize in0:00:00.000
EF 007:26:01.202 History EURUSD: history synchronized from2016.01.03 to 2018.02.01
HG 007:26:23.573 Tester 0 : passed in0:00:23.765 (history synchronized in0:00:00.609)
...
IH 007:26:45.455 Tester 1 : passed in0:00:21.875
...
CJ 007:26:54.976 Tester 2 : passed in0:00:09.500
...
CH 007:26:54.988 Tester 3 of 3 passes processed (3 successfully finished) in0:00:55.140, history synchronized in0:00:00.609
OD 307:26:54.999127.0.0.1 MetaTester 5 forced to stop
HQ 007:32:22.866 Server MetaTester 5 stopped
Found out that my signal indicator is only placing its signal (per bar) into a global variable (GV) when the strategy tester is being run in visualization mode.
When visualization is checked off and the ST is run either with a single parameter set or an array of parameters for optimization, the EA (OPA1Trader) only obtains zero values.
Technically I realized the communication between the OPA1Trader and the OPAIndicator via global variables. In my codebase, I cannot find any changes that could relate to the problem. So far, this mechanism has been working for over a year without a problem.
As you can see, when I start a single simulation (with visualization off, timespan: 2018.03.13 - 2018.03.23) the following logs show that a signal is properly computed until to the date where the simulation should actually start (March 13th); after that the indicator no more places its signal into a global variable. Again, when I use the strategy tester with visualization on the signals come properly and the bot is trading just fine.
QR 010:31:58.540 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 [OPA-1-EA:] Initializing OPA Global variable utility class with OPA indicator handle.
GL 010:31:58.540 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 Initializing OPA Global variable helper ...
JQ 010:31:58.540 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 ... with OPA indicator handle!
HG 010:31:58.569 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 [OPA1-Indicator:] Initializing on Symbol Usa500, Period H1.
GE 010:31:58.569 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 [OPA1-Indicator:] Initializing OPA Global variable utility class without OPA indicator handle.
ER 010:31:58.569 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Initializing OPA Global variable helper ...
CF 010:31:58.569 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 ... without OPA indicator handle.
NH 010:31:58.569 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 [OPA1-Indicator:] Successfully initialized!
RG 010:31:58.569 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 ... Success. OPA indicator handle obtained.
KN 010:31:58.569 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 Initializing indicator 'MovingAverage' on period H1
NO 010:31:58.569 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 MA indicator successfully initialized.
PO 010:31:58.569 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 Initializing CandleSizeIndicator on period H1 for symbol 'Usa500'.
CK 010:31:58.589 OPA1Trader (Usa500,H1) 2018.03.1300:00:00 [OPA-1-EA:] Successfully initialized.
QM 010:31:58.627 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2017.04.0415:00
.. . ............ ............ ......... ................... .................................................
OE 010:31:58.627 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2017.04.0714:00
RG 010:31:58.627 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 1.0for time: 2017.04.1009:00
RF 010:31:58.627 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2017.04.1011:00
.. . ............ ............ ......... ................... .................................................
HP 010:31:58.628 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2017.04.2622:00
MR 010:31:58.628 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 1.0for time: 2017.04.2707:00
.. . ............ ............ ......... ................... .................................................
FO 010:31:58.628 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: -1.0for time: 2017.05.0106:00
GP 010:31:58.628 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 1.0for time: 2017.05.0205:00
FJ 010:31:58.628 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 1.0for time: 2017.05.0213:00
.. . ............ ............ ......... ................... .................................................
DS 010:31:58.632 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: -1.0for time: 2018.02.1412:00
DL 010:31:58.632 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2018.02.1414:00
.. . ............ ............ ......... ................... .................................................
KE 010:31:58.632 OPAIndicator (Usa500,H1) 2018.03.1300:00:00 Setting GV signal: 0.0for time: 2018.03.1221:00
QR 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1301:00:00 Fetching GV signal: 0.0
GS 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1301:00:00 Received signal: 0.0
OF 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1301:00:00 Received timeOfSignal: 1970.01.0100:00
EK 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1302:00:00 Fetching GV signal: 0.0
KR 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1302:00:00 Received signal: 0.0
DE 010:31:58.638 OPA1Trader (Usa500,H1) 2018.03.1302:00:00 Received timeOfSignal: 1970.01.0100:00
OF 010:31:58.639 OPA1Trader (Usa500,H1) 2018.03.1303:00:00 Fetching GV signal: 0.0
IQ 010:31:58.639 OPA1Trader (Usa500,H1) 2018.03.1303:00:00 Received signal: 0.0
NS 010:31:58.639 OPA1Trader (Usa500,H1) 2018.03.1303:00:00 Received timeOfSignal: 1970.01.0100:00
.. . ............ .......... ......... ................... ........ ..............................
GS 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2221:00:00 Fetching GV signal: 0.0
KG 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2221:00:00 Received signal: 0.0
LH 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2221:00:00 Received timeOfSignal: 1970.01.0100:00
KN 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2223:00:00 Fetching GV signal: 0.0
GP 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2223:00:00 Received signal: 0.0
DJ 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2223:00:00 Received timeOfSignal: 1970.01.0100:00
FG 010:31:58.690 Tester final balance 25000.00 EUR
JK 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2223:59:59 The 'OPA1Trader' program has been removed from the chart.
IG 010:31:58.690 OPA1Trader (Usa500,H1) 2018.03.2223:59:59 [OPA-1-EA:] De-Initialization OPA1-Trader.
(the lines with "..." indicate that there are dozens more lines inbetween, all with similar values)
Did anyone of you have similar good/bad experiences with global variables? Did the last MQL5 update change something in this respect?
I can now go ahead and just fetch the signals with CopyBuffer, but I think during strategy tester there was a nasty delay of 1 additional bar. Correct me if I'm wrong here.
And again, thanks for any input. It is really nice to see how some friendly people seem to be here reguarly checking to help. Really, much appreciated :)
MQL5: Added the new property for custom indicators #property
tester_everytick_calculate. It is used in the strategy tester and allows
for forced indicator calculation at each tick.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
What I meant with that is, since recent updates of MT5, at least, and for instance, for Brazil, the Currency Box keeps empty, and the Strategy Tester fails... I have to type - in my case BRL - in order to have it run properly... Maybe it is your case... You just have to check in what currency your Broker Signal is from...
;)
That's because if you trade PETR4 (for example), the profit currency is BRL. If you try USD, as your broker doesn't provide USDBRL conversion rate, the strategy tester is unable to calculate profit and so no trade appears.
That's why I suggested the OP to use USD, as Usa500 is I suppose using USD as profit currency. As it doesn't work, must be an other problem.
ActivTrades, demo account. Just created a fresh demo account today, cause I thought it could have something to do with the old one soon running out in 3 days.
Usually, their demo servers are very reliable. What do you think could cause "my" ST to go crazy?
Btw. looks like it doesn't matter what settings I pick, all the same:
Yes, I noticed that bug, especially in the MetaEditor -> Extras -> Options. There the currency selection always falls back to USD.
My demo account with the broker is in EUR currency. I'm pretty sure that last update (which was how long ago? A month or more?) did not have any impact on my simulations (and I was very busy with those). I have 4 machines working in parallel while one of them is nonstop daytrading.
It all started like 2-3 days ago and I dont know why..
Sounds great, Alain. I'll PM you directly.
Did you try a simple backtesting ?
I tried ExpertMACD.ex5 on Usa500, and it doesn't trade because there are always an error :
2019.01.09 17:21:48.918 Core 1 2018.11.07 08:14:00 CTrade::OrderSend: market sell 0.01 Usa500 sl: 2761.45 tp: 2760.75 [invalid stops]
On EURUSD it works.
EDIT: With one of my EA (well coded ;-) it takes trades without problem on Usa500
2019.01.09 17:28:57.792 Core 1 2018.11.08 23:59:59 order performed buy 0.10 at 2805.52 [#11 buy 0.10 Usa500 at 2805.52]
2019.01.09 17:28:57.792 Core 1 final balance 10243.34 EUR
Yes, I can confirm the invalid stops here. Thanks for looking into it!
I guess, I should check out which of the single runs of my own EA (that lead to the ST to utterly fail) is having some error then.
Thank you again!
Quick update: My EA seems to have some issue with updating Global Variables, but only in that "optimization mode" of the ST. The GVs are properly updated during a single Strategy Tester run. Very weird.
Sadly, in that "optimization mode" no logs are printed within OnTick() or OnCalculate(..) regarding the employed indicator. The only debug messages seem to occur during OnInit() and OnDeinit(). Well, this is quite some challenge now.
Regarding your hint @lippmaje:
On my machine that runs the EA nonstop (currently with outdated sources) the Strategy Tester works fine and the log shows the history of Usa500 having so few bytes there, as well. interestingly, the time for synchronization is not 0:00:00.000. Hmmmm...
Found out that my signal indicator is only placing its signal (per bar) into a global variable (GV) when the strategy tester is being run in visualization mode.
When visualization is checked off and the ST is run either with a single parameter set or an array of parameters for optimization, the EA (OPA1Trader) only obtains zero values.
Technically I realized the communication between the OPA1Trader and the OPAIndicator via global variables. In my codebase, I cannot find any changes that could relate to the problem. So far, this mechanism has been working for over a year without a problem.
As you can see, when I start a single simulation (with visualization off, timespan: 2018.03.13 - 2018.03.23) the following logs show that a signal is properly computed until to the date where the simulation should actually start (March 13th); after that the indicator no more places its signal into a global variable. Again, when I use the strategy tester with visualization on the signals come properly and the bot is trading just fine.
(the lines with "..." indicate that there are dozens more lines inbetween, all with similar values)
Did anyone of you have similar good/bad experiences with global variables? Did the last MQL5 update change something in this respect?
I can now go ahead and just fetch the signals with CopyBuffer, but I think during strategy tester there was a nasty delay of 1 additional bar. Correct me if I'm wrong here.
And again, thanks for any input. It is really nice to see how some friendly people seem to be here reguarly checking to help. Really, much appreciated :)
Cheers,
AT
Probably related to this :
MQL5: Added the new property for custom indicators #property tester_everytick_calculate. It is used in the strategy tester and allows for forced indicator calculation at each tick.