Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 429
![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
so if there is a close, it is better to loop backwards.
No, it should close from the old to the new order
no, it should close from the old to the new order
If you change the order, it will be from the old to the new. In the meantime, from the new to the old, and even through one sometimes it may happen.
If you change the order, it will be from the old to the new. In the meantime, from the new to the old one, and sometimes it may happen through one.
If you do for (int i = OrdersTotal()-1; i>0; i--) it will close from new to old!
If you change the order, it will be from the old to the new. But in the meantime, from the new to the old, and sometimes one after the other, it can happen.
I don't understand, if you are too lazy to suggest errors, why impose on me a function that, according to my TS, I don't need?
Good evening ...
this https://www.mql5.com/ru/code/9767 indicator in the Expert Advisor will be correct?
if(iCustom( NULL,0, "wave(MACD_FZR)",1,0)<Low[1] )
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point, "macd sample",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
// check for short position (SELL)
if(iCustom( NULL, 0, "wave(MACD_FZR)",1,1)>High[1] )
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point, "macd sample",16384,0,Red);
I don't understand, if you're too lazy to suggest errors, why should you impose on me a function that I don't need according to my TS?
Well, then look at your function, for example the first order is taken and as it fits the condition it is deleted... Its place is taken by the second order.
During the next loop, the third order is checked, and the second one will be skipped.
That is why we pointed out that the enumeration is wrong...
If your own order is really important, we can decrement the loop variable when deleting it.
I don't understand, if you're too lazy to suggest errors, why impose on me a function that, according to my TS, I don't need?
I told you to do it while. Like (update 3):
Or
if (count<n)
Why are k and n compared with the total number of orders closed?
Trader7777:
evillive:
If you change the order, it will be from the old to the new. But in the meantime, from the new to the old, and even through one sometimes it may happen.
I don't get it, if you're too lazy to tell me what's wrong, why are you imposing a function on me that I don't need according to my TS?
If an order with number OrdersTotal() -1 is the newest one to you and order with number 0 is the oldest, I have nothing more to say. When a person's eyes are closed, they only open of their own free will, no one can force them.
By the way, what function did I inadvertently "impose" on you there?