My guess is you don't have market execution for this symbol.
Hi:
Sorry my brain was a bit slow yesterday, so didnt understand what you asked.
I think you were asking the result's retcode.
I checked it, and yes that is where the problem was. It shows unsupported filling mode.
When I changed "request.type_filling" to ORDER_FILLING_IOC, it works.
But I dont understand why ORDER_FILLING_RETURN doesnt work.
According to the manual, it works for market execution.
So maybe as you said, it is not market execution at all.
But how comes? I didnt assign a price for it (I leave it 0). It should be either market or exchange execution, and the MT5 my broker provides to me doesnt support exchange mode, so I assumed it is market execution when assigned price is empty.
*I use ORDER_FILLING_RETURN because that will partially execute the trade until it is filled/killed the current market orders.
long check_1,check_2,check_3;
HistorySelect(TimeStart,TimeCurrent());
<wait until the deal is done, I have checked them>
for (int i = HistoryOrdersTotal()-1;i>HistoryOrdersTotal()-9;i--)
{ ticket = HistoryOrderGetTicket(i);
if (HistoryOrderGetInteger(ticket,ORDER_MAGIC)==my_magic) {
check_1=HistoryOrderGetInteger(ticket, ORDER_TIME_DONE_MSC); // check order done time
check_2=HistoryOrderGetInteger(ticket, ORDER_TIME_SETUP_MSC); // check order setup time
}
}
for (int i = HistoryDealsTotal()-1;i>HistoryDealsTotal()-4;i--)
{ ticket = HistoryDealGetTicket(i);
if (HistoryDealGetInteger(ticket,DEAL_MAGIC)==my_magic)
check_3=HistoryDealGetInteger(ticket, DEAL_TIME_MSC); // check deal time
}
Print("Execution time 1.",check_1, " 2.",check_2, " 3.",check_3); // But in my tests, they show no difference
You can (have to) check the settings of the symbol you are trading :
Please check documentation for more details.
Hi:
Thank you, you are right, I didnt think of checking it. And yes, it turns out it is instant execution, not market execution. I didnt fully understand and monitor each element, my fault.
Thank you, you are right, I didnt think of checking it. And yes, it turns out it is instant execution, not market execution. I didnt fully understand and monitor each element, my fault.
Thank you for being patient so far, now I learn.
Wjack
I am not patient at all. But I try my best to hide it.
As I already said in your other topic, PLEASE READ THE DOCUMENTATION CAREFULLY, OrderSendSync():
Error 4756 is meaningless, you have to check what is the real cause of this error.
About Market execution, do you know what that means ?
My guess is you don't have market execution for this symbol.
Sorry my brain was a bit slow yesterday, so didnt understand what you asked.
I think you were asking the result's retcode.
I checked it, and yes that is where the problem was. It shows unsupported filling mode.
When I changed "request.type_filling" to ORDER_FILLING_IOC, it works.
But I dont understand why ORDER_FILLING_RETURN doesnt work.
According to the manual, it works for market execution.
So maybe as you said, it is not market execution at all.
But how comes? I didnt assign a price for it (I leave it 0). It should be either market or exchange execution, and the MT5 my broker provides to me doesnt support exchange mode, so I assumed it is market execution when assigned price is empty.
*I use ORDER_FILLING_RETURN because that will partially execute the trade until it is filled/killed the current market orders.
Many thanks
Wjack
oh, I attach the code here
Many
You can (have to) check the settings of the symbol you are trading :
Please check documentation for more details.
You can (have to) check the settings of the symbol you are trading :
Please check documentation for more details.
Thank you, you are right, I didnt think of checking it.
And yes, it turns out it is instant execution, not market execution.
I didnt fully understand and monitor each element, my fault.
Thank you for being patient so far, now I learn.
Wjack
Hi:
Thank you, you are right, I didnt think of checking it.
And yes, it turns out it is instant execution, not market execution.
I didnt fully understand and monitor each element, my fault.
Thank you for being patient so far, now I learn.
Wjack
I am not patient at all. But I try my best to hide it.