Profile Picture

Combining Indicators - Produces an Error

Posted By mseeli 9 Years Ago
Message
Posted Tuesday July 29 2008
Hello

We are currently developing a number of complex indicators and stubled upon the following error when trying to combine indicators:

Here is a simple example that produces the error:

ISeries ema = new EMA(2,new EMA(2, new EMA(2,Close)));

produces this:

An exception of type System.ArgumentOutOfRangeException was thrown.
Value must be between 0 and -1, value was 0
Parameter name: nBars
at RightEdge.Common.RList`1.LookBack(Int32 nBars)
at RightEdge.Common.SeriesCalculatorBaseWithValues.LookBack(Int32 nBars)
at RightEdge.Common.SeriesCalculatorBaseWithValues.NewBar()
at RightEdge.Common.IndicatorManager.NewBar(Dictionary`2 bars)
at RightEdge.Common.SystemData.x56e784a497b3cb60(NewBarInfo x8d3f74e5f925679c)
at RightEdge.Common.Internal.SystemRunner.NewBar(Dictionary`2 bars)
at RightEdge.Shared.SystemWrapper.RunSystem(SystemData systemData, SystemRunInfo runInfo, Dictionary`2 historicalData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.TradingModuleWrapper.RunSystem(SystemDataCreationSettings settings, Dictionary`2 historicalData, SystemRunInfo dndInfo, ServiceAppDomainFactory brokerFactoryFactory)
at RightEdge.SystemProgress.InitAndRunSystem()



ISeries ema = new EMA(2,new EMA(2, Close) works fine

We wrote several basic "Calculation Indicators" like AddSeries, AddSeriesValue, DivideSeries, DivideSeriesValue, MultiplySeries, MultiplySeriesValue and so on and would like to use them to build Indicators in an easy way within a TradingSystem. But when ever we combine more than 3 we get this error.

Here an real example of what we would like to have working:

ISeries Recovery200 = new EMA(200,new WLMultiplySeriesValue(new WLDivideSeries(new WLSubtractSeries(Close,Low),atr),100));

Markus






Posted Tuesday July 29 2008
I've logged an incident (ID #1251)

mseeli (7/29/2008)
Hello

We are currently developing a number of complex indicators and stubled upon the following error when trying to combine indicators:

Here is a simple example that produces the error:

ISeries ema = new EMA(2,new EMA(2, new EMA(2,Close)));

produces this:

An exception of type System.ArgumentOutOfRangeException was thrown.
Value must be between 0 and -1, value was 0
Parameter name: nBars
at RightEdge.Common.RList`1.LookBack(Int32 nBars)
at RightEdge.Common.SeriesCalculatorBaseWithValues.LookBack(Int32 nBars)
at RightEdge.Common.SeriesCalculatorBaseWithValues.NewBar()
at RightEdge.Common.IndicatorManager.NewBar(Dictionary`2 bars)
at RightEdge.Common.SystemData.x56e784a497b3cb60(NewBarInfo x8d3f74e5f925679c)
at RightEdge.Common.Internal.SystemRunner.NewBar(Dictionary`2 bars)
at RightEdge.Shared.SystemWrapper.RunSystem(SystemData systemData, SystemRunInfo runInfo, Dictionary`2 historicalData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.TradingModuleWrapper.RunSystem(SystemDataCreationSettings settings, Dictionary`2 historicalData, SystemRunInfo dndInfo, ServiceAppDomainFactory brokerFactoryFactory)
at RightEdge.SystemProgress.InitAndRunSystem()



ISeries ema = new EMA(2,new EMA(2, Close) works fine

We wrote several basic "Calculation Indicators" like AddSeries, AddSeriesValue, DivideSeries, DivideSeriesValue, MultiplySeries, MultiplySeriesValue and so on and would like to use them to build Indicators in an easy way within a TradingSystem. But when ever we combine more than 3 we get this error.

Here an real example of what we would like to have working:

ISeries Recovery200 = new EMA(200,new WLMultiplySeriesValue(new WLDivideSeries(new WLSubtractSeries(Close,Low),atr),100));

Markus






Posted Tuesday July 29 2008
This needs furthur investigation, but my gut is telling me that you may have better results by declaring them all and then doing the setinputs to "hard" way.  If it's not too much trouble maybe give this a shot with the simple EMA example.
Posted Friday March 28 2014
Same issue. Please advise.

An exception of type System.ArgumentOutOfRangeException was thrown.
Value must be between 0 and -1, value was 0
Parameter name: nBars
at RightEdge.Common.RList`1.LookBack(Int32 nBars)
at RightEdge.Indicators.DivideSeries.LookBack(Int32 nBars)
at RightEdge.Common.SeriesCalculatorBaseWithValues.NewBar()
at RightEdge.Common.IndicatorManager.NewBar(FrequencyNewBarEventArgs args)
at RightEdge.Common.Internal.SystemRunner.UpdateObjects(FrequencyNewBarEventArgs args)
at RightEdge.Common.Internal.SystemRunner.ProcessBarEvents(IEnumerable`1 eventList)
at RightEdge.Common.FrequencyManager.SendPendingBars()
at RightEdge.Common.FrequencyManager.UpdateTime(DateTime dateTime)
at RightEdge.Common.Internal.SystemRunner._tickGenerator_NewBar(Object sender, NewBarEventArgs e)
at RightEdge.Common.TickGenerator.ProcessBar(NewBarEventArgs args)
at RightEdge.Common.Internal.SystemRunner.ProcessBar(NewBarEventArgs newBars)
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()

Thanks, Duane
Posted Sunday April 06 2014
This is probably happening because you are creating an indicator and passing it as the input to another one, but aren't storing it anywhere. Store each indicator as a separate field of your SymbolScript class and the problem will probably go away.

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems