Posted By: ozgur
price...() returns last bar close regardless of TimeFrame - 12/26/19 14:09
Hi,
I am reading through the Manual and the "price" page says
Returns the open, close, maximum and minimum price of the bar period or time frame with the selected asset. priceClose(0) returns the current price.
Then I made this very simple script below.
As you can see the screenshot below, priceClose() returns the last bar (1 hour TF) value instead of the last Timeframe (4 hour TF) value unless it is defined as series(). I was expecting values from both series and single variable same. Am I missing something?
Thanks a lot
Note: I also tried other price functions such as price(), priceOpen() as well, experiencing the same behaviour.
Output:
I am reading through the Manual and the "price" page says
Quote
Returns the open, close, maximum and minimum price of the bar period or time frame with the selected asset. priceClose(0) returns the current price.
Then I made this very simple script below.
Code
function run() { BarPeriod = 60; TimeFrame = 4; vars cls_series = series(priceClose(0)); var cls_val = priceClose(0); printf("\nFrom series: %f vs Other: %f", cls_series[0], cls_val); }
As you can see the screenshot below, priceClose() returns the last bar (1 hour TF) value instead of the last Timeframe (4 hour TF) value unless it is defined as series(). I was expecting values from both series and single variable same. Am I missing something?
Thanks a lot
Note: I also tried other price functions such as price(), priceOpen() as well, experiencing the same behaviour.
Output: