Outside bar - thick bar only

Hi All, I've modified the code in the forum for outside bars to be Green when closing above the previous day close, and red when closing below the previous day close.

_SECTION_BEGIN("Outsidebar");
outsidebarhigh = H >= Ref( H, -1 ) AND L <= Ref( L, -1 ) AND C > Ref( C, -1);
outsidebarlow = H >= Ref( H, -1 ) AND L <= Ref( L, -1 ) AND C < Ref( C, -1);
insidebar = H <= Ref( H, -1 ) AND L >= Ref( L, -1 );
upbar = H > Ref( H, -1 ) AND L >= Ref( L, -1 );
downbar = L < Ref( L, -1 ) AND H <= Ref( H, -1 );
graph0 = close;
graph0style = 128;
barcolor = IIF( outsidebarhigh, colorbrightGreen, IIF( outsidebarlow, colorRed, IIF( insidebar, 1, IIF( downbar, 1, IIF( upbar, 1, 0 ) ) ) ) );
graph0barcolor = ValueWhen( barcolor != 0, barcolor );
_SECTION_END();

I've been messing around with a bunch of variations to the code with the intention of showing the outside bar as a thick bar whilst the other bars are a standard thickness. This is one of the variations:

barcolor = IIF( outsidebarhigh, colorBrightGreen | styleThick, IIF( outsidebarlow, colorRed | styleThick, IIF( insidebar, 1, IIF( downbar, 1, IIF( upbar, 1, 0 ) ) ) ) );

Any suggestions would be greatly appreciated.
Thanks

@DazN, when you post some code you should use the required code tags.

JUST PRESS </> BUTTON BEFORE pasting the code

pastecode3

Moreover, the snippet you posted contains some very OLD instructions (graph0, graph0style, graph0barcolor) that, while still working, are obsolete: they could be replaced with the single function Plot(). Please see the bottom section of this guide page.

Anyway, here below is an example that I derived from the code you posted (I did not check for its correctness) that probably does what you were looking for (you can change the colors and the extra width using the parameters window):

outsideBarHigh = H >= Ref( H, -1 ) AND L <= Ref( L, -1 ) AND C > Ref( C, -1 );
outsideBarLow = H >= Ref( H, -1 ) AND L <= Ref( L, -1 ) AND C < Ref( C, -1 );
insideBar = H <= Ref( H, -1 ) AND L >= Ref( L, -1 );
upBar = H > Ref( H, -1 ) AND L >= Ref( L, -1 );
downBar = L < Ref( L, -1 ) AND H <= Ref( H, -1 );

// change the colors according to your color scheme
colorOutsideHigh = ParamColor( "Outside High bars", colorBrightGreen );
colorOutsideLow = ParamColor( "Outside Low bars" , colorRed );
colorInside = ParamColor( "Inside bars", colorGold );
colorUp = ParamColor( "Up bars", colorGreen );
colorDown = ParamColor( "Down bars", colorRed );
useStyleThick = ParamToggle( "Use 'styleThick' for all bars", "No|Yes", 1 );
outsideBarWidth = Param( "Percent width of 'outside' bars", 35, 20, 50, 1 );
barColors = IIF( outsideBarHigh, colorOutsideHigh, 
				IIF( outsideBarLow, colorOutsideLow, 
					IIF( insideBar, colorInside, 
						IIF( downBar, colorDown, 
							IIF( upBar, colorUp, colorDefault ) ) ) ) );
Plot( Close, "Close", barColors, styleBar | ( styleThick * useStyleThick ) );
// plot again - only draw outsideBarHigh OR outsideBarLow bars with an ultra thick style
condition = outsideBarHigh OR outsideBarLow;
Plot( IIf( condition, Close, Null ), "", barColors, styleBar | styleNoTitle | styleNoLabel, Null, Null, 0, 1, -outsideBarWidth );
1 Like

beppe thank you, appreciated.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.