Pivot VWAP

Hi Darren,

How can I write a script to identify a 10-bar pivot while ignoring unconfirmed pivots, and have it automatically plot the AVWAP - OHLC?

Thanks,
Mo

Hi Mo,

Click here for a thread of useful AVWAP scripts, but here’s the formula for a Show Plot to draw the AVWAP from the last confirmed 10 bar pivot low:

//Set number of bars required for confirmed pivot LOW;
$PL=10;
P1=PIVOT(TYPE=Low, MIN=$PL, IGNOREUNCONFIRMED=True, DIR=Both);
//Get date of last pivot LOW;
$DATE = BarDate(NonZero(P1));
//Calculate AVWAP from last Pivot Low Date;
AVWAP(BACKTYPE=Fixed, DATE=$DATE)

A separate Show Plot from the 10 bar pivot high:

//Set number of bars required for confirmed pivot HIGH;
$PL=10;
P1=PIVOT(TYPE=High, MIN=$PL, IGNOREUNCONFIRMED=True, DIR=Both);
//Get date of last pivot HIGH;
$DATE = BarDate(NonZero(P1));
//Calculate AVWAP from last Pivot High Date;
AVWAP(BACKTYPE=Fixed, DATE=$DATE)

Here’s how they look on a daily chart of SPY:

1 Like

Thank you. I will give it a try tomorrow and see how it goes.