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.
Using IChartCustomDrawer and AddPlot in the same Indicator [SOLVED]
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
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
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
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.
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.
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!
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 572 times