Questions from Beginners MQL5 MT5 MetaTrader 5 - page 31

 
Yes, of course I encoded it correctly in theory, but on a five the print function doesn't work quite right, it's messy, and often doesn't write. Yes!!
 
Dimka-novitsek:

Yeah, that's actually the script I was offered to write, apparently, which I inserted into the he tick function of my expert!

No, it's not a script. These are your lines. The script must output lines like Print(EnumToString((ENUM_TIMEFRAMES)i)+"="+IntegerToString(i));
 
Dimka-novitsek:
...on the five the print function works somehow not quite right, with a twist, and often doesn't write. Yes!!
The Expert tab may not show all the messages of a running programme. To see all messages, you have to look at the logs (right mouse button, "Open").
 

It turns out that CSymbolInfo.Refresh() function doesn't refresh ticks, but CSymbolInfo.RefreshRates() should be used instead;)

CSymbolInfo.Refresh() - updates symbol data

CSymbolInfo.RefreshRates() - updates quotes=)

If everything is clear with the second method, but what is the purpose of the first method?

 
WiND:

It turns out that CSymbolInfo.Refresh() function doesn't refresh ticks, but CSymbolInfo.RefreshRates() should be used instead;)

CSymbolInfo.Refresh() - updates symbol data

CSymbolInfo.RefreshRates() - updates quotes=)

If everything is clear with the second method, but what is the purpose of the first method?

Well, you never know. Maybe, someone needs to update data on swaps, check funds when entering the market, etc. See the code for more details:
bool CSymbolInfo::Refresh(void)
  {
   long tmp=0;
//---
   if(!SymbolInfoDouble(m_name,SYMBOL_POINT,m_point))                               return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE,m_tick_value))               return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_PROFIT,m_tick_value_profit)) return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_LOSS,m_tick_value_loss))     return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_SIZE,m_tick_size))                 return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_CONTRACT_SIZE,m_contract_size))         return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_VOLUME_MIN,m_lots_min))                       return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_VOLUME_MAX,m_lots_max))                       return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_VOLUME_STEP,m_lots_step))                     return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_VOLUME_LIMIT,m_lots_limit))                   return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_SWAP_LONG,m_swap_long))                       return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_SWAP_SHORT,m_swap_short))                     return(false);
   if(!SymbolInfoInteger(m_name,SYMBOL_DIGITS,tmp))                                 return(false);
   m_digits=(int)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_TRADE_EXEMODE,tmp))                          return(false);
   m_trade_execution=(ENUM_SYMBOL_TRADE_EXECUTION)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_TRADE_CALC_MODE,tmp))                        return(false);
   m_trade_calcmode=(ENUM_SYMBOL_CALC_MODE)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_TRADE_MODE,tmp))                             return(false);
   m_trade_mode=(ENUM_SYMBOL_TRADE_MODE)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_SWAP_MODE,tmp))                              return(false);
   m_swap_mode=(ENUM_SYMBOL_SWAP_MODE)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_SWAP_ROLLOVER3DAYS,tmp))                     return(false);
   m_swap3=(ENUM_DAY_OF_WEEK)tmp;
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_INITIAL,m_margin_initial))             return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_MAINTENANCE,m_margin_maintenance))     return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_LONG,m_margin_long))                   return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_SHORT,m_margin_short))                 return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_LIMIT,m_margin_limit))                 return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_STOP,m_margin_stop))                   return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_MARGIN_STOPLIMIT,m_margin_stoplimit))         return(false);
   if(!SymbolInfoInteger(m_name,SYMBOL_EXPIRATION_MODE,tmp))                        return(false);
   m_trade_time_flags=(int)tmp;
   if(!SymbolInfoInteger(m_name,SYMBOL_FILLING_MODE,tmp))                           return(false);
   m_trade_fill_flags=(int)tmp;
//--- ok
   return(true);
  }
Документация по MQL5: Торговые функции / OrderCheck
Документация по MQL5: Торговые функции / OrderCheck
  • www.mql5.com
Торговые функции / OrderCheck - Документация по MQL5
 

THANK YOU!!!

Of course, my lines. Wanted to write that I'm a sucker, they're my lines, and saw your comment.

You have to look at the logs (right mouse button, "Open") to see all the posts. THANK YOU!!!

 

There is a character code in utf8 encoding as a string ( example: "041e" )

How to get the equivalent of this code in the 10-th system, and then convert it to a character (code 041e = Russian letter O)

What a mess, but I can't figure it out:)

 
Good morning! I don't quite know what I'm doing this morning. Please tell me, these first two variables, what's wrong with them?
 
Dimka-novitsek:
Good morning, I do not quite know what I'm doing. Please tell me these first two variables, what's wrong with them?

The first string variable you define as a function, make it empty (=NULL or ="").Then in OnInit you can make =_Symbol .

The second one.Either put ; after 5 or remove the second int.

 
THANK YOU!!!