What is the purpose of Plot.Reset()?
Does it correct a drawing overlap or does it help to conserve resourses or prevent a memory leak or something else important?
I've put some transparent plots in my multicolor MAs so I can grab the values in my strategy. I do not have a Plot.Reset() included for the transparent ones, but I do for the colors. I guess I'm wanting to know if Plot.Reset() needs to be included for both color and transparent plots or for one or the other or not at all, and why...
Thanks.
Excerpted Code:
protected override void OnBarUpdate()
{
// Checks to make sure we have at least 1 bar before continuing
if (CurrentBar < 1)
return;
// Plot green if the SMA is rising
// Rising() returns true when the current value is greater than the value of the previous bar.
if (Rising(SMA(Period)))
{
// Connects the rising plot segment with the other plots
RisingPlot.Set(1, SMA(Period)[1]);
// Adds the new rising plot line segment to the line
RisingPlot.Set(SMA(Period)[0]);
NeutralPlot.Reset();
FallingPlot.Reset();
}
// Plot red if the SMA is falling
// Falling() returns true when the current value is less than the value of the previous bar.
else if (Falling(SMA(Period)))
{
// Connects the new falling plot segment with the rest of the line
FallingPlot.Set(1, SMA(Period)[1]);
// Adds the new falling plot line segment to the line
FallingPlot.Set(SMA(Period)[0]);
RisingPlot.Reset();
NeutralPlot.Reset();
}
// Plot yellow if the SMA is neutral
else
{
// Connects the neutral plot segment with the rest of the line
NeutralPlot.Set(1, SMA(Period)[1]);
// Adds the new neutral plot line segment to the line
NeutralPlot.Set(SMA(Period)[0]);
RisingPlot.Reset();
FallingPlot.Reset();
}
}
Comment