How To Set Bollinger Band Line Not Behind The Candle (front of the candle)

Guys Please Help, I can't figure it out how to make bollinger band line go to the front and not at behind of the candle:
BOL

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",0);
Periods = Param("Periods", 14, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BT" + _PARAM_VALUES(), colorGrey50, styleNoLabel ); 
Plot( BBandBot( P, Periods, Width ), "BB" + _PARAM_VALUES(), colorGrey50, styleNoLabel ); 
_SECTION_END();

this just default bollinger code..

Any solution or code that i need to add ??
Thanks

In the two Plot() functions, you can change the Zorder value to something higher than default 0, like 2.

It is explained here in detail:
https://www.amibroker.com/guide/afl/plot.html

2 Likes

Or change the ordering of Plot() calls.

4 Likes

Thanks guys, you are so kind to help :+1:t2:

i just add " graphzorder = 1; "

_SECTION_BEGIN("Bollinger Bands");
graphzorder = 1;
P = ParamField("Price field",-1);
Periods = Param("Periods", 14, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BT" + _PARAM_VALUES(), colorGrey50, styleNoLabel ); 
Plot( BBandBot( P, Periods, Width ), "BB" + _PARAM_VALUES(), colorGrey50, styleNoLabel ); 
_SECTION_END();

Great :smiley:

@travick, i try use " graphzorder = 1; "'
but it bring all indicator on top candle include MA, please if You have time, give me example with code how to use Zorder with Bollinger Band, sorry i'm not advance in coding.

Thanks

You were not supposed to use or set the graphzorder = 1; special variable.

Instead, you are supposed to define the ZOrder for the specific Plot() calls that you want to affect.

Only these two lines are supposed to be changed:

Plot( BBandTop( P, Periods, Width ), "BT" + _PARAM_VALUES(), colorGrey50, styleNoLabel, NULL, NULL, 0, 2 ); 
Plot( BBandBot( P, Periods, Width ), "BB" + _PARAM_VALUES(), colorGrey50, styleNoLabel, NULL, NULL, 0, 2 );

Look at the code above and just modify those parameters. Changing graphzorder is a completely different thing.

2 Likes

Yeah this what i need, i have try it and succesfully :smiley:

Thanks a lot @travick :+1:t2: