![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
How do I determine when the next bar will open, i.e. the one that hasn't yet formed?
Is it possible to loop a request like this to open an order? )
Not desirable. Imagine, for example, that instead of TRADE_RETCODE_DONE the server returns a response that an order has been placed. Then your code would overload the server with the same kind of requests.
Would that be better?
Unlikely. Look at the description of the OrderSend() function. It should tell you that if it is executed successfully, you still need to check the return code. So we will have to go the most tedious way: take a list of return codes and think out the program behavior for each of these codes. I.e. "we send OrderSend(), get the return code, react to the retcode we get".
The second point. It's better to use the event model. I.e. don't loop the function's execution after one tick arrives, and after several unsuccessful attempts, exit the function and wait for a new tick.
You'll have to do it one day anyway :) Speaking from my own experience.
Sorry, how do I make a condition so that in the tester there is no condition, but in the tester in visual mode there is a condition?
The property list doesn't allow this, and for some reason this condition doesn't work for me:
if(MQL5InfoInteger(MQL5_TESTER)!=1 || MQL5InfoInteger(MQL5_TESTER)==1 && MQL5InfoInteger(MQL5_VISUAL_MODE)==1)
from this condition comes out that it will perform in three situations:
1)When the tester is working
2)When the tester is NOT working
3)When visual tester works
so the function will always work, most likely you should remove the second condition and connect the first and third with &&