'Amibroker AFL: How to plot Custom Anchored VWAP (AVWAP) passing any specific date to it

Below is the code for Anchored VWAP which will select Date based on my mouse click, my query is how to plot Anchored VWAP passing date as a parameter, so it will be constant across all symbols.

Eg: I want to pass "2021-03-26" as Date parameter so it will plot AVWAP starting from "2021-03-26" date.

_SECTION_BEGIN("CustomAVWAP");
dn = DateTime();
sd = SelectedValue( dn );
start = dn == sd;

mp = C;
PV = mp * V;
CV = Cum( V );
VSS = CV - ValueWhen( start, CV );
denom = IIf( VSS == 0, 1, VSS );
num = Cum( PV ) - ValueWhen( start, Cum( PV ) );
M = IIf( BarsSince( start ), num/denom, mp );

Plot( C, Date() + " Close", colorBrightGreen, styleBar );
Plot( M, "PSVWAP", colorBrightGreen, styleThick );

_SECTION_END();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source