Page 1 of 1

Using IChartCustomDrawer and AddPlot in the same Indicator

Posted: Sep 30 2015
by stepup
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.

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Posted: Oct 02 2015
by gztanwei
See if this indicator I wrote give you hints. I think it does sth similar to what you want.

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Posted: Oct 04 2015
by stepup
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

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Posted: Oct 05 2015
by Henry MultiŠ”harts
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.

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Posted: Oct 05 2015
by stepup
Hi Henry,

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

Re: Using IChartCustomDrawer and AddPlot in the same Indicat

Posted: Oct 06 2015
by stepup
Hi Henry,

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

Thank you.

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

Posted: Oct 08 2015
by stepup
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!