PRATAP SIR I HAVE THIS AFL , but i want only yellow line vwap afl code seperatly , so can u
do it for me ??
*******
_SECTION_BEGIN("VWAP 3Days");
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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
nb = Param("ToDay+Number of Bars",151,1,1500,75);
ND = Day() != Ref(Day(), -1);
///// VWAP and SDs /////
P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(Ref(ND,-1+nb), BI);
BeginBI = BeginBI[BarCount -1];
GfxTextOut("BI"+BI,5,150);
if(BeginBI < BarCount - 1)
{
InRange = BI >= BeginBI;
CumV = Cum(V * InRange);
CumVWP = Cum(VWP * InRange);
VWAP = CumVWP / CumV;
S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
Variance = S / CumV;
SD = sqrt(Variance);
VWAP = IIf(InRange, VWAP, Null);
//PPC = ValueWhen( nd == True, Ref(VWAP, -1), 1);
//Plot ( PPC, "PPC", colorBlue, styleDots|styleNoLine|styleNoRescale );
Plot(VWAP, "VWAP", colorYellow, styleNoTitle + styleNoRescale);
Plot(VWAP + SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP - SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
//Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
//Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
}
GraphXSpace=10;
_SECTION_END();
_SECTION_BEGIN("VWAP IT");
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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
ND = Day() != Ref(Day(), -1);
///// VWAP and SDs /////
P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(ND, BI);
BeginBI = BeginBI[BarCount -1];
if(BeginBI < BarCount - 1)
{
InRange = BI >= BeginBI;
CumV = Cum(V * InRange);
CumVWP = Cum(VWP * InRange);
VWAP = CumVWP / CumV;
S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
Variance = S / CumV;
SD = sqrt(Variance);
VWAP = IIf(InRange, VWAP, Null);
Plot(VWAP, "VWAP", colorBlack, styleNoTitle + styleNoRescale);
Plot(VWAP + SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP - SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
}
_SECTION_END();
_SECTION_BEGIN("BACK COLR");
SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
_SECTION_END();