Currently I am able to plot previous day vwap values using this.

_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

_SECTION_END();

_SECTION_BEGIN("VWAP");

Period = ParamList( "Base", "Hourly|Daily|Weekly|Monthly|Lastthursday|Yearly", 1 );

if(Period=="Daily" )

{//OR Interval()==3600

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));

StartBar = ValueWhen(TimeNum() == 090000, BarIndex());

TodayVolume = Sum(V,Bars_so_far_today);

IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,0);

}

if(Period=="Weekly" OR Interval()==24 * 3600 )

{

Bars_so_far_today = 1 + BarsSince(DayOfWeek() < Ref( DayOfWeek(), -1 ));

StartBar = ValueWhen(TimeNum() == 090000, BarIndex());

Vol = TimeFrameGetPrice("V", inWeekly, 0);

TodayVolume = Sum(Vol,Bars_so_far_today);

IIf (BarIndex() >= StartBar, VWAP = Sum (C * Vol, Bars_so_far_today ) / TodayVolume,0);

}

if(Period=="Monthly" )

{

Bars_so_far_today = 1 + BarsSince(Month() != Ref(Month(), -1));

Vol = TimeFrameGetPrice("V", inMonthly, 0);

StartBar = ValueWhen(TimeNum() == 090000, BarIndex());

TodayVolume = Sum(Vol,Bars_so_far_today);

IIf (BarIndex() >= StartBar, VWAP = Sum (C * Vol, Bars_so_far_today ) / TodayVolume,0);

}

Plot (VWAP, "Vwap",colorBlack | styleThick);

SetBarsRequired( 1500, 0 );

EndOfDay = Day() != Ref(Day(), 1);

DayStart = Day() != Ref(Day(), -1);

D2 = ValueWhen(EndOfDay, VWAP, 1);

D3 = ValueWhen(EndOfDay, VWAP, 2);

D4 = ValueWhen(EndOfDay, VWAP, 3);

Plot(D2, "D2", colorYellow, styleThick);

Plot(D3, "D3", colorRed, styleThick);

Plot(D4, "D4", colorBlack, styleThick);

_SECTION_END();

What I need help with is setting up the parameters as mentioned in my first post and plotting the highest, lowest and the average vwap from the range I select from the parameters.

e.g. Here I want to calculated average of last 4 days vwap, highest of last 4 days vwap and lowest of last 4 days vwap and plot them on the chart.

-anayash