_SECTION_BEGIN("Price");
//change the price candle color if it is nearing previous week high or low
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 ), styleNoDraw |styleNoTitle | ParamStyle("Style-NoDraw",styleNoLabel) | GetPriceStyle() );
WH= TimeFrameGetPrice("H", inWeekly, -1); // 0 for current week
WL= TimeFrameGetPrice("L", inWeekly, -1);
ShowWeeklyHL= ParamToggle("ShowWeeklyHL", "No|Yes", 0);
if(ShowWeeklyHL)
{
W1HColor= ParamColor("W1HColor", colorBlue);
W1LColor= ParamColor("W1LColor", colorBlue);
W1HStyle= ParamStyle("W1HStyle", styleDots|styleNoLabel|styleNoRescale);
W1LStyle= ParamStyle("W1LStyle", styleDots|styleNoLabel|styleNoRescale);
Plot(WH, "WH", W1HColor, W1HStyle);
Plot(WL, "WL", W1LColor, W1LStyle);
};
upCandleColor=ParamColor("Up Candle Color", colorGreen );
downCandleColor=ParamColor("Down Candle Color", colorBrown );
boundaryCandleColor=ParamColor("Boundary Candle Color", colorYellow );
upCandleCondition=C>O;
downCandleCondition=C<O;
//candleOutLineColor=IIf(upCandleCondition, upCandleColor, downCandleColor);
candleFillColor=IIf(upCandleCondition, upCandleColor, downCandleColor);
PointsDifference=Param("Points Difference",10);
candleFillColor=IIf(abs(WH-H)<PointsDifference OR abs(L-WL)<PointsDifference,boundaryCandleColor,candleFillColor);
//SetBarFillColor(candleFillColor);
Plot(C, "Close", candleFillColor, styleNoTitle | ParamStyle("Price Style-Draw") | GetPriceStyle());
//Plot(C, "Close", candleOutLineColor, styleNoTitle | ParamStyle("Price Style", styleNoLabel) | GetPriceStyle());
_SECTION_END();