I'm using IsTradeAllowed () in a while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. I would like not to go out of the loop until the order is placed. Can anyone help?
I'm using IsTradeAllowed () in a while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. I would like not to go out of the loop until the order is placed. Can anyone help?
Thanks.
There is no need to do what you ask, if you read the article and follow the simple instructions.
Always check the result from OrderSend, OrderModify etc... Use the result to determine if the placement was a success or not, and exit the loop according to that. Just refrain from entering into endless-uncontrolled loops.
TradeIsNotBusy(); // sets GV to 0Print("Trade is Busy: " + TradeIsBusy()); // sets GV to 1, prints 1
TradeIsNotBusy(); // Entleeren den Trade-Context // sets GV to 0
Here is explanation.
But you don't need to use these functions. There are 8 trade contexts in MT4 several years already.
Terminal have 8 trade contexts now, so it can send as much as 8 trade requests simulateously.
If you use less then 8 EAs at the same time, you could even not to check IsTradeContextBusy(). Otherwise, just check it and have a little sleep in case it returns false ;)
Terminal have 8 trade contexts now, so it can send as much as 8 trade requests simulateously.
If you use less then 8 EAs at the same time, you could even not to check IsTradeContextBusy(). Otherwise, just check it and have a
little sleep in case it returns false ;)
Wow, good to know. I've been fiddling with the incorporation of whrea_v1.2's GetTradeContext()/RelTradeContext() functions into my EA for
several hours... :)
Hi.
I'm using IsTradeAllowed () in a while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. I would like not to go out of the loop until the order is placed. Can anyone help?
Thanks.
Hi.
I'm using IsTradeAllowed () in a while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. I would like not to go out of the loop until the order is placed. Can anyone help?
Thanks.
There is no need to do what you ask, if you read the article and follow the simple instructions.
Always check the result from OrderSend, OrderModify etc... Use the result to determine if the placement was a success or not, and exit the loop according to that.
Just refrain from entering into endless-uncontrolled loops.
Hey,
Iam try ing to use the 2 functions. But I don't get it to work
This is my test:
The Print function returns: 1
But the Global Variable table returns: 0
Do I do something wrong?
Hey,
Iam try ing to use the 2 functions. But I don't get it to work
This is my test:
The Print function returns: 1
But the Global Variable table returns: 0
Do I do something wrong?
Here is explanation.
But you don't need to use these functions. There are 8 trade contexts in MT4 several years already.
Hey Andrey,
thanks for reply. So you mean using
is enough?
What are the "8" contexts?
Hey Andrey,
thanks for reply. So you mean using
is enough?
What are the "8" contexts?
Terminal have 8 trade contexts now, so it can send as much as 8 trade requests simulateously.
If you use less then 8 EAs at the same time, you could even not to check IsTradeContextBusy(). Otherwise, just check it and have a little sleep in case it returns false ;)
Terminal have 8 trade contexts now, so it can send as much as 8 trade requests simulateously.
If you use less then 8 EAs at the same time, you could even not to check IsTradeContextBusy(). Otherwise, just check it and have a little sleep in case it returns false ;)