Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 414

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
For starters:
variables, variable visibility
how are they declared, where?
The target is to open one order
What is unclear, I will explain if anything
It is unclear why I should use a custom counting function if there is a ready-made order total
Because the standard one returns the total number of orders and positions in the account regardless of the symbol, magician and type.
Hi all! Could you please tell me how to set the condition of price crossing a horizontal line? And how to make this function with maximum accuracy (that would react on every tick)?
Thank you in advance))
The target is to open one order.
With every tick the terminal receives the latest quote from the server and also the information about the orders. When terminal sends OrderSend() command to server, server needs some time to process this command and open the order. Until then, it will send information about absence of an order with every tick (let's call it empty). The OrdersTotal() function will return zero, and the robot will send a new OrderSend().
When the server opens the order, the empty ticks will end. Function OrdersTotal() will return a positive value, the robot will calm down. If the quotes change frequently, the ticks will come often, and there will be a lot of empty ticks. The robot will send many OrderSend(). The server will open many orders.
The conclusion is that we should pause after OrderSend().
With every tick the terminal receives from the server the latest quote as well as information about orders. When the terminal sends OrderSend() command to the server, the server needs some time to process the command and open the order. Until then, it will send information about absence of an order with every tick (let's call it empty). The OrdersTotal() function will return zero, and the robot will send a new OrderSend().
When the server opens the order, the empty ticks will end. Function OrdersTotal() will return a positive value, the robot will calm down. If the quotes change frequently, the ticks will come often, and there will be a lot of empty ticks. The robot will send many OrderSend(). The server will open a lot of orders.
Conclusion - we should pause after OrderSend().
After OrderSend(), if there is a positive response, there is a ticket, and, accordingly, a position opening/order placing should be requested from the trading environment once again, instead of waiting indefinitely.
What about a function that takes and modifies a non-magic?
But why don't other functions place multiple orders, but only SellLimit?
What about a function that takes and modifies a non-magic?
The order magik cannot be modified.