You are writing code, there is no chart, there is no timeframe. The code must be done before you can put it on a chart. So no, not possible.
Even if it were, what are you going to do if you put it on another pair/tf? Are you going to rename all your variables? Why?
Dear firends,
I want to assign a name on a variable and I want the name to include the Timeframe or the symbol name of the current chart. As an example suppose that I'm running my indicator on "W1" timeframe so I want my variable name to be XYZ_W1 . I want to know is it possible in MQL4 to do so ? Or as another example, suppose that I've attached my indicator on EURUSD chart and I'm going to assign ABC_EURUSD as the name of a variable, would it be possible to do so ?
thanking in advance for your kind guidance,
As stated by WHRoeder, not possible and completely useless. And a very bad practice if it was possible.
This is possible with global variables: https://docs.mql4.com/globals/globalvariableset

- docs.mql4.com
It's indeed useless BUT possible - example:
#define x(y,z) {int var_##y=z;} switch(Period()) { case PERIOD_M1 : x(M1,100); break; case PERIOD_M5 : x(M5,500); break; //--- etc. }
It's indeed useless BUT possible - example:

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear firends,
I want to assign a name on a variable and I want the name to include the Timeframe or the symbol name of the current chart. As an example suppose that I'm running my indicator on "W1" timeframe so I want my variable name to be XYZ_W1 . I want to know is it possible in MQL4 to do so ? Or as another example, suppose that I've attached my indicator on EURUSD chart and I'm going to assign ABC_EURUSD as the name of a variable, would it be possible to do so ?
thanking in advance for your kind guidance,