plotpaintbar doesnt work if change the instrument linewidth

Questions about MultiCharts and user contributed studies.
KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

plotpaintbar doesnt work if change the instrument linewidth

Postby KhaosTrader » 23 Feb 2014

Hi here is the code

Code: Select all

if MarkInside and h<h[1] and l>l[1] then begin
plotpaintbar(h,l,o,c,"",white) ;
end;
if MarkOutside and h>h[1] and l<l[1] then begin
plotpaintbar(h,l,o,c,"",cyan) ;
end;
If I go to format instrument, go to style tab, select OHLC Bar, and then on each component I change the width to make it wider, then the plotpaintbar is not thick enough to paint the bars on the chart appropriately.

So how do I fix this in code?

Thanks in advance.

User avatar
Henry MultiСharts
Posts: 9149
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2932 times

Re: plotpaintbar doesnt work if change the instrument linewi

Postby Henry MultiСharts » 24 Feb 2014

Hello KhaosTrader,

There is a Width parameter for PlotPaintBar.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: plotpaintbar doesnt work if change the instrument linewi

Postby KhaosTrader » 24 Feb 2014

Ok how can i automatically adjust the width paramater to the appropriate width?

SP
Posts: 455
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: plotpaintbar doesnt work if change the instrument linewi

Postby SP » 25 Feb 2014

You could use getappinfo(aibarspacing) to adjust the width, ie with

Code: Select all


inputs:
BarWidth(0); //0 = automatic bar width based on chart, 1-6 manual fixed bar width
vars:
BarSize(0);
//once
//begin
if BarWidth <> 0 then BarSize = BarWidth else
begin
Switch(getappinfo(aibarspacing))
begin
case < 4: BarSize = 1;
case < 6: BarSize = 2;
case < 10: BarSize = 3;
case < 15: BarSize = 4;
case < 20: BarSize = 5;
default: BarSize = 6;
end;
end;
//end;

PlotPaintBar (High, Low, Open, Close ,"PB",yellow,yellow ,BarSize );

You only need to find some case values that fits your charts.


Return to “MultiCharts”