Resetting a plot  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Tartalognion
Posts: 23
Joined: 17 Mar 2010
Has thanked: 20 times
Been thanked: 2 times

Resetting a plot

Postby Tartalognion » 28 Oct 2018

Hello,

I've created an indicator which colors the bar during some definite periods of time.

But I've noticed that I cannot reset the plot:

Code: Select all

protected override void Create()
{
plotHigh = AddPlot(new PlotAttributes("", EPlotShapes.Line,Color.Empty, Color.Empty, 1, EPlotStyle.Solid, true));
plotLow = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Empty, Color.Empty, 1, EPlotStyle.Solid, true));
plotClose = AddPlot(new PlotAttributes("", EPlotShapes.Line,Color.Empty, Color.Empty, 1, EPlotStyle.Solid, true));
plotOpen = AddPlot(new PlotAttributes("", EPlotShapes.Line,Color.Empty, Color.Empty, 1, EPlotStyle.Solid, true));

}
And then I tried to use that in CalcBar():

Code: Select all

plotOpen.Set(Bars.Open[0], Color.Empty);
plotHigh.Set(Bars.High[0], Color.Empty);
plotLow.Set(Bars.Low[0], Color.Empty);
plotClose.Set(Bars.Close[0], Color.Empty);
The result is that:
addPlot 2018-10-28_13-31-42.jpg
(50.81 KiB) Downloaded 528 times
or if use:

Code: Select all

plotOpen.Reset();
plotHigh.Reset();
plotLow.Reset();
plotClose.Reset();
I get a line:
AddPlot 2018-10-28_14-52-48.jpg
(73.66 KiB) Downloaded 528 times
2) Besides that, How can I retrieve the differents properties of Data1 (Colors, Style,etc.)?

Thank you!

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

Re: Resetting a plot  [SOLVED]

Postby Henry MultiСharts » 29 Oct 2018

Hello Tartalognion,

When you are using the "Line" plot type - any two values will be connected with a line. This means that you need to use a different plot shape to have no plots on specific bars (where you call Reset for it).
Unfortunately the data series properties like Colors, Style, etc cannot be accessed from the code.

Jobauma
Posts: 113
Joined: 16 Apr 2013
Has thanked: 25 times
Been thanked: 6 times

Re: Resetting a plot

Postby Jobauma » 06 Jan 2019

Hi, Tartalognion.

To avoid the line you have to set the last color to the background color to make it "invisible". :)

Make a counter for the last time the custom color is applied ( if necessary ).

Code: Select all

p_PlotObject.Set( m_Counter, Bars.Close[m_Counter], Environment.BGColor, 0 );
The color of the line is from the 1st plot ( to the 2nd ).

The last argument "0" should have made the plot invisible, but is the same as "1". I use "0" just to be sure it is as thin as possible. This is something that MultiCharts maybe could do something about.

Take the plot object behind whatever other plot objects if possible to make the line as "invisible" as possible.

I use this solution all the time. :)



Best regards,
Johannes Hillestad Baumann

Tartalognion
Posts: 23
Joined: 17 Mar 2010
Has thanked: 20 times
Been thanked: 2 times

Feature Request: Resetting a plot

Postby Tartalognion » 06 Jan 2019

Unfortunately the data series properties like Colors, Style, etc cannot be accessed from the code.
Hello Henry,

It would be nice to add this to a next MC version.....


Return to “MultiCharts .NET”