0

Bear with the length of this but it is confusing the heck out of me. When I run this statement in trading view on a Daily Chart:

open1 = request.security(syminfo.tickerid, "M", open[12])

and put open1 in a table cell, I expect to get the previous year's monthly open for the current month put into the cell. Since the current month is September, I expect to get last September's monthly open put into the cell when I run the statement. Here is what actually happens:

If it's after market hours, that statement puts the previous year's August monthly open into the cell and keeps it there.

If it's during market hours, the same statement initially puts the previous year's August monthly open in the cell, then a few seconds later last year's September monthly opened is entered into the cell (which is the value I'm expecting).

For example, as I type this, it's after market hours, and for MSFT, 420.79 gets put into the cell and stays there. Bu this is the previous year's August monthly opening price, and not what I'm asking for.

However, if I switch the chart to a Monthly chart, the same exact statement puts 417.91 into the cell, which is the correct value for the last September's monthly open for MSFT.

So in summary, when I run this statement during market hours on a daily chart, I get the correct monthly value entered into the cell, but not right away. For example using September as an example again, the August valule shows up first for a few seconds, and then September's value is written in.

After market hours, on a daily chart, running this statement gives the previous year's August monthly open and leaves it in the cell.

After market hours or during, on a monthly chart, the previous September's monthly open is entered into the cell, as expected.

Any idea of what is happening on the daily chart? I don't have a paid supscription to Trading View, so maybe that's somehow connected to the results I'm getting?

The statement in question is pretty cut and dry. It's September, and I want last September's monthly open. The statement should do that. On a daily chart, after market hours it's giving me the previous year's August monthly open.

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Sep 22 at 22:49
  • The community bot indicates my question as written is too hard to tell what I'm asking. I don't think it is, but as an alternative, is there a way to get historical monthly ohlc data other than by the request. Security() call? While using a daily timeframe? Commented Sep 22 at 23:22
  • Found the solution. What I need to do is add the lookahead attribute with barmerge.lookahead_on selected. Commented Sep 23 at 2:00

1 Answer 1

0

Found the solution. What I neededto do is add the lookahead attribute to the request.Security() call with barmerge.lookahead_on selected.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.