Functions: dayOpen/dayClose - BarPeriod

Posted By: kerplunk1899

Functions: dayOpen/dayClose - BarPeriod - 10/10/18 07:08

Hi all,

first of all, thank you guys for your constant support.
The tool is amazing, I'm facing the trading world as a beginner, but the scripting factor makes it so much more exciting.

Here's my issue.
I'm trying to get the exact closing and opening prices of the day before.
I found on the manual these two function that firstly seem to fit perfectly.
I'm using them like this:
- dayOpen(UTC, 1)
- dayClose(UTC, 1)

I'm trying with EUR/USD.
What I found out is a different behaviour of the functions when different BarPeriod are set.

I usually work with a BarPeriod = 1, so I would like to get the priceClose of the bar at 23.59 of the day before.
When I set it like this tough, the prices returned by the functions don't look right at all.
If I try to set it equals to 1440, the prices look perfect and match to what is shown in the ZHistoryEdior.


Can you please explain me why?
Is there a way to solve the issue obtaining the Open and Close price of the day before even with a BarPeriod equals to 1?
Should I maybe make use of the TimeFrame variable?


Thanks so much!
Regards,
Luca
Posted By: jcl

Re: Functions: dayOpen/dayClose - BarPeriod - 10/11/18 06:46

It`s normally the other way around: the higher the bar period, the lower the price resolution, including dayOpen/Close. You can check their code in indicators.c.
© 2024 lite-C Forums