Painting wick and body not properly done

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Painting wick and body not properly done

Postby arjfca » 05 Mar 2020

Hello

Under a given conditions, I want to paint either the upper or lower wick and the body of a bar

The problem is the second line of the code reset the size of the previous line value given by the variable "barsize". See both condition in the attached picture

Martin

Code: Select all

if High[1] > maxlist(open,close)and Low[1] < minlist(open,close) then begin print ("colored bar_1"); if open <= close then begin PlotPb(open,close ,"colorbar",upcolor, default,barsize); PlotPb(low,open,"colorbar_1",upcolor,default,1); end else begin PlotPb(Open,close ,"colorbar",dncolor, default,barsize); PlotPb(high,close,"colorbar_1",dncolor,default,1); end; end
https://i.imgur.com/ZOPGSlN.png
https://i.imgur.com/yZxKGvX.png

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Painting wick and body not properly done

Postby TJ » 05 Mar 2020

Instead of using PlotPB, it would be easier to set out each individual plots separately.

ie:

Code: Select all

Plot1( O, "Open", color, default, LineWidth ); Plot2( H, "High", color, default, LineWidth ); Plot3( L, "Low", color, default, LineWidth ); Plot4( C, "Close", color, default, LineWidth );
It might seem tedious at first, but you will find it simplifies debugging and visual management.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Painting wick and body not properly done

Postby arjfca » 06 Mar 2020

OK, I will try it when back home.
Thanks TJ.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Painting wick and body not properly done

Postby JoshM » 07 Mar 2020

Did you get it implemented? I didn't so I'm wondering how you did it. :)

User avatar
Anna MultiCharts
Posts: 560
Joined: 14 Jul 2017
Has thanked: 42 times
Been thanked: 140 times

Re: Painting wick and body not properly done

Postby Anna MultiCharts » 12 Mar 2020

Hello arjfca,

You may also what to try this:

Code: Select all

if High[1] > maxlist(open, close) and Low[1] < minlist(open, close) then begin if open <= close then begin plot1(open, "open_up_1", yellow , yellow, 15); plot2(close, "close_up", yellow, yellow, 15); plot3(open, "open_up_2", yellow, yellow, 1); plot4(low, "low_up", yellow, yellow, 1); end else begin plot5(open, "open_down", red, red, 15); plot6(close, "close_down_1", red, red, 15); plot7(close, "close_down_2", red, red, 1); plot8(high, "high", red, red, 1); end; end;
Remember to configure the plot styles in the Format study window -> Style tab.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Painting wick and body not properly done

Postby janus » 03 Apr 2021

Neither method works. Can or can't we paint the tail the same color as the candle body?

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Painting wick and body not properly done

Postby Svetlana MultiCharts » 22 Apr 2021

For Candlestick chart style:
The whole wick is painted in a single color. The color is determined by Bar High plot.
The candle body is painted in a single color. The color is determined by Bar Open plot.
Pre-built MACD Gradient indicator paints the body and wick the same color.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: Painting wick and body not properly done

Postby janus » 22 Apr 2021

Thank you Svetlana, albeit it's not the complete answer. I've finally figured it out. The solution is as follows by way of an example:

Plot21(symbol_high);
Plot22(symbol_low);
Plot23(symbol_open);
Plot24(symbol_close);
SetPlotColor(21,cyan); // tail color
SetPlotColor(23,yellow); // body color

and in the Chart Style for the study, the plot type for each of the 4 Plot commands above must be set to Bar High, Bar Low, Left Tick, and Right Tick, respectively. I can't use the traditional PlotPaintBar method since there is no sure way of knowing the plot numbers in order to set the colors in the study under program control.


Return to “MultiCharts”