Using paint bar to highlight previous bars  [SOLVED]

Questions about MultiCharts and user contributed studies.
jl12
Posts: 220
Joined: 29 Jun 2007
Has thanked: 10 times
Been thanked: 9 times
Contact:

Using paint bar to highlight previous bars

Postby jl12 » 10 Sep 2015

I would like to use paint bar to highlight the last (x) number of bars is this possible.

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

Re: Using paint bar to highlight previous bars

Postby TJ » 10 Sep 2015

I would like to use paint bar to highlight the last (x) number of bars is this possible.

That is a loaded question.
The short answer is YES and NO.

But I am sure you are going come back and ask "How"?

If you want to use the PlotPaintBar keyword, the answer is no.

But if your end goal is to make certain chart presentation,
you can always use the PLOT keyword and/or the SETPLOTCOLOR keyword to modify previous bars attributes.

jl12
Posts: 220
Joined: 29 Jun 2007
Has thanked: 10 times
Been thanked: 9 times
Contact:

Re: Using paint bar to highlight previous bars

Postby jl12 » 13 Sep 2015

Thanks for your response TJ, but I am no closer to back plotting bars.

I've tried using the plot function, I can plot H and low for 10 days ago today by Plotting h[10],L[10] but this plots the value today.
The issue is I can't back plot a bar after it has occurred.

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

Re: Using paint bar to highlight previous bars

Postby TJ » 13 Sep 2015

Thanks for your response TJ, but I am no closer to back plotting bars.

I've tried using the plot function, I can plot H and low for 10 days ago today by Plotting h[10],L[10] but this plots the value today.
The issue is I can't back plot a bar after it has occurred.
See post #3
viewtopic.php?f=16&t=11713

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

Re: Using paint bar to highlight previous bars  [SOLVED]

Postby JoshM » 13 Sep 2015

I would like to use paint bar to highlight the last (x) number of bars is this possible.
Thanks for your response TJ, but I am no closer to back plotting bars.

I've tried using the plot function, I can plot H and low for 10 days ago today by Plotting h[10],L[10] but this plots the value today.
The issue is I can't back plot a bar after it has occurred.
I'm not sure I understand this thread fully because I disagree with TJ here; previous bars can be highlighted with PlotPaintBar if you offset it with a certain amount of bars back, like this:

Code: Select all

if (LastBarOnChart_s) then begin

// Plot a paint bar 2, 5, and 7 bars ago
PlotPaintBar[2](high[2], low[2], open[2], close[2], "PaintBar", yellow, black, 1);

PlotPaintBar[5](high[5], low[5], open[5], close[5], "PaintBar", yellow, black, 1);

PlotPaintBar[7](high[7], low[7], open[7], close[7], "PaintBar", yellow, black, 1);

end;
Gives:

Image

You can backplot a range of bars with a loop, like this:

Code: Select all

Variables:
x(0);

if (LastBarOnChart_s) then begin

// Plot a paint bar on the last five bars
for x = 0 to 4 begin

PlotPaintBar[x](high[x], low[x], open[x], close[x], "PaintBar", yellow, black, 1);

end;

end;
Gives:

Image

Does this solve the problem you're having, or did I misunderstand?
Attachments
scr.13-09-2015 16.18.37.png
(1.8 KiB) Downloaded 781 times
scr.13-09-2015 16.15.56.png
(2.33 KiB) Downloaded 776 times

jl12
Posts: 220
Joined: 29 Jun 2007
Has thanked: 10 times
Been thanked: 9 times
Contact:

Re: Using paint bar to highlight previous bars

Postby jl12 » 15 Sep 2015

Josh

Your example code allowed me to do exactly what I wanted.

Thank You


Return to “MultiCharts”