I am very new to MQL5 language - why above code give me Error 10030?
Please help
Error 10030 (TRADE_RETCODE_INVALID_FILL) in MQL5 means "unsupported filling type." This usually happens when you specify a type_filling (like ORDER_FILLING_FOK) that the broker or symbol does not support.
Please example code
bool makePosition(orderType type){ ZeroMemory(request); request.symbol=_Symbol; request.volume=volume; request.action=TRADE_ACTION_DEAL; request.type_filling=ORDER_FILLING_FOK; double price=0;
The code above already specify ORDER_FILLING_FOK statement
Why still error?
That is the same as your original posted code - Likely your broker doesn't support ORDER_FILLING_FOK so your code needs to dynamically work out which filling mode it supports.
You could try hard-coding it to ORDER_FILLING_IOC - it might work. But not a good fix because if you change broker it could stop working again.
I don't have a code example of how to assign it dynamically, but if you do the search that I suggested, you'll likely find something.
{
uint filling = (uint)SymbolInfoInteger(symbol, SYMBOL_FILLING_MODE);
if ((filling & SYMBOL_FILLING_FOK) == SYMBOL_FILLING_FOK)
{
return ORDER_FILLING_FOK;
}
else if ((filling & SYMBOL_FILLING_IOC) == SYMBOL_FILLING_IOC)
{
return ORDER_FILLING_IOC;
}
else
{
return ORDER_FILLING_RETURN;
}
}
ENUM_ORDER_TYPE_FILLING SetTypeFillingBySymbol(const string symbol)
{
uint filling = (uint)SymbolInfoInteger(symbol, SYMBOL_FILLING_MODE);
if ((filling & SYMBOL_FILLING_FOK) == SYMBOL_FILLING_FOK)
{
return ORDER_FILLING_FOK;
}
else if ((filling & SYMBOL_FILLING_IOC) == SYMBOL_FILLING_IOC)
{
return ORDER_FILLING_IOC;
}
else
{
return ORDER_FILLING_RETURN;
}
}
yes , this is the best solution
but i notice most broke ICO, so why not strart if statement by
SYMBOL_FILLING_IOC- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am very new to MQL5 language - why above code give me Error 10030?
Please help