The filling type are bit flags, so you need to isolate the respective bit by masking it.
This a short snippet on how I decide on the filling type ...
ENUM_ORDER_TYPE_FILLING g_eOrderFillType = ORDER_FILLING_FOK; // Order Fill Type ... // Set Filling Type for Current Symbol // Get possible filling policy types uint nFilling = (uint) SymbolInfoInteger( _Symbol, SYMBOL_FILLING_MODE ); // Decide on filling policy type if( ( nFilling & SYMBOL_FILLING_FOK ) == SYMBOL_FILLING_FOK ) g_eOrderFillType = ORDER_FILLING_FOK; else { if( ( nFilling & SYMBOL_FILLING_IOC ) == SYMBOL_FILLING_IOC ) g_eOrderFillType = ORDER_FILLING_IOC; };
The filling type are bit flags, so you need to isolate the respective bit by masking it.
This a short snippet on how I decide on the filling type ...
This works, you're amazing, thank you!
I'm doing some reading trying to understand what a bit flag is and what it means to mask it. Not very intuitive for me. I'll have to keep reading.
Followup question: I'm getting an 'implicit enum conversion' warning for this line
request.type_filling = orderFillingType; //(g_eOrderFillType in your code)
orerFillingType, as shown above, has been initialized as int type.
I'd normally address this (hopefully correctly?!) by typecasting it, but I'm not sure how to typecast this particular enum?
This works, you're amazing, thank you!
I'm doing some reading trying to understand what a bit flag is and what it means to mask it. Not very intuitive for me. I'll have to keep reading.
Followup question: I'm getting an 'implicit enum conversion' warning for this line
orerFillingType, as shown above, has been initialized as int type.
I'd normally address this (hopefully correctly?!) by typecasting it, but I'm not sure how to typecast this particular enum?
I have updated my previous post ...
ENUM_ORDER_TYPE_FILLING g_eOrderFillType = ORDER_FILLING_FOK; // Order Fill Type
So, when in doubt, research the documentation ...
struct MqlTradeRequest { ENUM_TRADE_REQUEST_ACTIONS action; // Trade operation type ulong magic; // Expert Advisor ID (magic number) ulong order; // Order ticket string symbol; // Trade symbol double volume; // Requested volume for a deal in lots double price; // Price double stoplimit; // StopLimit level of the order double sl; // Stop Loss level of the order double tp; // Take Profit level of the order ulong deviation; // Maximal possible deviation from the requested price ENUM_ORDER_TYPE type; // Order type ENUM_ORDER_TYPE_FILLING type_filling; // Order execution type ENUM_ORDER_TYPE_TIME type_time; // Order expiration type datetime expiration; // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type) string comment; // Order comment ulong position; // Position ticket ulong position_by; // The ticket of an opposite position };
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey gang, I've been at this one for a couple hours with no success yet.
I've tried 2 brokers so far with the EA I'm porting over from MT4. One works fine, and on OspreyFX I get a retcode error 10030: Invalid order filling type.
returns true for types ORDER_FILLING_FOK and ORDER_FILLING_RETURN.
I've got
passing my order type enum to my trade request
but I still end up with this error.
Even when I replace my orderFillingType variable with the enum itself I still get this error.
Any ideas what I'm doing wrong or what I should be looking into here?