i want to plot vertical lines at timeSelsect (10 or 11h ) and timeSelcet+5 but it draws only one time why?
thank you

- www.mql5.com
<CODE REMOVED>
Please edit your post . . .
i want to plot vertical lines at timeSelsect (10 or 11h ) and timeSelcet+5 but it draws only one time why?
thank you
Why don't you right click the chart and select Object List and then select click "List All" button. You will see there that you probably already have 2 vertical lines of Red "VerticalStart" and Dark Violet "VerticalEnd".
The problem that the second vertical line is not displayed is because it was created on same time-coordinate like the first vertical line and you have to wait for 5 hours to get this second vertical line displayed.
EDIT : The code is correct .
if(Time.hour==TimeSelect && Time.min==0) //draw vertical line at TimeSelect { ObjectCreate(0,"VerticalStart",OBJ_VLINE,0,rates[0].time,0); ObjectSetInteger(0,"VerticalStart",OBJPROP_COLOR,clrRed); } if(Time.hour==TimeSelect+5 && Time.min==0) //draw vertical line at TimeSelect+5 { ObjectCreate(0,"VerticalEnd",OBJ_VLINE,0,rates[0].time,0); ObjectSetInteger(0,"VerticalEnd",OBJPROP_COLOR,clrDarkViolet);
Why don't you right click the chart and select Object List and then select click "List All" button. You will see there that you probably already have 2 vertical lines of Red "VerticalStart" and Dark Violet "VerticalEnd".
The problem that the second vertical line is not displayed is because it was created on same time-coordinate like the first vertical line and you have to wait for 5 hours to get this second vertical line displayed.
thank you for your reply
Pardon my english but the problem is not to draws lines at time and time+5 but my problem is to draws lines at time and time+5 EVRY DAYS .
tester draws line only one time but i want to draw lines the 1 may ,2 may ,3 may .... at time and time+5
thank you for your help

- www.mql5.com
dan5:
thank you for your reply
Pardon my english but the problem is not to draws lines at time and time+5 but my problem is to draws lines at time and time+5 EVRY DAYS .
tester draws line only one time but i want to draw lines the 1 may ,2 may ,3 may .... at time and time+5
thank you for your help
Yesterday, because of your indenting style, I had problem reading your code, Today I re-read your code and your code is correct in using rates[0].time.
If you want to draw several objects, then you have to name the objects differently
string name; name = "VerticalStart" + TimeToString (rates[0].time, TIME_DATE|TIME_SECOND); ObjectCreate(0,name,OBJ_VLINE,0,rates[0].time,0);
- en.wikipedia.org
Yesterday, because of your indenting style, I had problem reading your code, Today I re-read your code and your code is correct in using rates[0].time.
If you want to draw several objects, then you have to name the objects differently
int OnInit() { //if(data.day_of_year>=Sommerzeit && data.day_of_year<=Winterzeit) TimeSelect=11; else TimeSelect=10; return(0); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { ArraySetAsSeries(rates,true); int copied=CopyRates(_Symbol,0,0,100,rates); if(copied>0) { TimeToStruct (rates[0].time, Time); if( Time.day_of_year>=Sommerzeit && Time.day_of_year<=Winterzeit) TimeSelect=11; else TimeSelect=10; if( Time.hour==TimeSelect && Time.min==0) //draw vertical line at TimeSelect { ObjectDelete(0,oldnameVstart); name = "VerticalStart" + TimeToString (rates[0].time, TIME_DATE|TIME_SECONDS); ObjectCreate(0,name,OBJ_VLINE,0,rates[0].time,0); ObjectSetInteger(0,name,OBJPROP_COLOR,clrRed); oldnameVstart= name; } if( Time.hour==TimeSelect+5 && Time.min==0) //draw vertical line at TimeSelect+5 { ObjectDelete(0,oldnameVstop); name = "VerticalEnd" + TimeToString (rates[0].time, TIME_DATE|TIME_SECONDS); ObjectCreate(0, name,OBJ_VLINE,0,rates[0].time,0); ObjectSetInteger(0, name,OBJPROP_COLOR,clrDarkViolet); oldnameVstop= name; ArraySetAsSeries(hg,true); ArraySetAsSeries(lw,true); CopyHigh(_Symbol,_Period,TimeCurrent(),5,hg); CopyLow(_Symbol,_Period,TimeCurrent(),5,lw); double Top = rates[ArrayMaximum(hg,0,WHOLE_ARRAY)].high; double Bottom = rates[ ArrayMinimum(lw,0,WHOLE_ARRAY)].low; // draw horizontal line at the top of 5 last candles ObjectDelete(0, oldnameHTop); name = "HorizontalTop" + TimeToString (rates[0].time, TIME_DATE|TIME_SECONDS); ObjectCreate(0,name,OBJ_HLINE,0,rates[0].time,Top); ObjectSetInteger(0,name ,OBJPROP_COLOR,clrGreenYellow); oldnameHTop= name; // draw horizontal line at the bottom of 5 last candles ObjectDelete(0,oldnameHBottom); name = "HorizontalBottom" + TimeToString (rates[0].time, TIME_DATE|TIME_SECONDS); ObjectCreate(0,name,OBJ_HLINE,0,rates[0].time,Bottom); ObjectSetInteger(0,name ,OBJPROP_COLOR,clrCrimson); oldnameHBottom= name; } } }

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