Vertical Line drawn at specified hour. How to make it refresh daily?

1
I've used this indicator for several years. As new MT4 builds keep updating, I noticed it no longer adds a new vertical line each day. I have been changing TF forward and back to refresh and it's good for another day. But I wonder if some kind person would make the changes necessary for it to just work all the time as it used to do in the past??

//================================================================
#property indicator_chart_window

input int Hour_Num = 8;
input int Minute_Num = 0;
input color Line_Color = clrSilver;

int init() {
return (0);
}

int deinit() {
int objs_total_0 = ObjectsTotal();
for (int i = objs_total_0 - 1; i >= 0; i--)
if (StringFind(ObjectName(i), "Time_vLine-") != -1) ObjectDelete(ObjectName(i));
return (0);
}

int start() {
//
int ind_counted_0 = IndicatorCounted();
for (int i = Bars - ind_counted_0 - 1; i >= 0; i--) {
if (TimeHour(Time) == Hour_Num && TimeMinute(Time) == Minute_Num) {
if (ObjectFind("Time_vLine-" + Time) != 0) {
ObjectCreate("Time_vLine-" + Time, OBJ_VLINE, 0, Time, 0);
ObjectSet("Time_vLine-" + Time, OBJPROP_COLOR, Line_Color);
}
}
}
//==============
return (0);
}
//==============================================================================


Re: Vertical Line drawn at specified hour. How to make it refresh daily?

2
Newton51 wrote: Fri Apr 28, 2017 6:55 pm I've used this indicator for several years. As new MT4 builds keep updating, I noticed it no longer adds a new vertical line each day. I have been changing TF forward and back to refresh and it's good for another day. But I wonder if some kind person would make the changes necessary for it to just work all the time as it used to do in the past??

//================================================================
#property indicator_chart_window

input int Hour_Num = 8;
input int Minute_Num = 0;
input color Line_Color = clrSilver;

int init() {
return (0);
}

int deinit() {
int objs_total_0 = ObjectsTotal();
for (int i = objs_total_0 - 1; i >= 0; i--)
if (StringFind(ObjectName(i), "Time_vLine-") != -1) ObjectDelete(ObjectName(i));
return (0);
}

int start() {
//
int ind_counted_0 = IndicatorCounted();
for (int i = Bars - ind_counted_0 - 1; i >= 0; i--) {
if (TimeHour(Time) == Hour_Num && TimeMinute(Time) == Minute_Num) {
if (ObjectFind("Time_vLine-" + Time) != 0) {
ObjectCreate("Time_vLine-" + Time, OBJ_VLINE, 0, Time, 0);
ObjectSet("Time_vLine-" + Time, OBJPROP_COLOR, Line_Color);
}
}
}
//==============
return (0);
}
//==============================================================================


Newton51

Try like this :

Code: Select all

#property indicator_chart_window

input int Hour_Num = 8;
input int Minute_Num = 0;
input color Line_Color = clrSilver;

int init() {
return (0);
}

int deinit() {
int objs_total_0 = ObjectsTotal();
for (int i = objs_total_0 - 1; i >= 0; i--)
if (StringFind(ObjectName(i), "Time_vLine-") != -1) ObjectDelete(ObjectName(i));
return (0);
}

int start() {
//
int ind_counted_0 = IndicatorCounted();
for (int i = Bars - ind_counted_0 - 1; i >= 0; i--) {
if (TimeHour(Time[i]) == Hour_Num && TimeMinute(Time[i]) == Minute_Num) {
if (ObjectFind("Time_vLine-" + Time[i]) != 0) {
ObjectCreate("Time_vLine-" + Time[i], OBJ_VLINE, 0, Time[i], 0);
ObjectSet("Time_vLine-" + Time[i], OBJPROP_COLOR, Line_Color);
}
}
}
//==============
return (0);
}
//==============================================================================

Re: Vertical Line drawn at specified hour. How to make it refresh daily?

4
mladen wrote: Fri Apr 28, 2017 7:20 pm

Newton51

Try like this :

Code: Select all

#property indicator_chart_window

input int Hour_Num = 8;
input int Minute_Num = 0;
input color Line_Color = clrSilver;

int init() {
return (0);
}

int deinit() {
int objs_total_0 = ObjectsTotal();
for (int i = objs_total_0 - 1; i >= 0; i--)
if (StringFind(ObjectName(i), "Time_vLine-") != -1) ObjectDelete(ObjectName(i));
return (0);
}

int start() {
//
int ind_counted_0 = IndicatorCounted();
for (int i = Bars - ind_counted_0 - 1; i >= 0; i--) {
if (TimeHour(Time[i]) == Hour_Num && TimeMinute(Time[i]) == Minute_Num) {
if (ObjectFind("Time_vLine-" + Time[i]) != 0) {
ObjectCreate("Time_vLine-" + Time[i], OBJ_VLINE, 0, Time[i], 0);
ObjectSet("Time_vLine-" + Time[i], OBJPROP_COLOR, Line_Color);
}
}
}
//==============
return (0);
}
//==============================================================================
I pasted this alternative code over previous, compiled and attached. It has taken me a couple of days to realise the same problem exists. This alternative code seems to just stop working too. When I change timeframes, it refreshes and they're all back again. Perhaps there is another similar indicator? I use it mostly for highlighting the start of the London session and prefer it to classic "session" indicators. MQL just keeps evolving and indicators drop by the wayside ... including ones I paid for years ago :- (

Re: Vertical Line drawn at specified hour. How to make it refresh daily?

5
Newton51 wrote: Tue May 02, 2017 7:13 pm I pasted this alternative code over previous, compiled and attached. It has taken me a couple of days to realise the same problem exists. This alternative code seems to just stop working too. When I change timeframes, it refreshes and they're all back again. Perhaps there is another similar indicator? I use it mostly for highlighting the start of the London session and prefer it to classic "session" indicators. MQL just keeps evolving and indicators drop by the wayside ... including ones I paid for years ago :- (
Newton51

Just to clarify : you want some vertical line repeated at each day at exactly the same time?


Re: Vertical Line drawn at specified hour. How to make it refresh daily?

7
Newton51 wrote: Wed May 03, 2017 11:25 am Yes, I would like a vertical line to appear at the hour number used in inputs, for each day, and to continue to draw over time with each new day. The only way I can get it to do this is to constantly change timeframes forward/back or open inputs and close it again to force re-initialising.
Newton51

Try this indicator (it is as simple as it gets)

Re: Vertical Line drawn at specified hour. How to make it refresh daily?

8
I will. Many thanks again mladen. I learn a "new thing" or new technique on occasions such as this and add to my own knowledge. I appreciate you remembered my request.

On a separate matter, we used to have a small "thanks"/"like" button to click so as to acknowledge / express thanks and generally "like" something posted (an indicator, helpful info, etc.). I think it's a shame it is not here now as it would save thread space.

Re: Vertical Line drawn at specified hour. How to make it refresh daily?

9
Newton51 wrote: Fri May 05, 2017 10:16 am I will. Many thanks again mladen. I learn a "new thing" or new technique on occasions such as this and add to my own knowledge. I appreciate you remembered my request.

On a separate matter, we used to have a small "thanks"/"like" button to click so as to acknowledge / express thanks and generally "like" something posted (an indicator, helpful info, etc.). I think it's a shame it is not here now as it would save thread space.
I think that the most important is here though :

The way to communicate and to post good ideas (along with code) to each other
Happy coding :)

Re: Vertical Line drawn at specified hour. How to make it refresh daily?

10
mladen wrote: Thu May 04, 2017 6:19 pm

Newton51

Try this indicator (it is as simple as it gets)
Dearest Mladen, i would very much like to have a similar indicator, but drawing an "angle" instead of a line ... where the angle inclination will be given as a parameter ... the Angle must be applied at the "Low" for UP Trends and at the "High" for Down Trends ... I really thank you in advance for your support and contribution.
Best Regards
Dimitri


Who is online

Users browsing this forum: No registered users and 15 guests