Time functions with manually set Bar

Posted By: Zheka

Time functions with manually set Bar - 05/25/22 13:48

In this snippet in EXITRUN/ evaluate():

for (Bar=X; Bar<Y; Bar++) {
watch("! tod=", tod(0), priceC(0) );
}
the returned close price IS changing in line with changing Bar, but not tod.

This looks inconsistent.

Posted By: Zheka

Re: Time functions with manually set Bar - 05/25/22 14:03

for (Bar=X; Bar<Y; Bar++) {
int bOff = NumBars-1 - Bar;

watch("! ltod=", ltod(ET, bOff) );
}

doesn't work either.
Posted By: Petra

Re: Time functions with manually set Bar - 05/25/22 19:45

https://zorro-project.com/manual/en/numbars.htm

Bar is the current bar index. Overwriting the current bar index is probably no good idea.

All price and time functions have offset parameters.
Posted By: Zheka

Re: Time functions with manually set Bar - 05/25/22 22:06

I am not 'overwriting' the current bar index. I am going through Bars manually once again in EXITRUN (i recall manual mentions such possibility of manually changing the Bar index; and it works).

All price and time functions have offset parameters. - Right. And - as expected - priceClose(0) does return the close price of the set Bar, but neither tod(0) nor tod(NumBars-1-Bar) do.
© 2024 lite-C Forums