How to Limit Number of Lines Displayed by This Indicator?

 
hi i use this simple vertical line indicator to mark ny open and close times but i don't want an infinite number of lines on the chart, rather only have 3 or 4 lines at any given time. what can be added to the code to allow me to choose how many lines will be shown? thanks
Files:
Two_lines.mq4  3 kb
 
hi buddy you need to add limit in you for operator
 
goverkms:
hi buddy you need to add limit in you for operator
thanks for the reply, i am not a coder so i would need some help with the code
 
grrbear :
thanks for the reply, i am not a coder so i would need some help with the code
Will be drawn four pairs of lines. The number of pairs of lines = 4.
Files:
Two_lines.mq4  3 kb
 
barabashkakvn:
Will be drawn four pairs of lines. The number of pairs of lines = 4.
thanks! i need lines for ny open and close though
 
grrbear :
thanks! i need lines for ny open and close though
You can determine the time - in the indicator settings.
 
barabashkakvn:
You can determine the time - in the indicator settings.

thanks again. it was showing 10 lines when both open and close were used, i'm guessing 8 plus 2. i changed this line of code from 8 to 2 and now it shows 4 lines(2 + 2):

if(count_lines>2)  // (the number of pairs of lines)*2

the problem now is when i change to lower time frames there are too many lines again, until i change time frames again. this would require me to change the time frame twice in order to get rid of the extra lines each time

Reason: