Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 76
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
problem solved by comparing prices
In this context, my point is this:
For this reason, it would be better to have global arrays - for closed and open orders and positions. Once on a new tick, we pass the necessary amount of orders/positions once, filling the two arrays with them. And then we get all the necessary data from them on the same tick. Note that not only the last closed/open order/position and all its data are calculated, but also all parent and child ticks of all positions are searched in case of partial closing. Accordingly, at any time I can see which ticket originated from one or another position, if it has been closed partially more than once - all this already works in a class that runs in a timer. I have many other data I need with a small total number of cycles. The necessary depth of history for arrays is set for the tester.
And so on and so forth ...
Sorry. One more addition (not to counterbalance, but as an addition), I'd like to add that local arrays withstatic are not lost. That is, if conditions allow you to do without declaring them globally.
I'm now slowly rewriting it for 5. I mean that price may change very quickly and the level may be less than the stop-loss value, which will lead to an error. I mean that the price may change very quickly and the level will be less than the allowable stop level, which will lead to an error.
I understand that this"SymbolInfoTick" thing is needed to get the current price?
So, to get the actual Ask and Bid in mql4, the refresh should have been called anyway. And it turns out that the load is unlikely to change compared to calling SymbolInfoTick().
But here's another addition: I write SymbolInfoTick() in the following loop to get accurate prices
while(!SymbolInfoTick(_Symbol, mqlTick));
If we get normal prices from the first time, this loop will not increase the execution time. And if there's some failure, it's better to repeat than to get the same price instead of the current one.
So, to get actual Ask and Bid in mql4, you have to call refresh anyway. And it turns out that the load is unlikely to change compared to calling SymbolInfoTick().
But here's another addition: for error-free getting of actual prices, I put SymbolInfoTick() into this loop
while(!SymbolInfoTick(_Symbol, mqlTick));
If we get normal prices from the first time, this loop will not increase the execution time. And if there's some failure, it's better to repeat than to get the same price instead of the current one.
I see, but where should I put it, inside the cycle, or before?
So, to get actual Ask and Bid in mql4, you have to call refresh anyway. And it turns out that the load is unlikely to change compared to calling SymbolInfoTick().
But here's another addition: for error-free getting of actual prices, I put SymbolInfoTick() into this loop
while(!SymbolInfoTick(_Symbol, mqlTick));
If we get normal prices from the first time, this loop will not increase the execution time. And if there's some failure, it's better to repeat than to get the same price instead of the current one.
And if it doesn't receive it at all? How do you slow down the cycle?
Yes, logically it could be, for example, the terminal has lost connection - there are plenty of reasons for that, I have had it lose connection 50 times a day.
What's the best way to get up-to-date prices, while being less resource-intensive, mind you - for the grid trawl.
Yes, logically it could be, for example, the terminal has lost connection - there are plenty of reasons for that, I have had it lose connection 50 times a day.
What's the best way to get up-to-date prices, while being less resource-intensive, remember - for the grid trawl.
check back 10 pages, there's a pretty good schematic there.