1)Draw a line from the start of today (day 0) till the end of tomorrow.
datetime tomorrows_time = iTime(NULL,PERIOD_D1,0) + 86399; ObjectCreate("line",OBJ_TREND,0,iTime(NULL,PERIOD_D1,0),1305.00,tomorrows_time,1305.00);
-I don't want to have a million lines so to keep things clean, I want to delete the previous day's lines. The reason I'm asking is because I want to know if it is efficient remove the drawings and redraw them every time the script is executed (which I set to execute every hour). Or is there a more efficient way to do this.
you can use
ObjectSet("line",OBJPROP_PRICE1, iTime(NULL,PERIOD_D1,0)); ObjectSet("line",OBJPROP_PRICE2, tomorrows_time);
works great. thx qjol.
should add that it should be 172800 instead of 86399. :)
should add that it should be 172800 instead of 86399. :)
-1 = 172799
I thought you need the end of the day
Er sorry for bumping. Something came up...
I had an issue when it came to weekends. I'm not sure if this is working as intended, but the mt4 client counted the weekends as part of the calculation.
Problem description:
-How to draw a line to connect from Friday to Monday. If I drew a line till "iTime(NULL,PERIOD_D1,1) + 172799", the lines appear truncated because the weekends are longer than 172799 secs.
make an if statement
datetime tomorrows_time = iTime(NULL,PERIOD_D1,0) + 172799; if (TimeDayOfWeek(iTime(NULL,PERIOD_D1,0)) == 5) tomorrows_time = iTime(NULL,PERIOD_D1,0) + 259199;
problem solved ;-)
ahh. goodstuff :)
thx again qjol
you can use
Merci, parfait.
Solved until you encounter a market holiday

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys... I don't really know how to do this. Not even sure if it is possible...
Problem description:
1)Draw a line from the start of today (day 0) till the end of tomorrow.
-The issue I have is that there is no way to draw a line into the future (or I just don't know how). I don't want to use a horizontal line or a rayed-trendline. I simply want to use a trendline that will draw from the current day up till the next day. Things like iTime only returns a value up to bar 0 which is the current bar.
Example:
2)When a new day is here (day_0 ), remove lines from yesterday (day 1).
-I don't want to have a million lines so to keep things clean, I want to delete the previous day's lines. The reason I'm asking is because I want to know if it is efficient remove the drawings and redraw them every time the script is executed (which I set to execute every hour). Or is there a more efficient way to do this.
My current code: