Colleagues, kind time of day.
I try to set the expiration of the order, but in response I get: invalid expiration type.
The code looks like this:
datetime expir=TimeTradeServer()+PeriodSeconds(PERIOD_M5);
ct.BuyLimit(vol,price,sym1,0,0,ORDER_TIME_SPECIFIED,expir);
Please help.
Thanks.
barabashkakvn
Comments that are not related to this topic have been moved to the “Issue with expiration on FORTS”.
nx0x2
Thank you very much)
prostotrader
Write what you want to do (for how long to set the order)?
A value of 10 means that this symbol supports 2 types of expiration
SYMBOL_EXPIRATION_DAY and SYMBOL_EXPIRATION_SPECIFIED_DAY
Added
Ie EXPIRATION_SPECIFIED_DAY You can place an order before the first clearing on the day you set,
and SYMBOL_EXPIRATION_DAY – to the nearest clearing
nx0x2
Returns the value 10, in the tablature (flags of allowed modes) I did not find anything on this topic
fxsaber
nx0x2:
Error modification of the order. Error code=4753
Trading server, symbol?
Perhaps it will be decided so
Forum on trading, automated trading systems and testing of trading strategies
Features of the mql5 language, subtleties and techniques of work
fxsaber, 2017.02.25 16:16
// Returns the order expiration type equal to Expiration if it is available on the symbol Symb, otherwise it is the correct option.
ENUM_ORDER_TYPE_TIME GetExpirationType( const string Symb, uint Expiration = ORDER_TIME_GTC )
{
const int ExpirationMode = (int)::SymbolInfoInteger(Symb, SYMBOL_EXPIRATION_MODE);
if ((Expiration > ORDER_TIME_SPECIFIED_DAY) || (((ExpirationMode >> Expiration) & 1) == 0))
{
if ((Expiration < ORDER_TIME_SPECIFIED) || (ExpirationMode < SYMBOL_EXPIRATION_SPECIFIED))
Expiration = ORDER_TIME_GTC;
else if (Expiration > ORDER_TIME_DAY)
Expiration = ORDER_TIME_SPECIFIED;
uint i = 1 << Expiration;
while ((Expiration <= ORDER_TIME_SPECIFIED_DAY) && ((ExpirationMode & i) != i))
{
i <<= 1;
Expiration++;
}
}
return((ENUM_ORDER_TYPE_TIME)Expiration);
}ApplicationRequest.type_time = getexpirationtype(Request.symbol, (uint)Expiration); // Expiration can be a datetime
if (Expiration > ORDER_TIME_DAY)
Request.expiration = Expiration;Such a change
is ct. BuyLimit(vol, price, sym1,0,0,getexpirationtype(sym1, (uint)expir), (expir > > ORDER_TIME_DAY)? expir : 0);
nx0x2
Error modification of the order. Error code=4753
marketeer
It is necessary to make a check for the availability of the expiration setting – not all symbols have it enabled – symbolinfointeger (, SYMBOL_EXPIRATION_MODE) – will return the mask of flags of allowed modes.
fxsaber
Forum on trading, automated trading systems and testing of trading strategies
When modifying an order, error 131 occurs
fxsaber, 2017.09.12 19:47
You just need to write the name of the trading server and the symbol, and the problem will be solved in the shortest possible time, because everyone will be able to try it.
In the meantime, it seems that the task is not to find a solution, but to answer yes/no.
nx0x2
Thank you, but the method you suggested didn’t work. Moreover, when you set your method, the expiration time is 00: 00:00(the order is not set with the invalid expiration type), and if you set it like this:
datetime expir=TimeCurrent()+300;
..that time is displayed as it should be 00: 05: 00, while the order is still not placed with the error invalid expiration typescriptong
The expiration must be at least 10 minutes from the current time. And in the given example – 5 minutes.
rosomah
For example:
input int t_ord=1;//t_ord=1; / /number of hours
...............
datetime expir=TimeCurrent()+t_ord*3600;//3600-number of seconds in an hour
ct.BuyLimit(vol,price,sym1,0,0,ORDER_TIME_SPECIFIED,expir);