// Current Week only
WeekNow = Week() == LastValue(Week()) AND Year() == LastValue(Year());
Getting an error in the above line of the following code. I want to plot last OHLC lines on current week's chart only. Not in previous weekly charts. Same working for Daily and Monthly Charts but in weekly it shows an error 30, 70 and 1. Anybody help please.
_SECTION_BEGIN("Prior Week OHLC");
PWH_Color = ParamColor("PWH Color", colorRed);
PWH_Style = ParamStyle("PWH Style", styleThick | styleNoRescale);
PWL_Color = ParamColor("PWL Color", colorGreen);
PWL_Style = ParamStyle("PWL Style", styleThick | styleNoRescale);
CWO_Color = ParamColor("CWO Color", colorBlack);
CWO_Style = ParamStyle("CWO Style", styleThick | styleNoRescale);
PWC_Color = ParamColor("PWC Color", colorBlue);
PWC_Style = ParamStyle("PWC Style", styleThick | styleNoRescale);
// Get Weekly values
PWH_raw = TimeFrameGetPrice("H", inWeekly, -1);
PWL_raw = TimeFrameGetPrice("L", inWeekly, -1);
CWO_raw = TimeFrameGetPrice("O", inWeekly, 0);
PWC_raw = TimeFrameGetPrice("C", inWeekly, -1);
// Current Week only
WeekNow = Week() == LastValue(Week()) AND Year() == LastValue(Year());
PWH = IIf(WeekNow, PWH_raw, Null);
PWL = IIf(WeekNow, PWL_raw, Null);
CWO = IIf(WeekNow, CWO_raw, Null);
PWC = IIf(WeekNow, PWC_raw, Null);
xPos = BarCount + 4;
Plot(PWH, "PWH", PWH_Color, PWH_Style);
Plot(PWL, "PWL", PWL_Color, PWL_Style);
Plot(CWO, "CWO", CWO_Color, CWO_Style);
Plot(PWC, "PWC", PWC_Color, PWC_Style);
// Only show text if valid value exists
if (!IsNull(LastValue(PWH)))
PlotText("Previous Week High", xPos, LastValue(PWH), PWH_Color);
if (!IsNull(LastValue(PWL)))
PlotText("Previous Week Low", xPos, LastValue(PWL), PWL_Color);
if (!IsNull(LastValue(CWO)))
PlotText("Current Week Open", xPos, LastValue(CWO), CWO_Color);
if (!IsNull(LastValue(PWC)))
PlotText("Previous Week Close", xPos, LastValue(PWC), PWC_Color);
_SECTION_END();