Strategy Tester shows zero results on my EA - SOLVED: Add #property tester_everytick_calculate to EA + indicator - page 2
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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.