How do I move the global variable structure in the indicator when moving to another timeframe? - page 2

 
Igor Makanu:

here@fxsaber showed an example of how to save the structure in global variables

https://www.mql5.com/ru/forum/320395/page6#comment_12910394

and below is his post in this thread

it's easier to declare union and then directly write double to global variables or file.
though of course it depends on the problem.

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

it's easier to declare a union and then directly write the double to global variables, or to a file.
though of course it depends on the problem.

there's a universal and ready-made solution

although... writing your own bikes. it's a long tradition of this forum ))))

 
Igor Makanu:

there's a one-size-fits-all solution

although... writing your own bikes. it's a long tradition of this forum ))))

I agree, taking values from a structure and writing them to a global variable is a couple of lines, why that bicycle with array copying and type conversions? )

 

when using files, bases or global variables

The real kicker is when you have more than one indicator in the chart ;-)

You'll have to figure out how to make sure they don't mix up their data when loading.

 
Maxim Kuznetsov:

when using files, bases or global variables

The real kicker is when you have more than one indicator in the chart ;-)

You'll have to figure out how to make sure they don't mix up their data when loading.

And especially if the indicators are in the same subwindow, then you need either a unique id in parameters, which is cumbersome for the user, or generate a random id at startup, but then it is not clear how a particular copy will self-identify with this id.

 
I read it and rejoice. This problem is simple and should be solved by MQL without any messing around. MQL has become obsolete and is overgrown with crutches.
 
Mikhail Nazarenko:
I'm reading it and I'm glad. This problem is simple and should be solved by MQL without any juggling. MQL has become obsolete and is overgrown with crutches.(

If the indicator cannot recalculate the data at start-up, it means that it shows different data on different starts.
What is the point of such an indicator? Will each user see their own personal signals?)

 
Taras Slobodyanik:

If the indicator cannot recalculate the data on start-up, it means that it shows different data on different starts.
What is the point of such an indicator? Each user will see his personal signals?)

the indicator may perform very large calculations (or keep considerable arrays of things), which is unfortunate to lose by simple restart...

could be a trained proton hyper-cube...and only the initial pre-calculation would take a month of real time :-)

 
Maxim Kuznetsov:

the indicator can do very large calculations (or hold substantial arrays of stuff), to lose which with a simple restart is sad...

could be a trained proton hyper-cube...and only the initial pre-calculation took a month of real time :-)

I doubt in that case the author would have had any trouble saving it to disk.

And, since the author is a seller, how would the product be sold in such a case?
Would the buyer have to sit through a month of calculations? )

 
Taras Slobodyanik:

If the indicator fails to recalculate the data on start-up, it means that it shows different data on different starts.
What is the point of such an indicator? Each user will see his personal signals?)

Take a broader view. There are also installed alerts, and other user actions that should not change with a change of timeframe. How with them?

Reason: