I'm using an indicator which draws a Fib retracement, and I'm creating a strategy that uses this indicator, it seems under this setup, an error is generated when setting the Fibonacci extension to the right.
(Dummy example)
try
{
if (CurrentBar == 15)
{
var fib = Draw.FibonacciRetracements(this, "fib", true, 10, Low[10], 1, High[1]);
fib.IsExtendedLinesRight = true;
}
// Ensure enough bars exist for Value[1]
// if (CurrentBar == 0)
// {
// Value[0] = Input[0];
// }
// else
// {
// Value[0] = Input[0] * constant1 + constant2 * Value[1];
// }
}
catch (Exception e)
{
Print(e.Message);
Print(e.StackTrace);
throw;
}
Object reference not set to an instance of an object.
at NinjaTrader.NinjaScript.Indicators.SmaFibonacci.On BarUpdate() in C:\Users\USUARIO\Documents\NinjaTrader 8\bin\Custom\Indicators\SmaFibonacci.cs:line 70
Indicator 'SmaFibonacci': Error on calling 'OnBarUpdate' method on bar 15: Object reference not set to an instance of an object.
Is it because these objects are drawn asynchronously when being referenced inside a strategy?
Is there a workaround for me to use this Fib retracement object?
Regards,

.
Comment