Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1531
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
How do you deal with a terminal freeze?
The code is simple, but it's very slow
It is easier and safer to put first start flag in OnTick()
It should do calculations and rendering at once, even, for example, on a weekend.
I will not guess what will happen, the first thing I see is that you have paused to get the indicator values in OnInit() - what will happen if the user switches the TF at that time?
SZY: And how would your code behave if you run an EA, then close the terminal and reopen the terminal with a running EA?
these variants are considered
Please remind me of a trivial thing. My EA opens and closes orders in the tester normally. Now I have been working with the demo for a week already and everything is OK. But in two cases, when opening the second order (Marting), my EA has not closed both of them when the balance is positive, but only one has been struggling with the second one until I have closed the take order. I looked at the log - the pricewas "requoting". Shouldn't seem to be a problem and should close anyway, but it didn't.
So, I haven't written the function SENDING (REQUIRED) OF ORDER CLOSING in the event of a condition. Please tell me how to write this triviality. Thank you.
Please remind me of a trivial thing. My EA opens and closes orders in the tester normally. Now I have been working with the demo for a week already and everything is OK. But in two cases, when opening the second order (for a Mart position) it hasn't closed both of them when the balance is positive, but only one has been struggling with the second one until I have closed the take order. I looked at the log - the pricewas "requoting". Shouldn't seem to be a problem and should close anyway, but it didn't.
So, I haven't written the function SEND (REQUIRED) OF ORDER CLOSING in the event of a condition. Please tell me how to write this triviality. Thank you.
Or increase the slip.
Thank you for your reply. Why 138???? Is this an error number? And how much to increase the slippage (please explain the meaning of the increase). Thank you
Why 138???? Is it an error number?
Yes
And how much to increase the slippage (please explain the meaning of the increase).
It's up to you, the more slippage the less requotes.
How do you deal with a terminal freeze?
The code is simple, but it's very busy.
Strange...
I did it with int start() instead of OnCalculate and it doesn't hang at all
Why?
It is necessary to make calculations and rendering at once, even, for example, on weekends.
Indicators work in one thread, if one waits, all others wait, until the terminal hangs.
When starting MT, initialization of indicator (-s) can happen before initialization of terminal variables, i.e. it's a piece of cake to catch a hang.