//+----------------------------------------------------------------------------+void FindOrders(int &mass[]) {
int i, t, k=OrdersTotal()-1;
ArrayInitialize(mass,0);
for (i=k; i>=0; i--) {
if (!OrderSelect(i,SELECT_BY_POS)) continue;
if (OrderMagicNumber()!=i_magic) continue;
if (OrderSymbol()!=Symbol()) continue;
t=OrderType();
mass[t]=mass[t]+1;
}
}
//+----------------------------------------------------------------------------+
//+-------------------------------------------------------------------------------------+//| Поиск своих ордеров |//+-------------------------------------------------------------------------------------+void FindOrders(int& t, int& p)
{
t = 0;
p = 0;
for (int i=OrdersTotal() - 1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != i_magic) continue;
if (OrderType() > 1 && OrderType() < 6) p++;
if (OrderType() < 6) t++;
}
pr ("FindOrders(): " + "t = " + t);
pr ("FindOrders(): " + "p = " + p);
}
It doesn't work either. I had a flaw there. It's like this now:
//+-------------------------------------------------------------------------------------+//| Поиск своих ордеров |//+-------------------------------------------------------------------------------------+void FindOrders(int& t, int& p)
{
t = 0;
p = 0;
for (int i=OrdersTotal() - 1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != i_magic) continue;
if (OrderType() > 1 && OrderType() < 6)
{
p++;
}
if (OrderType() < 6)
t++;
else
{
pr("Позиций в рвнке нет!");
}
pr ("FindOrders(): " + "t = " + t);
pr ("FindOrders(): " + "p = " + p);
}
}
When there are no orders in the market, the counters don't go zero. This is bullshit. What is wrong here I do not know. I will look at what Artem has written.
It's not working either. I had a flaw there. That's the way it is now:
When there are no orders in the market, the counters don't come up zero. This is bullshit. What is wrong here I do not know. I will look at what Artem has written.
Right. (chuckles) Well, what happened to me. Some silly mistakes. I've been digging in C++ for a month. And now I have such silly mistakes in µl. My brain must be burnt out :(
In general, is it OK to search for orders on every tick? Or is it better to execute on every bar? I still don't have it in my head which is better in one case and which in the other.
hoz: In general, is it OK to search for orders on every tick? Or is it better to execute on every bar? I still do not know what is better in one case and what is better in another.
If a position is closed within a bar during monitoring by the bar opening, the Expert Advisor will not know about the changes in the number of positions until the next bar opens.
is true, then both t and p are incremented, since any order of the type 2 to 5 is both a pending order and an order. This means we should increment both counters. And if the condition is true:
Then there is no pending order but there is a market order. It means we will increase the t counter, i.e. the counter of the total orders number.
And if there is nothing, then we will print that there are no orders
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.
How about this?
My version of the function is shorter ... :)
Maybe so.
It doesn't work either. I had a flaw there. It's like this now:
When there are no orders in the market, the counters don't go zero. This is bullshit. What is wrong here I do not know. I will look at what Artem has written.
It's not working either. I had a flaw there. That's the way it is now:
When there are no orders in the market, the counters don't come up zero. This is bullshit. What is wrong here I do not know. I will look at what Artem has written.
I take it this is the output of the information.Take this out of the loop.
I take it this is the output of the information.Take this out of the loop
Right. (chuckles) Well, what happened to me. Some silly mistakes. I've been digging in C++ for a month. And now I have such silly mistakes in µl. My brain must be burnt out :(
In general, is it OK to search for orders on every tick? Or is it better to execute on every bar? I still do not know what is better in one case and what is better in another.
t is the number of all orders.
p is the number of pending orders
If the condition is true:
is true, then both t and p are incremented, since any order of the type 2 to 5 is both a pending order and an order. This means we should increment both counters. And if the condition is true:
Then there is no pending order but there is a market order. It means we will increase the t counter, i.e. the counter of the total orders number.
And if there is nothing, then we will print that there are no orders
t = OrdersTotal();
why count???? counted???
Hello! Looking for errors in this function.
The idea is that pending orders that have not opened should be deleted two days after they are placed.
min=1440;
Thank you, pako.
Hello! Looking for errors in this function.
The idea is that pending orders that have not opened should be deleted two days after they are placed.
min=1440;