Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1162

 
Roman:

Thank you.

but you should know that there are 4 ways to call or specify the current character

Symbol
_Symbol
Symbol()
и 0

the first 2 are useless (no one wants to store a character in a predefined variable and change it), and the help is interesting, I've flipped the whole forum 10 times in my time, all options are found in the MQ code and representatives)

 
Fast235:

but you should know that there are 4 ways to call or specify the current character

There are nuances in 2 cases, and the help is interesting, I turned the whole forum over 10 times in my time.

I always use predefined variables, like

_Symbol
 
Roman:

I always use predefined variables, like

do you think that's right?

 
Fast235:

do you think that's right?

Reading a variable, faster than a function.

 
Roman:

Reading a variable, faster than a function.

specifically on symbols is not the right answer.

there are others like this

 
Fast235:

(unlikely to store a character in a predefined variable and change the character)

The _Symbol variable already stores the name of the current chart symbol, no need to assign a symbol name to it ))

 
Roman:

Reading a variable, faster than a function.

There is no difference. When compiling, everything comes together in a single call. That's why it's better to do everything through functions.

 
Roman:

The _Symbol variable already stores the symbol name of the current chart, no need to assign a symbol name to it ))

and if multicurrency or chart change

 
Fast235:

and if multicurrency

Then the function.
You forgot to mention that another function can also be used

SymbolInfoDouble(_Symbol, ...


Different tasks, different code.

 
Vladimir Karputov:

There is no difference. When compiling, everything comes together in a single call. That's why it's better to do everything through functions.

If it is entered, then there is a difference.
Reading an initialized variable is always faster than reading a function.
A function performs extra actions to return a value.
A variable already contains that value.

Reason: