line showing the close with a little twist

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

line showing the close with a little twist

Postby arnie » 29 Mar 2014

Hi.

Sometimes, having only the close is more than enough but I had not found the best way to plot it.
I saw some line charts where we could see a different color for up and down closes which called my attention.

I replicated it on MC and then decided to also add to it a little twist.
Actually see the last bar/candle whereas the previous closes are shown as lines.

I'd like to thank ABC for his help.

Code: Select all

Inputs:
UpColor (rgb(55,109,200)),
DownColor (rgb(188,0,0)),
PlotZeroLine (false),
PlotLastBar (false),
UpDnLineSize (2),
OpenBarSize (1), // if plotting a candle leave it at 1
HighBarSize (1), // if plotting a candle leave it at 1
LowBarSize (1), // if plotting a candle leave it at 1
CloseBarSize (1); // if plotting a candle leave it at 1


plot1(close,"close", default, default, UpDnLineSize);

if close > close[1] then
SetPlotColor[1](1, upcolor)
else
SetPlotColor[1](1, downcolor);

if PlotZeroLine = true then
plot2(0,"0", darkgray);

if PlotLastBar = true then begin
if close >= close[1] then begin
plot3[-1](high,"high",upColor,default,HighBarSize);
plot4[-1](low,"low",upColor,default,LowBarSize);
plot5[-1](close,"close",upcolor,default,CloseBarSize);
plot6[-1](open,"open",upColor,default,OpenBarSize);
end
else begin
plot3[-1](high,"high",DownColor,default,HighBarSize);
plot4[-1](low,"low",DownColor,default,LowBarSize);
plot5[-1](close,"close",DownColor,default,CloseBarSize);
plot6[-1](open,"open",DownColor,default,OpenBarSize);
end;
end;

if barstatus = 2 then begin
NoPlot[-1](3);
NoPlot[-1](4);
NoPlot[-1](5);
NoPlot[-1](6);
end;

Image
Attachments
up_dn_line02.jpg
(76.32 KiB) Downloaded 796 times

Return to “User Contributed Studies and Indicator Library”