
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How do you make a variable declared inside one block, visible in other blocks?
Hello!
How do you make a variable declared inside one block, visible in other blocks?
This is probably not possible. Although you should probably rephrase the question.
Variables (and not only variables) declared at module level are visible in the whole module and in other modules as well (if this module is declared there).
Variables declared inside a code block (procedure or function) are available only within this block.
Public variables declared within a class are available to descendants or variables of that class type.
There is also a specific type of variables as Global Variables (there is a set of specialized functions for them since MQL4).
This is probably not possible. Although the question probably needs to be reworded.
Variables (and not only variables) declared at module level are visible in the whole module and in other modules as well (if this module is declared there).
Variables declared inside a code block (procedure or function) are available only within this block.
Public variables declared within a class can be accessed by descendants or variables of that class type.
There is also a specific type of variables as Global Variables (there is a set of specialized functions for them since MQL4).
" According to the idea, variables (and not only variables) declared at module level are visible in the whole module, as well as in other modules (if this module is declared there)."
How can a module be declared where this can be read?
And izcho question, what is the difference between modules, buffers, classes... ? Where can I read it?
"The idea is that variables (and not just variables) declared at module level are visible throughout the module, as well as in other modules (if the module is declared there)."
How can a module be declared where this can be read?
And izcho question, what is the difference between modules, buffers, classes... ? Where can I get this information?
In general the bulk of the answers can be found in the help, in particular on the scope of variables here(https://www.mql5.com/ru/docs/basis/variables/variable_scope).
If you were to ask a specific question with an example and a description, you would have a better chance of getting a more complete answer.
In general, a lot of answers can be found in the help, in particular on the scope of variables here(https://www.mql5.com/ru/docs/basis/variables/variable_scope).
If you were to ask a specific question with an example and a description, you would have a better chance of getting a more complete answer.
I posed a concrete question in another thread on the example of the EA under discussion: https://www.mql5.com/ru/forum/1268/page6.
Please, if it's not difficult, take a look there.
"The idea is that variables (and not just variables) declared at module level are visible throughout the module, as well as in other modules (if the module is declared there).
How can I declare a module, where can I read it?
I was referring to the inluded connection of the module. This way you can split large projects into modules (units). For example, you can divide a 5000-line project into several units.
This approach will allow you to create hundreds of Expert Advisors on one code.
The modules are plugged simply like modules of the standard library.
#include <\Charts\Chart.mqh> //Class - Chart
abeiks:
And what's the difference between modules, buffers, classes... ? Where can I read it?
And Izcho question, what is the difference between modules, buffers, classes... ? Where can I find out about it?
And Izcho question, what is the difference between modules, buffers, classes... ? Where can I find out more about it?
Your expert is already at the start. Are you kidding?
Hello, could you please advise whether it is possible to add to MT5 a Period Converter indicator for displaying any non-standard timeframes? I have not been able to convert it, it generates a lot of errors.