Modify variable according to Time Frame
-
Hi, I need help, I want to modify a variable according to the current Time Frame of the Chart, that is, if I am in the Chart in M5 and I have a variable called "Period", I need that variable to become "200", how can I do the operation? I have used this block but it gives me an error, it helps. Thanks a lot.

-
@xyon126 I can try to think something with conventional blocks but not with custom code. Would that work for you?
-
@l-andorrà Hello @l-andorrà, how is it not a problem, I have used the MQL block because I thought there are no conventional blocks. Thanks a lot.
-
@xyon126 Ok. Please tell me a bit more how it is supposed to work. You are in a 5M chart and that variable should be automatically 200. Then you change time frame to 1H and then immediately the value whoud be 600, for example. Is that what you want?
-
@l-andorrà No, no, the idea is: Suppose we have an EA with a cross condition between 2 MA, an MA of 200 and another of 50 in the M5 temporality; now this EA for the temporality of H1 the MA of 200 should be 50 and the MA 50 should be 5. Now I change in the Temporality Draft and the idea is that with a variable or something that when the seasonality changes in the Draft the EA detect in which temporality it is and apply the corresponding MA value.
In this way with an EA I can in several windows of the same PAR (EURUSD, GBPUSSD, etc.) have the option of having the EA work with MA, with different values according to their temporality, and if I change the temporality in that window automatically the EA will recognize it and vary the MA values. -
@xyon126 I'm not sure I catch it. Are you changing the time frame on ALL charts for ALL symbols manually?
-
@l-andorrà Yes! I want to have the same EA in several windows of the same PAR but with different temporalities, in this way different operations will be opened with different temporalities and each one with a different configuration, it is as if I had 5 or 6 EAs with the same strategy but with values of The MAs are different and adapted to their time map since with different configurations the results are similar but with the same MA configuration in different temporalities, the EA is only valid in one temporality.
-
@xyon126 But then why will you change the timeframe? If you are running the EA on 6 different timeframes for the same symbol, what's the point of changing them manually?