-
"::Files …"
You added your wave to your EA as a resource. It is part of your EA, therefor it is in RAM (times how many copies of the EA you are running.) - Try moving the file to the terminal's Sound directory (e.g. "C:\Program Files (x86)\OANDA - MetaTrader\Sounds") and just call PlaySound("file.wav");
- You added your wave to your EA as a resource. It is part of your EA, therefor it is in RAM (times how many copies of the EA you are running.)
- Try moving the file to the terminal's Sound directory (e.g. "C:\Program Files (x86)\OANDA - MetaTrader\Sounds") and just call PlaySound("file.wav");
Indeed, it is a resource, but it is only 421 Kb, no 1 or 2Gb, and the indicator is only called once, so at best it would cost 850 Kb of RAM (there are actually two sound files of around the same size). Plus, it is a resource independently if I set to play them or not, so the RAM consumption should be static regarding if the play sound option was enabled or not. Given that, I hardly think moving it to the terminal's Sound directory will change anything. Plus, this is a potential Market product, so the sound must go along the indicator as a resource, which means that doesn't count as a viable solution.
Indeed, it is a resource, but it is only 421 Kb, no 1 or 2Gb, and the indicator is only called once, so at best it would cost 850 Kb of RAM (there are actually two sound files of around the same size). Plus, it is a resource independently if I set to play them or not, so the RAM consumption should be static regarding if the play sound option was enabled or not. Given that, I hardly think moving it to the terminal's Sound directory will change anything. Plus, this is a potential Market product, so the sound must go along the indicator as a resource, which means that doesn't count as a viable solution.
So, any advance in correcting this bug? How may I report Metaquotes about it?
You need to post code and any relevant information/data to reproduce the bug.
Well, there isn't much needed to test. Any custom indicator with a for() loop telling to PlaySound in all the loaded candles will lead to the problematic RAM super consumption once loaded in a Graph.
Btw I managed to circunvent that: my indicator OnCalculate function starts with an identification telling if that call is the first one (done when the indicator is loaded for the first time) or a normal call (so any other). So I added a flag essentially telling not to PlaySound if that call was the first, loading one so now the function is only executed after the indicator is loaded, and that's it, problem solved. That, in fact, kinda confirms the problem comes from calling PlaySound too many times when loading the 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
Hi,
I'm experiencing a curious situation here which probably is a bug in RAM management by MT5 Terminal with the PlaySound function. First, consider the following print:
2Gb, just a little bit of RAM consumption, isn't it? :P
No here is the situation:
I have a costum indicator which uses the PlaySound function, calling it when a given market situation happens. I normally have this indicator charged in one of my graphs. When the indicator is charged with the play sound feature enabled and I open MT5, I get the situation above. With time, the RAM decreases to around 170-200 Mb.
Now if I load MT5 WITHOUT the indicator or with the play sound feature DISabled, MT5 opens normally with around 170-200 MB of RAM consumed (all this considering closed market, so static graphs). If I load the indicator, but WITHOUT the play sound, the RAM consumption doesn't change. But the moment I load it WITH PlaySound, it goes to over a Gb of RAM.
So it's clear that the PlaySound feature is consuming a ton of RAM. Btw, enabling the feature does nothing but this:
It seems that, as MT5 calculates the history of the indicator in the already formed candles, it is calling PlaySound which, of course, is not being emitted, but is consuming RAM either way.