iHigh(NULL,PERIOD_H1,i) and double H=iHigh(NULL,PERIOD_H1,i); are not the same thing?
For some reason they give different results after the while loop.
I wanted to optimize it so I would not constantly write a long line iHigh(NULL,PERIOD_H1,i) but would store it in a variable. Changed it to a variable in the loop, the result is different.
Ivan Butko iHigh(NULL,PERIOD_H1,i) and double H=iHigh(NULL,PERIOD_H1,i); are not the same thing?
For some reason they give different results after the while loop.
I wanted to optimize it so I would not constantly write a long line iHigh(NULL,PERIOD_H1,i) but would store it in a variable. Changed it to a variable in the loop, the result is different.
depends on what context to consider...
If your while loop plays with i, theniHigh(NULL,PERIOD_H1,i) and H will be different... Because H stores the data of the other i
void CloseAll()
{
for (int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
if (!OrderClose(OrderTicket(),OrderLots(), Bid, Slippage))
Print (" Не удалось закрыть ордер на покупку!");
}
if (OrderType() == OP_SELL)
{
if (!OrderClose(OrderTicket(),OrderLots(), Ask, Slippage))
Print (" Не удалось закрыть ордер на продажу!");
}
}
}
}
}
I use this code to close all orders. But I noticed that if there are a lot of them, not all of them are closed. What can I add to close all of them, even if not the first time. If possible, please give us an example.
Second question: I want to close orders partially. But there is a problem, when partially closing orders, as I understand it, the order ticket changes, and from this the last becomes the first, and the main thing for me is to keep the order of opening. In order for the last ones to stay last. How we may track the previous order. Does the opening price change? If possible, with examples) Thanks in advance
Can you tell me how to do it correctly
not to enter all elements that I want to add up, but just specify 5 elements
No, that's not it. So far I've done this
For some reason they give different results after the while loop.
I wanted to optimize it so I would not constantly write a long line iHigh(NULL,PERIOD_H1,i) but would store it in a variable. Changed it to a variable in the loop, the result is different.
For some reason they give different results after the while loop.
I wanted to optimize it so I would not constantly write a long line iHigh(NULL,PERIOD_H1,i) but would store it in a variable. Changed it to a variable in the loop, the result is different.
depends on what context to consider...
If your while loop plays with i, theniHigh(NULL,PERIOD_H1,i) and H will be different... Because H stores the data of the other i
Yes, you're right, it plays with i. I mean, thank you.
Is there any way to cut the history? When you download it, it's 20 years old, but you need it 2-3 years ago...
Use the "Shift" key to select the data you don't want and delete it
Use the "Shift" key to select the data you don't want and delete it.
Thank you
Good afternoon, again)
Second question:
I want to close orders partially. But there is a problem, when partially closing orders, as I understand it, the order ticket changes, and from this the last becomes the first, and the main thing for me is to keep the order of opening. In order for the last ones to stay last. How we may track the previous order. Does the opening price change? If possible, with examples)
Thanks in advance