Hi, Im having some problems with showing certain objects only in specific TF. What happens is that it doesnt show em at all.
- EA doesnt trade
- MT5 EA doesnt trade
- Searching for opened orders my magic number
Please youse the search function https://www.mql5.com/en/forum/154574#comment_3795637
Question about OBJPROP_TIMEFRAMES
- 2015.01.23
- www.mql5.com
Hi, I made a small script which should tell me if a horizontal line is visible in the current timeframe...
Marco vd Heijden:
Please youse the search function https://www.mql5.com/en/forum/154574#comment_3795637Ш
Please youse the search function https://www.mql5.com/en/forum/154574#comment_3795637Ш
Thanks , I did search, but nothing usefull came up, this is good, but even through using that code didnt quite work, arrows are ok now, but are not restsricted to tf
ObjectSetInteger(chart_ID,name,OBJPROP_TIMEFRAMES,PeriodToVisibility(0));
This is what i used, after cleaning a bit the code
int TfToPeriod(eTF tf) { return periods[tf]; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ eTF PeriodToTf(int period=PERIOD_CURRENT) { eTF tf=eTF_M1; while(periods[tf]!=period)++tf; return tf; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int PeriodToVisibility(int period=PERIOD_CURRENT) { return visibility[ PeriodToTf(period) ]; } //+------------------------------------------------------------------+
Stanislav Ivanov:
Thanks , I did search, but nothing usefull came up, this is good, but even through using that code didnt quite work, arrows are ok now, but are not restsricted to tf
This is what i used, after cleaning a bit the code
Hi guys,
you can use this function for MQL5 and edit as you wish for MT4:
int PeriodToVisibility(ENUM_TIMEFRAMES VisibilityPeriod) { int i; int periods[] = { PERIOD_M1, PERIOD_M2, PERIOD_M3, PERIOD_M4, PERIOD_M5, PERIOD_M6, PERIOD_M10, PERIOD_M12, PERIOD_M15, PERIOD_M20, PERIOD_M30, PERIOD_H1, PERIOD_H2, PERIOD_H3, PERIOD_H4, PERIOD_H6, PERIOD_H8, PERIOD_H12, PERIOD_D1, PERIOD_W1, PERIOD_MN1}; int visibility[] = { 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}; if (VisibilityPeriod == PERIOD_CURRENT) VisibilityPeriod = Period(); for (i = 0; i < 21; i++) if (VisibilityPeriod == periods[i]) break; return(visibility[i]); }
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