- Desktop
- Scripting
- Formulas and Scripting Functions
- Anchored VWAP function - AVWAP()
Anchored VWAP function - AVWAP()
Use the AVWAP() function to create a scan for price crossing above or below an anchored VWAP line. The VWAP anchor can be based off a rolling period, eg last month or change the Look Back Type to Fixed and select a specific date from the calendar.
Blog post: Scripting and Anchored VWAPs
Here’s crossing below the AVWAP over the last month:
CLOSE() CrossesBelow AVWAP(BACKTYPE=Month)To set the anchoring to a specific date:
CLOSE() Crosses AVWAP(BACKTYPE=Fixed, DATE=2020-03-01)To automatically draw the AVWAP from the year’s high in a Show Plot tool:
//Define starting date as first trading day of the year;Start = (BARDATE() == STRDATE(DATE=2020-01-02));
//Find where date matches the Highest High since Dec 31st;Sig = HIGH() == HIGHESTSINCE(Start);
//Remove Non Zero results to show date of high as latest value;$DATE = BarDate(NonZero(Sig));
//Calculate VWAP from High Date;AVWAP(BACKTYPE=Fixed, DATE=$DATE)Your privacy choices
We use cookies and similar technologies to make the site work, see how it's used, and improve it. Analytics and advertising cookies only run with your consent — see our Privacy Policy for details.