FORTS: To help beginners - page 10

 
Dmi3:

As usual, you have nothing to say on the substance of the question?

And no one has seen the question - they have only seen your unsubstantiated accusations. Let me remind you - this is primarily a technical forum and every airshake must be supported by technical details. Consider this as your first and last warning.

 

The candle_time_end_and_spread indicator has calculated the expiry time. I keep forgetting about it. It may be useful for someone:

 

Is there a simple way to get the name of the underlying asset on the futures? At the moment I'm writing a long matching table, but surely there is an easier way. Maybe I may use moex to request it, but it's not clear how to do it, I don't know what the hell I'm doing there.

   if(future_basis == "Si") return "USDRUB_TOD";
   if(future_basis == "RVI") return future_basis;
   if(future_basis == "GAZR") return "GAZP";
   if(future_basis == "VTBR") return future_basis;
   if(future_basis == "Eu") return "EURRUB_TOD";
   if(future_basis == "SBRF") return "SBER";
   if(future_basis == "BR") return "BR Splice";
 
vponed:

Is there a simple way to get the name of the underlying asset on the futures? At the moment I'm writing a long matching table, but surely there is an easier way. Maybe I may use moex to send a request, but it's not clear how to do it.

There's no way to take a spot, you can write one yourself:

string GetSpot(const string a_symbol)
{
  if(StringFind(a_symbol, "AFLT-") > -1) return("AFLT"); else
  if(StringFind(a_symbol, "AFKS-") > -1) return("AFKS"); else
  if(StringFind(a_symbol, "ALRS-")> -1) return("ALRS"); else
  if(StringFind(a_symbol, "CHMF-")> -1) return("CHMF"); else
  if(StringFind(a_symbol, "Eu-")> -1) return("EURRUB_TOM"); else
  if(StringFind(a_symbol, "FEES-")> -1) return("FEES"); else
  if(StringFind(a_symbol, "GMKR-")> -1) return("GMKN"); else
  if(StringFind(a_symbol, "GMKN-")> -1) return("GMKN"); else
  if(StringFind(a_symbol, "GAZR-")> -1) return("GAZP"); else
  if(StringFind(a_symbol, "HYDR-")> -1) return("HYDR"); else
  if(StringFind(a_symbol, "LKOH-")> -1) return("LKOH"); else
  if(StringFind(a_symbol, "MAGN-")> -1) return("MAGN"); else
  if(StringFind(a_symbol, "MOEX-")> -1) return("MOEX"); else
  if(StringFind(a_symbol, "MGNT-")> -1) return("MGNT"); else
  if(StringFind(a_symbol, "MTSI-")> -1) return("MTSS"); else
  if(StringFind(a_symbol, "NOTK-")> -1) return("NVTK"); else
  if(StringFind(a_symbol, "NLMK-")> -1) return("NLMK"); else
  if(StringFind(a_symbol, "PLZL-")> -1) return("PLZL"); else
  if(StringFind(a_symbol, "ROSN-")> -1) return("ROSN"); else
  if(StringFind(a_symbol, "RTKM-")> -1) return("RTKM"); else
  if(StringFind(a_symbol, "SNGP-")> -1) return("SNGSP"); else
  if(StringFind(a_symbol, "SNGR-")> -1) return("SNGS"); else
  if(StringFind(a_symbol, "SBPR-")> -1) return("SBERP"); else
  if(StringFind(a_symbol, "SBRF-")> -1) return("SBER"); else
  if(StringFind(a_symbol, "Si-")> -1) return("USDRUB_TOM"); else
  if(StringFind(a_symbol, "TRNF-")> -1) return("TRNFP"); else
  if(StringFind(a_symbol, "TATN-")> -1) return("TATN"); else
  if(StringFind(a_symbol, "VTBR-")> -1) return("VTBR"); else
  if(StringFind(a_symbol, "FIVE-")> -1) return("FIVE"); else
  if(StringFind(a_symbol, "TCSI-")> -1) return("TCSG"); else
  if(StringFind(a_symbol, "YNDF-")> -1) return("YNDX"); else
  if(StringFind(a_symbol, "POLY-")> -1) return("POLY"); else
  if(StringFind(a_symbol, "IRAO-")> -1) return("IRAO"); else
  if(StringFind(a_symbol, "MAIL-")> -1) return("MAIL");
  return("NONE");
} 
Oil has no spot on the MICEX
 
vponed:

The candle_time_end_and_spread indicator has calculated the expiry time. I keep forgetting about it. It may be useful for someone:

I gave GetExpiration() function not for you to post it on your behalf, but for PERSONAL use!

 
prostotrader:

I didn't give the GetExpiration() function for you to post it on your behalf, but for PERSONAL use!

I'm very sorry, I wrote right away that I took the function from here, and that the indicator is also a third-party indicator. Or delete it, since you protest against modifications.
I didn't intend to steal anything, just thought it may be useful to someone.
I didn't even mention in the code that it was mine (I don't care, somehow)

Yeah, and thanks a lot for the feature.

 
prostotrader:

There is no way to take a spot, you can write your own:

Oil has no spot on the MICEX
I know, the task is to get monthly volumes from the underlying asset, so I return BR Splice, the volumes will definitely be there
And why are you using USDRUB_TOM and not TOD, there is more liquidity?
 
vponed:
I know, the goal is to get monthly volumes from the underlying asset, so I return BR Splice, the volumes will definitely be there
And why are you using USDRUB_TOM and not TOD, there is more liquidity?

No, TOM is available for longer

 
prostotrader:

No, TOM takes longer to reach

Then you have to add a timing override

 
prostotrader:

There is no way to take a spot, you can write it yourself:

Oil does not have a spot on the MICEX

The same info is often returned fromSymbolInfoString(_Symbol,SYMBOL_BASIS)

So it seems that the function can be greatly reduced. Return only what is different:

string basis_from_future(string future)
  {
  string future_basis = SymbolInfoString(_Symbol,SYMBOL_BASIS);

   if(future_basis == "Si")
      return "USDRUB_TOM";
   if(future_basis == "GAZR")
      return "GAZP";
   if(future_basis == "Eu")
      return "EURRUB_TOD";
   if(future_basis == "SBRF")
      return "SBER";
   if(future_basis == "BR")
      return "BR Splice";
   if(future_basis == "GMKR")
      return "GMKN"; 
        if(future_basis == "MTSI")
      return "MTSS"; 
if(future_basis == "NOTK")
      return "NVTK"; 
if(future_basis == "SNGP")
      return "SNGSP"; 
if(future_basis == "SNGR")
      return "SNGS"; 
if(future_basis == "SBPR")
      return "SBERP"; 
if(future_basis == "TRNF")
      return "TRNFP";
if(future_basis == "TCSI")
      return "TCSG";
if(future_basis == "TCSI")
      return "TCSG";
if(future_basis == "YNDF")
      return "YNDX";

   return future_basis;

  }

and splice will work

Документация по MQL5: Получение рыночной информации / SymbolInfoString
Документация по MQL5: Получение рыночной информации / SymbolInfoString
  • www.mql5.com
SymbolInfoString - Получение рыночной информации - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5