This is a fault of tradingview - it only lets you calculate so much data. I have found if you use it at non-peak times it works... but most of the time if you're calculating a lot of data it wont work. Use TC2000 if AVWAP is central to your trading.
"For upgraded plans, the length of historical data for any intraday time interval is 10,000 bars/candles + additionally several bars/candles back to the beginning of the week, month or year (depending on the resolution). Unfortunately, this limit cannot be extended. We may at some point consider extending this feature, but no decision has been made and there is no ETA for said extension.
With that being said, if you change the chart interval to daily or daily-based, you will see a longer date range. We display all available data for daily-based intervals."
So they are claiming that it is not a data problem. However, having worked with this group at Multicharts for many years, it is my observation that their first reaction to a problem is "It's not us, it's something else, our work is just fine thank you." So as far as I'm concerned they do have a credibility problem.
I like to have the following baseline AVWAPs on my charts: Year to date, Month to date, Week to date, Latest high, Latest low. YTD is pretty much out of the question an this point, as we are over 4 months into the year. MTD, WTD, H, L usually work pretty good. Intraday a few days back always works.
So far I am using it with a premium plan and their free data. Has anyone tried it with a data subscription from the exchanges? I already pay for data at IB, so I don't pay for it on Tradingview. As a side note, I wonder if the paid subscription volume data would be different, yielding a different AVWAP curve. Can anyone comment on this?
I have been messing around with this script, partly to learn more about Pine, and partly to test some ideas that I had.
First, I converted it from v2 to v4.
Second, I started looking at the functions and trying to figure out why it was so stubborn about plotting when the anchor point was several months in the past. I think I have made some progress here. I started looking at the "security" function, and noticed the time interval was 1 minute in the script. If the script is calculating every minute, and you try to go back 3 months, that is 390 minutes/session x 66 trading days (approx), which is almost 25k calculations. My guess is this is where it is choking. So I changed the time interval from "1" to "D", and I was able to plot it back several years. Can probably go further, but I haven't tested beyond 2 years.
I am going to set up 6 separate scripts, named YTD AVWAP, MTD, WTD, HI, LO, INTRADAY. I'll set the security time interval to "D" for YTD, MTD, WTD, and probably "1", or some multiple, for the others, depending.
At any rate, I think this will fix the issue with not being able to use distant anchor points.