I have an EA which is sending 3 buy orders with different magic number/ comment, and what i want is the EA will not send out a new order
if the pending orders already had the orders
but when i use the code below, I wanna check if the existing orders have the comment of my orders so it wont send it again, it only returns
the magic num/comment of the last order i sent, and i cant extract the magic number of first order and second order even i see there are three
orders. Please help! thanks!
int PendingOrder(string comment)
int a; int t = OrdersTotal();
for (int i=0; i < OrdersTotal(); i++)
ulong ticket = OrderGetTicket(i);
string t = OrderGetString(ORDER_COMMENT);
a=1; else a=0;
The bug in your function
is that you continue looping even if you found the comment, and this resets the flag on the next iteration.
bool IsPendingOrder(string comment)
for (int i=OrdersTotal()-1; i>=0; i--)