Below is a code snippet which was an atttempt to try to avoid the issue, it has cut the errors down but not 100%. when the error occurs the indicator stops plotting. I don't care if a few plots dobn't show but not for it to quit totally plotting .
The "try, catch" doesn't seem to do a thing as I never get anything in the output window. I put in all the validity checks I could think of but I can't seem to figure out the plot value that is causing the issue. The Diffference value is the result of a divide operation computed by using two values returned from a custom indicator with a custom data series. It works most of the time but I still get the error on occasion.
I know the logic is crude but I didn't think it would this difficult to fix.
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Diff"));
try
{
if (Diffference != double.NaN &&
Diffference != Double.PositiveInfinity &&
Diffference != Double.NegativeInfinity &&
Diffference != 9999999999999999999999999.0 &&
Diffference != -9999999999999999999999999.0 &&
Diffference != double.MinValue &&
Diffference != double.MaxValue )
{
Diff.Set(Diffference);
}
}
catch
{
Print("1.0x Diffference " + Diffference);
}
Anything you can think of I can use as a cure for my self inflicted ailment?
Comment