
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
What is wrong with the code. Why do the errors"failed cancel order #0 buy 0.00 at market [Invalid request]" keep appearing
Where is position selection?
What do orders have to do with trades?
what are you trying to do? close a position?
and the order_remove_mql_trade_request name is a bad dream.
where is the position selection?
what do orders have to do with trades?
what are you trying to do anyway? close a position?
and the name order_remove_mql_trade_request is a bad dream.
yes, i need to clarify.
The purpose of the code -- if there is an open position, then cancel all limit orders of the same direction as the position.
for example, if a position is open BAY. then cancel all orders like buy limit
I forgot to select position =). Well the error is not from that (checked).
What is wrong with the code. Why do the errors"failed cancel order #0 buy 0.00 at market [Invalid request]" keep coming up?
MqlTradeRequest order_remove_mql_trade_request = {0};
order_remove_mql_trade_request.action = TRADE_ACTION_REMOVE;
i = OrdersTotal();
if(i > 0){
if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY){
for(i2 = 0;i2 <= i;i2++){
ul = OrderGetTicket(i2);
OrderSelect(ul);
if(OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_LIMIT){
order_remove_mql_trade_request.order = ul;
OrderSend(order_remove_mql_trade_request,mql_trade_result);}}}
if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL){
for(i2 = 0;i2 <= i;i2++){
ul = OrderGetTicket(i2);
OrderSelect(ul);
if(OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_SELL_LIMIT){
order_remove_mql_trade_request.order = ul;
OrderSend(order_remove_mql_trade_request,mql_trade_result);}}}}
remove those equal signs.
I already did, it doesn't work.
It's not good to cheat on your elders.
It's not good to cheat. I don't do that.
I just double-checked everything with this code:
i = OrdersTotal();
if(i > 0){
PositionSelect(_Symbol);
if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY){
for(i2 = 0;i2 < i;i2++){
ul = OrderGetTicket(i2);
OrderSelect(ul);
if(OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_LIMIT){
order_remove_mql_trade_request.order = ul;
OrderSend(order_remove_mql_trade_request,mql_trade_result);}}}
if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL){
for(i2 = 0;i2 < i;i2++){
ul = OrderGetTicket(i2);
OrderSelect(ul);
if(OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_SELL_LIMIT){
order_remove_mql_trade_request.order = ul;
OrderSend(order_remove_mql_trade_request,mql_trade_result);}}}}
The result is the same. the error mentioned above often occurs
the result is the same. the error often occurs
"often" is an empty phrase.
You think 2+2 often equals 4 ?
don't be lazy - do a sending analysis and an analysis of the returned error.
check what you are trying to remove?
are there any orders available at the time of closing?
maybe you are trying to delete an order that has already been deleted.
Thirdly, who taught you to close orders so that you think you can close all the orders? You think that after each of your closes, the OrdersTotal will decrease by 1. And you still beat your i2++ until you win, until the primary i.
You don't even bother to check if OrderGetTicket or OrderSelect returns an error
bad, very bad.
It is because of such pens that our satellites go out of orbit.
"often" is an empty phrase.
You think 2+2 often equals 4?
don't be lazy - do a send analysis and a return error analysis.
check what you're trying to delete?
are there any orders available at the time of closing ?
maybe you are trying to delete an order that has already been deleted.
Thirdly, who taught you to close orders in such a way? You think that you pass all orders, but you don't. After each of your closes, OrdersTotal decreases by 1. And you still beat your i2++ until you win, until the primary i.
You don't even bother to check if OrderGetTicket or OrderSelect returns an error
This is bad, very bad.
It is because of such pens that our satellites go out of orbit.
I was sure it was not that, otherwise there would have been errors not only with bylimits, but also with selllimits. Thanks for trying to help and guide me.
Greetings gentlemen.
This is a prototype of a windows function that emulates a keystroke:
The thing is, this function is called in MT4 with int's instead of bytes. It looks like this:
What is the problem? Is it transferring at least 4 bytes? Does it depend on the hardware?Greetings gentlemen.
This is a prototype of a windows function that emulates a keystroke:
The thing is, this function is called in MT4 with int's instead of bytes. It looks like this:
What is the problem? Is it transferring at least 4 bytes? Does it depend on the hardware?When passing parameters to a function, the minimum quantum is a 32-bit integer. That is, bVk and bScan in your case will be converted to the int type before being passed into the function
That's why the function prototypes given above don't contradict each other