Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Improve your rating!
Ashok Nale
667
Ashok Nale 2012.05.06 13:55 

I am trying to dra object using Object create function giving properly time and price coordinates. As far as time coordinate is concered if it Time[n] where n=0,1,2,... it is ok. I have no problem drawing object but hen I use n= -1,-2,-3,..... it desnt draw on future bar postions. I get time value corresponding to Time[-1],Time[-2]... as 1970.01.01. Not sure how I can draw objects on chart on future time.

I would appreciate is anyone can through some light on this?

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2012.05.06 14:02  
You don't draw Objects using bar number you use datetimes . . . so use datetimes . . . if you want an Object at "time[-1]" use time[0] + ( Period() * 60 ) . . . of course this is problematic during a weekend . . . or when a weekend is between now and when you want your object placed . . .
Ashok Nale
667
Ashok Nale 2012.05.06 14:10  
RaptorUK:
You don't draw Objects using bar number you use datetimes . . . so use datetimes . . . if you want an Object at "time[-1]" use time[0] + ( Period() * 60 ) . . . of course this is problematic during a weekend . . . or when a weekend is between now and when you want your object placed . . .

Excellent. Thanks a lot. it works.
Szilard Kallai
145
Szilard Kallai 2012.12.14 14:17  
RaptorUK:
You don't draw Objects using bar number you use datetimes . . . so use datetimes . . . if you want an Object at "time[-1]" use time[0] + ( Period() * 60 ) . . . of course this is problematic during a weekend . . . or when a weekend is between now and when you want your object placed . . .

Thanks Moderator! You also helped for me!

Hening Paradigma
6
Hening Paradigma 2015.11.24 05:34  

Hello, I am trying to draw object in future time (the time after index 0) using "time[0] + ( Period() * 60 )". I am find difficulty when I facing weekend date because the object that I want to create is passing weekend data. More over, I find more difficulties when I want to create object between past time (the time before index 0) and future time (the time after index 0), as we know the past time axis does not include weekend data but the future time axis does include weekend data.

Does anyone has any tips to write the code for this case in simple way? I will very appreciate for any tips that you share.

whroeder1
13596
whroeder1 2015.11.24 12:32  
hparadigma: I am find difficulty when I facing weekend date
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. Time[0 + n * PeriodSeconds() will work until the start of the new week (or past market holiday.) Then move the end point.
Hening Paradigma
6
Hening Paradigma 2015.12.01 05:48  

Hello mr WHRoeder,

Thank you for your response.

1. Yes. You are right, sir. My question was not clear. I have some difficulties (confusion exactly) to described my problem because I was writing a multi time frame indicator. So I just asking in general term. I am sorry. Next time, I will described my problem clearly.

2. I have solved my problem about putting an object on the chart especially when facing weekend data using (Time[0] + n * PeriodSeconds()). Thank you sir.

warm regards,
/
To add comments, please log in or register