Profile Picture

Null argument when chaining

Posted By phg 3 Years Ago
Message
phg
Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)
Posted Sunday February 16 2014
I am getting this error (with 9 lead bars specified):
Input 1 to indicator priceRatio was null. You probably need to call SetInputs() for this indicator in your Startup() method, or use a constructor overload which specifies the inputs.
at RightEdge.Common.IndicatorManager.x39f8db9e6eff648f(xcc9f24b2b74c9456 x4a3f0a05c02f235f)
at RightEdge.Common.IndicatorManager.Initialize()
at RightEdge.Common.Internal.SystemRunner.Startup()
at RightEdge.Shared.SystemWrapper.InitializeModule(SystemData systemData, SharedSystemRunData runData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(SystemData systemData, SharedSystemRunData runData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(String filename, ServiceFactory brokerFactory, PluginSettings dataStoreSettings)
at RightEdge.Shared.SystemWrapper.RunSystem(String filename, ServiceFactory brokerFactory, PluginSettings dataStoreSettings)
at RightEdge.Shared.TradingModuleWrapper.Run(String filename)
at RightEdge.Shared.TradingModuleWrapper.RunSystem(SharedSystemRunData systemRunData)
at RightEdge.SystemProgress.InitAndRunSystem()

From this:
activeETFemaPrice   =new EMA(5,Close);
.....
baseETFemaPrice   = new EMA(7,Close);
.......
priceRatio         = new DivideSeries();
         priceRatio.SetInputs(activeETFemaPrice,OtherSymbols["SHY"].baseETFemaPrice);


-Pete

See also Yahoo group about applying RE.

Posted Sunday February 16 2014
Symbol SHY's baseETFemaPrice indicator hasn't been created when you are trying to use it as an input to the priceRatio indicator for another symbol.

When dealing with cross-symbol indicators, it's usually simplest to do a two-step initialization. First create all the indicators for all symbols, then afterwards set all the inputs for them. You can create the indicators in the constructor of your SymbolScript class and set the inputs in the Startup() method.

Thanks,
Daniel
phg
Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)
Posted Monday February 17 2014
Excellent! Thanks Daniel. I'll work on that.
Next, I need to chain the divide series into two MAs (one slow and one fast).
(BTW, in principle RE chaining is an elegant technique for dealing with the problem I am tackling.)

-Pete

See also Yahoo group about applying RE.

phg
Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)
Posted Monday February 17 2014
I'm still missing a piece somewhere:

An exception of type System.NullReferenceException was thrown.
Object reference not set to an instance of an object.
at MySymbolScript.Startup() in c:\Users\Peter\Documents\RightEdge\BondETFcross\BondETFcross.cs:line 52
at MySystemBase.Startup(SystemData data) in c:\Users\Peter\Documents\RightEdge\BondETFcross\BaseClasses.cs:line 23
at RightEdge.Common.Internal.SystemRunner.Startup()
at RightEdge.Shared.SystemWrapper.InitializeModule(SystemData systemData, SharedSystemRunData runData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(SystemData systemData, SharedSystemRunData runData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(String filename, ServiceFactory brokerFactory, PluginSettings dataStoreSettings)
at RightEdge.Shared.SystemWrapper.RunSystem(String filename, ServiceFactory brokerFactory, PluginSettings dataStoreSettings)
at RightEdge.Shared.TradingModuleWrapper.Run(String filename)
at RightEdge.Shared.TradingModuleWrapper.RunSystem(SharedSystemRunData systemRunData)
at RightEdge.SystemProgress.InitAndRunSystem()

From this (setup in constructor, inputs set at startup):

public void MyStymbolScript() // Constructor
   {
      activeETFemaPrice   =new EMA(5);
         activeETFemaPrice.ChartSettings.Color = Color.Green;
         ...
      baseETFemaPrice   = new EMA(7);
         baseETFemaPrice.ChartSettings.Color = Color.Orange;
         ...
      priceRatio         = new DivideSeries();
         priceRatio.ChartSettings.ChartPaneName="Ratio";
   }
      
   public override void Startup() {
      
      activeETFemaPrice.SetInputs(Close);
      baseETFemaPrice. SetInputs(Close);
      priceRatio.SetInputs(activeETFemaPrice,OtherSymbols["SHY"].baseETFemaPrice);

      }



-Pete

See also Yahoo group about applying RE.

phg
Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)Supreme Being (44,923 reputation)
Posted Monday February 17 2014
My bad. Constructor name typo. Whistling

-Pete

See also Yahoo group about applying RE.



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems