Is there any way to implement it correctly so that it closes starting from zero? If possible a line of code please.
Go through the entire list (of orders) in the desired direction and put the Ticket values into an array, then delete the orders by brute forcing this array.
Yes, I should have written more precisely. It's just that I've already laid out in full twice what this function is supposed to do, but no one has answered. Once again, what this function should do. Suppose I have a grid of orders. Whether they are opened with the same step or not, it does not matter. One order was opened earlier and another one later, i.e. every position has passed a different amount of points with a different lot. The grid will be closed according to certain conditions and I need to calculate the LOT needed to cover the loss incurred from that grid for TP points. In order not to write two mirror functions I introduced an otype parameter in the function.
But still there is an error somewhere. Please help me fix it.
I would take a different route. First, I would calculate the loss from closing the grid. And then it is as simple as that. Loss = Profit from the next order. Express the profit from the order through the lot and TP and find the lot from the equation.
khorosh: I would take a different route. First, I would calculate the loss from closing the grid. And then it is as simple as that. Loss = Profit from the next order. Express the profit from the order through the lot and TP and find the lot from the equation.
Is the loss at the end of the grid in money or pips?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Is there any way to implement it correctly so that it closes starting from zero? If possible a line of code please.
Is there any way to implement it correctly so that it closes starting from zero? If possible a line of code please.
Just a quick fix:
Yes, I should have written more precisely. It's just that I've already laid out in full twice what this function is supposed to do, but no one has answered. Once again, what this function should do. Suppose I have a grid of orders. Whether they are opened with the same step or not, it does not matter. One order was opened earlier and another one later, i.e. every position has passed a different amount of points with a different lot. The grid will be closed according to certain conditions and I need to calculate the LOT needed to cover the loss incurred from that grid for TP points. In order not to write two mirror functions I introduced an otype parameter in the function.
But still there is an error somewhere. Please help me fix it.
A quick hand job:
Thank you very much, everything is working correctly, thanks to all who responded!
I would take a different route. First, I would calculate the loss from closing the grid. And then it is as simple as that. Loss = Profit from the next order. Express the profit from the order through the lot and TP and find the lot from the equation.
Is the loss at the end of the grid in money or pips?
is the loss from closing the grid in money or pips?
What about the fact that each pair has a different point price?
What about the fact that each pair has a different point price?
Here you can see how it is implemented
https://www.mql5.com/ru/code/7275
https://www.mql5.com/ru/forum/113937/page2
https://docs.mql4.com/ru/constants/marketinfo
How do I enter it so that the compiler doesn't throw an error?
?
I found a replacement in the navigator:
#include <stdlib.mqh>.