Using IChartCustomDrawer and AddPlot in the same Indicator  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
stepup
Posts: 5
Joined: 30 Sep 2015
Been thanked: 1 time

Using IChartCustomDrawer and AddPlot in the same Indicator

Postby stepup » 30 Sep 2015

I am attempting to use an indicator that simply plots the High and Low as two lines using AddPlot() and .Set() [using IPlotObject] - and at the same time, I am using an IChartCustomDrawer to draw colored polygons between the two lines.

This works fine for all bars up to the last 3 to 4 bars, however on the last 3 to 4 bars, the IChartCustomDrawer polygons flicker and often totally disappear as new ticks come in on the bar chart.

If I remove the AddPlot() IPlotObject objects, the polygons do not flicker, however now of course I have no plot lines.

I have not been able to find examples to show how to have both AddPlot() IPlotObject objects and polygons (drawn by IChartCustomDrawer) that do not disappear with new bar data, in the same indicator.

Any sample code would be most welcome. Thanks.

gztanwei
Posts: 32
Joined: 15 Aug 2015
Has thanked: 6 times
Been thanked: 5 times

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Postby gztanwei » 02 Oct 2015

See if this indicator I wrote give you hints. I think it does sth similar to what you want.
Attachments
plotHighLows.pln
(2.94 KiB) Downloaded 550 times

stepup
Posts: 5
Joined: 30 Sep 2015
Been thanked: 1 time

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Postby stepup » 04 Oct 2015

Hi gztanwei,

Thanks for your reply. I downloaded and ran your code on a chart, and it seems to be working as intended, however, I do not see any polygons on the chart, and I do not see any IChartCustomDrawer object used in your code, so I am left puzzled by what you intended to show?

Maybe I am missing something? I am not quite understanding your hints, I guess.

Thanks

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Postby Henry MultiСharts » 05 Oct 2015

Hello stepup,

What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)

Please send us (support@multicharts.com) the following information for further analysis:
- workspace you are using;
- in QuoteManager select the symbols you are using, make a right click on it->Export data->Export instrument (without data). Send us the QMD export file for analysis;
- in PowerLanguage .NET editor->File->Export->export the studies you are using for replicating this behavior; send us the pln file;
- instructions for replicating the error.

stepup
Posts: 5
Joined: 30 Sep 2015
Been thanked: 1 time

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Postby stepup » 05 Oct 2015

Hi Henry,

OK - I will follow your instructions after the trading hours. Thanks for your input.

stepup
Posts: 5
Joined: 30 Sep 2015
Been thanked: 1 time

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Postby stepup » 06 Oct 2015

Hi Henry,

I have sent in the support request with all the information you specified.

Thank you.

stepup
Posts: 5
Joined: 30 Sep 2015
Been thanked: 1 time

Re: Using IChartCustomDrawer and AddPlot in the same Indicat  [SOLVED]

Postby stepup » 08 Oct 2015

Thanks Henry, and the developers, for your fix. It works.

In case anyone else has this problem, the attached .pln from MC Support has the fix. See the 8 lines beginning with "double hypotenuse". The basic problem was, when new ticks come in, often the context.DrawRect was too small, so it was not drawing the rightmost 3-4 bars, so this code just makes sure the DrawRect rectangle is always large enough to cover all the bars (using simple max logic). There is some clever rectangle visual debugging code in there also.

Many thanks to the quick response from Henry and the MC support people!
Attachments
A_PainterMCSupport.pln
Problem Fix
(2.77 KiB) Downloaded 534 times


Return to “MultiCharts .NET”