DislikedEdit: I see your point now. for some reason my test was faulty. I think I used my test code on the wrong chart. duh
Sorry about that.
It is technically a bug with using timeframes above monthly with the newer naming scheme.
...
Print(Symbol());
Print("60 tf previous bar open time=",iTime(Symbol(),60,1));
Print("240 tf previous bar open time=",iTime(Symbol(),240,1));
Print("current tf previous bar open time=",iTime(Symbol(),0,1));Ignored
Yes, "Symbol()" on a 2-Month chart returns "EURUSD_x2", and that's why it won't work on the lower timeframes (60 and 240) which return "0".
I can see a benefit to leaving the Symbol() name unchanged for the higher timeframes, however, you will still be in a position of having to fix your indicator code if anything in it relies upon accuracy from a "Period()" command, because for these higher timeframe (> 1 month) charts, it's going to lie about the true period. (e.g. Period() will return "43200" on this chart even though "86400" is the true period).
Do most indicators that use MTF references completely ignore what "Period()" returns? It all depends on what is being calculated but it seems to me like most would need an accurate "Period()" as well as an accurate "Symbol()".
But because of MT4 limitations, a compromise is required (and perhaps I made the more difficult choice of changing Symbol() instead of Period() ??? Maybe so.)
My robust solution (not implemented yet), would be to write a procedure that you use in your indicator(s).
Define top variables prior to init() and start():
string symbol;
int period;
int timeshiftmin;
In your init() routine, you run:
getSymbolPeriodTimeshift( symbol, period, timeshiftmin); // 3 outputs
Everywhere else in your program, you replace any "Symbol()" or "NULL" reference in the position of "Symbol()" with "symbol" (the variable). Also replace any "Period()" reference with "period".
The "getSymbolPeriodTimeshift" procedure would get for you the true symbol name and true period. In most programs, so long as timeshiftmin = 0, you can make the two simple substitutions and it will work. If timeshiftmin is NOT 0, then... the modifications to account for the timeshiftmin will require more thought how to modify your program. Most likely, you would continue to use "Symbol()" (which includes the timeshift) but use the "period" variable to get the true period value.
Not sure how soon I'll write that...
Do you have examples of indicators that do NOT rely upon "Period()" to be accurate but DO rely upon "Symbol()" to be accurate? If you can share, upload a few examples or give links to where they can be downloaded. That's the best way to ensure compatibility as I make changes to the "P4L PeriodCon.mq4" program.
Kent