![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
OK, let me rephrase. Within mql is roughly possible, depending on processor clock speed.
What about PWM? -A pulse signal of constant frequency and variable duty cycle.
Doesn't it set a constant?
First, read what the WinAPI Sleep function is, and what it actually does
PS Windows is not a real time system
First, read up on what the WinAPI Sleep function is and what it actually does
PS Windows is not a real time system
Ahem, what does WinAPI Sleep have to do with it?
When we're talking about microsecond slip
Individually, for your processor you can determine the timer frequency and calculate the number of repetitions.
So, you can write your own MicrosecondCount in mql, but what is the point? The standard one is enough.
Ahem, I'm embarrassed to ask, what does WinAPI Sleep have to do with it?
When we're talking about microsecond slip
Individually, for your processor, you can define the timer frequency and calculate the number of repetitions.
So, you can write your own MicrosecondCount in mql, but what is the point? The standard one is enough.
Your own pending slip without context switching will eat up your core 100%.
This is a creepy programming method. God forbid such code leaks into the marketplace.
Your waiting slip without context switching will eat up your core 100%.
It's a horrible programming method. God forbid such code leaks into the marketplace.
And no one denied that hardcore ))
If you show an example of context switching, maybe you can improve?
Here's the CPU load for µsSLEEP (µsRange), on VirtualBox with only 2 cores, 4 threads.
Miners do worse than that ))
Forum on trading, automated trading systems and strategy testing
Libraries: Sequence
fxsaber, 2020.10.13 12:54
An example of an EA that will kill most VPS.I am running it on few charts of different symbols. I have used this script with inAmount = 5 to automate this action.
Result.
The Terminal requires more than 4 Gb of memory to run these six Expert Advisors. Please note that it is only needed for initialization, not for operation of these EAs. Imagine that you start the terminal with Expert Advisors dangling in it. If you don't have honest 4 Gb of RAM available - it's almost a disaster.
Now let's remove the comment of this line in the source code.
Thus, we have enabled sequential initialization of Expert Advisors.
Let's look at the result (after recompiling).
On the start of the Expert Advisors we have managed to reduce the Terminal memory consumption by more than 2.5 Gb. The probability of VPS crashes (and weak home computers) has decreased significantly.
This is how both runs look in dynamics.
The sequential launch stretched the overall initialization in time, but managed to keep the Terminal from consuming huge amounts of RAM.
Theupper and lower graphs clearly show the process of parallel initialization (left high peak) and six consecutive initializations (six middle peaks).
SZY During the experiments an unpleasant nuance with Sleep came to light - see source code.
I ask to somehow allow freeing memory by force after using CopyTicks. Not to create such Sleep crutches.
Please recommend the cheapest way to request tick history at a given interval.
it sounds to me like you are not looking for a cheap one, but a way to free up memory quickly
as an option to check:
- wrap dynamic array MqlTick Ticks[] in class and create object with new (i.e. also dynamic object), delete it when you don't need it
- the same, but with structure, but in local scope ( or function or local block { } - or loop with one iteration ? ), structures do not work as well as classes - I rewrote most of my EA code moving away from classes and replacing them with data structures, optimization speed increased significantly - maybe it's a subjective effect - maybe new builds are faster
- try adding ArrayFree() to the destructor
I don't think you're looking for a cheap one, but a way to free up memory quickly
The Terminal does not free up memory. MQL variables have nothing to do with it.
The terminal is not freeing up memory. MQL variables have nothing to do with it.
What if you force size = 1 ?
what if you do^
and if
After calling CopyTicks, the terminal holds all data in memory for a few seconds. Just in case someone wants to re-read a piece of tick history.
I.e., the amount of memory so consumed by the Terminal does not depend on the size of MQL variables.
The task is to force the Terminal to release the memory.