Vertical lines
- draw vertical line in 00:00 for everyday in chart
- Draw Vertical Line to Future Time
- MT5 Charting with Future Dates
-
Why did you post your MT4 question in the
Root /
MT5 Systems section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. -
You have only four choices:
- Search for it,
- learn to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
- Beg at Coding help - MQL4 and MetaTrader 4 - MQL4 programming forum or Need help with coding - General - MQL5 programming forum or Free MQL4 To MQL5 Converter - General - MQL5 programming forum or Requests & Ideas (MQL5 only!),
- or pay (Freelance) someone to code it.
No free help
urgent help.
Hi .
//+------------------------------------------------------------------+ //| DrawLinesNhours.mq4 | //| Copyright 2017, nicholishen | //| https://www.forexfactory.com/nicholishen | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, nicholishen" #property link "https://www.forexfactory.com/nicholishen" #property version "1.00" #property strict #property indicator_chart_window #include <ChartObjects\ChartObjectsLines.mqh> #include <Arrays\List.mqh> //--- input parameters input string StartTime="2017.11.01 00:00"; input int Hours=3;//Number of hours to increment CList line_list; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- datetime line_time=StringToTime(StartTime); while(line_time <= TimeCurrent() &&!IsStopped()) { string name = "__time_line__"+TimeToStr(line_time); if(ObjectFind(0,name)<0) { CChartObjectVLine *line = new CChartObjectVLine; line.Create(0,name,0,line_time); line_list.Add(line); } AddTime(line_time,Hours); int day = TimeDayOfWeek(line_time); while(!IsStopped() && (day < 1 || day > 5)) { AddTime(line_time); day=TimeDayOfWeek(line_time); } } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ void AddTime(datetime &value,int hours=1) { value+=(PeriodSeconds(PERIOD_H1) * hours); }
great, thanks for sharing the code, this indicator is very useful
Many thanks to you nicholishen , really appreciated man.
but how I could make this few days into the future also as I mentioned in the main post.
That can't be done reliably, market weekends, market holidays (broker dependent,) broker timezones (small Sunday bar or not,) trading hours (broker dependent,) etc.
also I notice that it will not give you accurate spacing in the beginning of period.
please check the attached.
great, thanks for sharing the code, this indicator is very useful
exactly mrluck012 , I use it to apply some of Michael Jenkins theories.