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

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
Help to understand. The point of this function is that if there are open sell orders and open buy order, modify the TP of the sell order. But modification happens only one first order, and then it gives error OrderModify ERROR 1
In this case TakeProfit is simply deleted
ERROR 1 - ERR_NO_RESULT No error, but result unknown
In this case the TakeProfit is simply deleted
ERROR 1 - ERR_NO_RESULT No error, but result unknown
Why of the two orders, it is deleted on one and not on the other?
Deleted only if OrderTakeProfit() > 0
i.e. the trade is on the upside
Deleted only if OrderTakeProfit() > 0
i.e. the trade is on the upside
Reworked the code.
Same thing. There are 2 sell orders with an average TP. When we open a buy order in both of these orders, the TP should be deleted. But it is deleted only at the first order, and the second order remains with the averaged TP.Deleted only if OrderTakeProfit() > 0
i.e. the trade is on the upside
if the OrderTakeProfit()>0, it doesn't mean that the trade is in the plus position...It just means that the position has a TakeProfit...
Reworked the code.
Same thing. There are 2 sell orders with an average TP. When we open a buy order in both of these orders, the TP should be deleted. But it is deleted only at the first order, and the second order remains with the averaged TP.You've just got it all mixed up...
First you highlight the order
But then you call a function
Which probably changes the selection... And that's messed up. Separate the flies from the cutlets and everything will work...
You've just got it all mixed up...
First you highlight an order
But then you call the function
Which probably changes the selection... And then you get a mess... Separate the flies from the cutlets and everything will work...
If OrderTakeProfit()>0 it doesn't mean that the trade is in the black... It just means that the position has a TakeProfit...
Another question has arisen. Here is the average price calculation function:
For some reason, it recalculates every time. I.e. the 2nd sell order is opened, the function calculates the average price. However, when the third order is opened, this function displays the previous and the new value (I checked this in the print journal) but as a result, the previous value remains. What have I done wrong?