Hello all, I'm transitioning to AmiBroker from TradeStation and I am having trouble changing the plot thickness or width of the Bollinger Bands. I've read through a number of posts and haven't found much that addresses this so any help would be greatly appreciated!
I've tweaked the Bollinger Bands indicator to show which band was touched most recently - basically, if price hit the upper band, the upper band would be thicker/bold until price hit the lower band. Below is a screenshot of how this indicator looks on TradeStation:
My AFL code is below:
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
UpperBand = BBandTop( P, Periods, Width );
LowerBand = BBandBot( P, Periods, Width );
UBBtouch = IIf(H >= UpperBand,1,0);
LBBtouch = IIf(L <= LowerBand,-1,0);
BarSinceLBB = BarsSince(LBBtouch);
BarSinceUBB = BarsSince(UBBtouch);
MostRecentBand = IIf( BarSinceLBB > BarSinceUBB, 1, -1);
My idea was to use the MostRecentBand value with an Iif to modify the Plot style or width, but when I've tried that I get the error that the function expects a number instead of an array:
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorTeal, IIf(MostRecentBand == 1, ParamStyle("Style", styleLine | styleThick), ParamStyle("Style", styleLine)));
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorTeal, IIf(MostRecentBand == -1, ParamStyle("Style", styleLine | styleThick), ParamStyle("Style", styleLine)));
After looking through some other posts, it seems like an easy alternative would be to change the colors instead of the thickness, which is certainly not the end of the world.
Thanks in advance for your help!
Ethan