Please check if that topic helps : https://www.mql5.com/en/forum/154574#comment_3795636

Question about OBJPROP_TIMEFRAMES - How to check if a horizontal line is visible in the current timeframe
- 2015.01.23
- mar
- www.mql5.com
Hi, i made a small script which should tell me if a horizontal line is visible in the current timeframe. The line i plotted is only visible on h1 but whatever timeframe i choose i always get "true" as a response
Alain Verleyen #:
Please check if that topic helps : https://www.mql5.com/en/forum/154574#comment_3795636
Please check if that topic helps : https://www.mql5.com/en/forum/154574#comment_3795636
It only checks for visibility, but I finally got it from the documentation example
const int flag = 1 << (7 - 1); const int flag2 = 1 << (9 - 1); int fin_flag = flag+flag2; //flag = flag + 1 << (2 - 1); //Print("Flag : ", flag, " ", flag2, " = ", fin_flag, " ", OBJ_PERIOD_M10|OBJ_PERIOD_M15); ObjectSetInteger(0, name, OBJPROP_TIMEFRAMES, fin_flag); int ListOfTFVis[21] = { OBJ_PERIOD_M1, OBJ_PERIOD_M2, OBJ_PERIOD_M3, OBJ_PERIOD_M4, OBJ_PERIOD_M5, OBJ_PERIOD_M6, OBJ_PERIOD_M10, OBJ_PERIOD_M12, OBJ_PERIOD_M15, OBJ_PERIOD_M20, OBJ_PERIOD_M30, OBJ_PERIOD_H1, OBJ_PERIOD_H2, OBJ_PERIOD_H3, OBJ_PERIOD_H4, OBJ_PERIOD_H6, OBJ_PERIOD_H8, OBJ_PERIOD_H12, OBJ_PERIOD_D1, OBJ_PERIOD_W1, OBJ_PERIOD_MN1 };
However, the number for each timeframe is counted for 1, normal Array numbering would start from 0, but I guess 0 would be PERIOD_CURRENT in this application
That's why OBJ_PERIOD_M10 is 7 and not 6
Thanks

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
I want to control the timeframes that an object would be visible on, however the timeframes are not fixed. Normally I would write:
But now, the system might require the object to become visible in 3 or 4 timeframes, could be combination of H1, M1, M5 and others. so i need to be able to generate the combination flag dynamically to be passed into the ObjectSetInteger().
So far in documentation this is what I found :
"Note that each flag can be obtained by shifting by 1 to the left by the number of bits equal to the number of the constant in the table. This makes it easier to generate flags dynamically when the algorithm operates in multiple timeframes rather than one particular one."
Found here : https://www.mql5.com/en/book/applications/objects/objects_timeframes
The flag generated here is also for just one timeframe. The example sited is printing different label text of series of timeframes
I need to be able to turn OBJ_PERIOD_H1|OBJ_PERIOD_M15 and other possible combinations into flag.
Thanks in anticipation for all ideas and solution