'Unsupported Filling Mode' error while sending order from Python API to Meta Trader 5
'Unsupported Filling Mode' error while sending order from Python API to Meta Trader 5
Loading saved threads...
M.Rafi Biglari · External communityPost link
External question — Stack Overflow Stack Exchange
Author: M.Rafi Biglari
Original post: https://stackoverflow.com/questions/75859321
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am developing a Python program. When I try to send an order from Python to Meta Trader 5 (Alpari broker), I get an error:
Unsupported Filling Mode
I tried the following code:
# Import the libraries
import MetaTrader5 as mt5
from datetime import datetime
# Create the bound between MT5 and Python
mt5.initialize()
# Place buy order
# Initialization value
symbol = "EURUSD"
lot = 0.01
# Choose the deviation
deviation = 10
# Find the filling mode of symbol
filling_type = mt5.symbol_info(symbol).filling_mode
# Create dictionary request
request = {
"action": mt5.TRADE_ACTION_DEAL,
"symbol": symbol,
"volume": lot,
"type": mt5.ORDER_TYPE_SELL,
"price": mt5.symbol_info_tick(symbol).bid,
"deviation": deviation,
"type_filling": filling_type,
"type_time": mt5.ORDER_TIME_GTC
}
mt5.order_check(request)
The result was as below:
OrderCheckResult(retcode=10030, balance=0.0, equity=0.0, profit=0.0,
margin=0.0, margin_free=0.0, margin_level=0.0, comment='Unsupported
filling mode', request=TradeRequest(action=1, magic=0, order=0,
symbol='EURUSD', volume=0.01, price=1.0793, stoplimit=0.0, sl=0.0,
tp=0.0, deviation=10, type=1, type_filling=1, type_time=0,
expiration=0, comment='', position=0, position_by=0))
Can anyone help me to make this problem fixed? How I can translate the
SYMBOL_FILLING_MODE
to the
ENUM_ORDER_TYPE_FILLING
value?
Thanks in advance!
Quote
Report
soroush · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: soroush
Original post: https://stackoverflow.com/a/75870989
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
It may be that your order type is not supported or the stop/tp/lot are too small.
In your case it could be because there is no money in the account. Try to do the same with a demo account that has money and see if you sill get the same error
Also check if your take profit or stop loss are too close to the opening price
Here is a list of your options.
ORDER_TYPE_BUY
ORDER_TYPE_SELL
ORDER_TYPE_BUY_LIMIT
ORDER_TYPE_SELL_LIMIT
ORDER_TYPE_BUY_STOP
ORDER_TYPE_SELL_STOP
ORDER_TYPE_BUY_STOP_LIMIT
ORDER_TYPE_SELL_STOP_LIMIT
ORDER_TYPE_CLOSE_BY
Quote
Report
Eugeny Nik · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Eugeny Nik
Original post: https://stackoverflow.com/a/76339333
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Simple add to request
"type_filling": mt5.SYMBOL_FILLING_IOC
Quote
Report
SamMeow · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: SamMeow
Original post: https://stackoverflow.com/a/76888511
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I've experienced the same issue just now, and I realized I haven't allow the Algo Trading option in MT5 terminal
You need to configure the MT5 terminal to allow automated trading.
Here are the steps:
Open the MT5 terminal and go to Tools > Options.
In the Options window, go to the Expert Advisors tab.
Check the box next to Allow automated trading.
Check the box next to Allow DLL imports.
Click OK.
Finally you need to click the "Algo Trading" button on the menu bar, ensure it's in green color
Hope it helps :)
Quote
Report
SUNNETDev · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: SUNNETDev
Original post: https://stackoverflow.com/a/78064858
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I had the same issue for two days now and I tried all the prescriptions but didn't solve but eventually this was how i resolved it.
First thing is to make sure that your mt5 is configured to receive algo trading as previously said above. Goto Tools to Options to Exert Advisors, and tick boxes to allow algorithmic trading, allow DLL imports and allow WebRequest, and untick all other four boxes.
Finally go to your order dictionary preparation and try the several "type_filling" options.
"type_filling":mt5.ORDER_FILLING_FOK
worked perfectly for me. You could try other types such as mt5._XXX_RETURN or mt5._XXX_IOC too to see which one works for you.
Quote
Report
Akani · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Akani
Original post: https://stackoverflow.com/a/79743479
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
there is no adequate response, to this yet, major answers here are using a static filling mode, IOC, FOK, naturally the symbol filling mode is supposed to be the filling mode accepted for that symbol, but that is not the case in every broker. using static filling mode works for just one MT5 instance, but if you consider a case where we have mutiple instances of MT5 where one filling mode, does not work for all brokers, then this becomes an issue.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: Akani Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/79743479 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. there is no adequate response, to this yet, major answers here are using a static filling mode, IOC, FOK, naturally the symbol filling mode is supposed to be the filling mode accepted for that symbol, but that is not the case in every broker. using static filling mode works for just one MT5 instance, but if you consider a case where we have mutiple instances of MT5 where one filling mode, does not work for all brokers, then this becomes an issue.
Checking account access…