Unexpected results from Low[0] etc.

 

When I print out the values for Low[0], Open[0], Close[0], High[0] they contain the same number. It is the open price. If I print out the values for Low[1], Open[1], Close[1], High[1] they are different and correct.

Why is that? Has anyone else noticed this?

 
chiluver2:

When I print out the values for Low[0], Open[0], Close[0], High[0] they contain the same number. It is the open price. If I print out the values for Low[1], Open[1], Close[1], High[1] they are different and correct.

Why is that? Has anyone else noticed this?

if you are doing this at the beginning of the bar then you are getting the open price for the entire bar, you need to wait until the end of the bar before you know the low, high and close.


you also can't tell if you have reached the end of the bar (e.g. how can you tell when a tick arrives if it is the last tick of the bar), so the best method is to check the low, high and close of the previous bar.

 
densial wrote >>

if you are doing this at the beginning of the bar then you are getting the open price for the entire bar, you need to wait until the end of the bar before you know the low, high and close.

you also can't tell if you have reached the end of the bar (e.g. how can you tell when a tick arrives if it is the last tick of the bar), so the best method is to check the low, high and close of the previous bar.

Got it, Thanks for the info and taking the time to answer!!!!

 
densial wrote >>

if you are doing this at the beginning of the bar then you are getting the open price for the entire bar, you need to wait until the end of the bar before you know the low, high and close.

you also can't tell if you have reached the end of the bar (e.g. how can you tell when a tick arrives if it is the last tick of the bar), so the best method is to check the low, high and close of the previous bar.

I notice programmers using close[0] or high[0] etc. Are they not aware that regardless of which hlco[0] they use they're getting the same value?

I am still confused or is it they are confused?

Reason: