- Need help to do a script that draws automatically a vertical line at a certain time everyday in MT4
- Vertical Line Indicator
- Vertical Lines
User Interface - MetaTrader 4 Help
Fast Navigation - User Interface - MetaTrader 4 Help
Fast Navigation - User Interface - MetaTrader 4 Help (Hot keys)
Hot Keys - For Advanced Users - MetaTrader 5 Help
Perhaps you should read the manual. Turn on the period separators (control+Y)
User Interface - MetaTrader 4 Help
Fast Navigation - User Interface - MetaTrader 4 Help
Fast Navigation - User Interface - MetaTrader 4 Help (Hot keys)
Hot Keys - For Advanced Users - MetaTrader 5 Help
sir, i want to save 24 candle of 1H in day in array, so turn on period separator in chart doesn't help me in code
Then why did you ask about creating an object? (i want to draw vertical line) That can't help you, either.
How To Ask Questions The Smart Way. (2004)
The XY Problem
Just find the first candle and save them.
datetime bod=date(); // Beginning of the Day. for(int iBod=iBarShift(NULL,PERIOD_H1, bod); iBod >= 0; --iBod) array[iBod] = iClose(NULL,PERIOD_H1, bod);Find bar of the same time one day ago - MQL4 programming forum (2017)
See also
You can draw Vertical Line so easy way. Just create an Object with the parameter of Daily candle open time. If you want only current day, then no need to change the object name but if you want for all previous days then dynamically change the object name.
ObjectCreate(ChartID(),obj_name,OBJ_VLINE,0,iTime(NULL ,PERIOD_D1,0));
ObjectCreate(ChartID(),obj_name,OBJ_VLINE,0,iTime(NULL ,PERIOD_D1,0));
-
If you had read the thread, that isn't what OP actually wants or needs.
-
You could also use D1 timeframe, but then you have to deal with 4066 / synchronization issue.
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use