I'm testing the creation of a new indicator to see how it works when added to a chart using drag and drop.
I created a very simple indicator to set the bar color to red if the current bar is a down close.
I created this indicator in the Custom folder. When I drag and drop it onto a price chart the bars with down closes do not turn red.
The following is the AFL for the chart after the indicator "PaintTest" has been dropped onto it.
If I change the Price section to include the setting of the bar color it works just fine but I'd like to be able to drag and drop this indicator onto the chart in the same manner as I would, for example, a moving average.
Is this possible? Am I making a rookie mistake? I've tried many variation of the PaintTest indicator but cannot get it to work using drag and drop.
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("PaintTest");
Color = IIf(C < Ref(C,-1), colorRed, colorDefault );
Plot( C, "Close", Color, styleBar);
_SECTION_END();