Or stick this date in a structure and take the month and year from there. And then glue the character name together. I'm going to try the structure now.
Для получения текущей рыночной информации служат функции SymbolInfoInteger(), SymbolInfoDouble() и SymbolInfoString(). В качестве второго параметра этих функций допустимо передавать один из идентификаторов из перечислений ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE и ENUM_SYMBOL_INFO_STRING соответственно. Некоторые символы (как...
And then try if you want not next futures, but through futures (NtxFutMonth = 6)
Something came out too easy. Check it out please.
string newFutures(conststring aSymbol, int month = 3) // Сюда можно вставить и 1 и 6
{
MqlDateTime mqlDateTime;
TimeToStruct(SymbolInfoInteger(aSymbol, SYMBOL_EXPIRATION_TIME)+month*PeriodSeconds(PERIOD_MN1), mqlDateTime);// Получилось время экспирации следующего фьючерса
string symb = StringSubstr(aSymbol, 0, StringFind(_Symbol, "-")+1);
return(symb+(string)(mqlDateTime.mon)+"."+(string)(mqlDateTime.year%1000));
}
What's the point? The function I gave you has been working for years...
I asked because I thought there was a simple option. I don't doubt your function at all, but from my point of view it's a bit more complicated than I did.
Alexey Viktorov: I asked because I thought there was a simple option. I don't doubt the functionality of your function at all, but from my point of view it's a bit more complicated than I did.
Cкрипт с тремя независимыми функциями для определения текущего (ближайшего) фьючерса рынка FORTS. В параметрах вводится короткое наименование фьючерса, например br (можно мелким шрифтом). На выходе полное...
There is another option, for copper (there seems to be 2 and 5),
all other futures are either 3 or 1 month.
You can automatically substitute a month.
Well, if that's the case, maybe it's better to take
and pull the year and month+3(1) from that date.
Or stick this date in a structure and take the month and year from there. And then glue the character name together. I'm going to try the structure now.
I liked the way it turned out through the structure...
I liked the way it worked through the structure...
Now try for the futures XXX-12.20
That should work out to XXXX-3.21
Added by
And then try if you want not next futures, but through futures (NtxFutMonth = 6)
Now try for futures XXXX-12.20
You should get XXXX-3.21.
Oh! Right. That's the next phase. I'll just finish it.
Oh! Right. That's the next step. I'll get right on it.
:)
What's the point? The function I gave you has been working for years...
Now try for futures XXX-12.20
That would be XXXX-3.21
Added
And then try if you want not next futures, but through futures (NtxFutMonth = 6)
Something came out too easy. Check it out please.
I have.
newFutures("RTS-12.19")brought back the RTS-3.20:)
What's the point? The function I gave you has been working for years...
I asked because I thought there was a simple option. I don't doubt the functionality of your function at all, but from my point of view it's a bit more complicated than I did.
OK, no problem.
PutNtxFutMonth = 6 on futures XXXX-12.20
OK, no problem.
PutNtxFutMonth = 6 on futures XXXX-12.20
Put it on RTS-12.19.
and got RTS-6.20.
I'm just afraid I've missed some subtleties. That's why I asked you to check.
Put it on RTS-12.19
and got RTS-6.20
I'm just afraid I've missed some subtleties. That's why I asked you to check.
Try this one.