Your code makes not really sense, why not using dayOpen and dayClose of the previous day?