LinearRegValue. What’s nice about this function is that the data series that’s passed for it to operate on can be something that my indicator calculates ( it can be an expression ).
I see that NT abstracts the concept of a data series in IDataSeries. To achieve the goal of calculating my own data series for a linear regression, I implemented IDataSeries in my own class, which is nested in my main Indicator derived class:
public class MySeries : IDataSeries {…}
Then I moved the calculations for the LinReg series argument into that IDataSeries implementation.
Next the NT indicator is calling
LinReg( new MySeries(),20 );
No compliation errors.
To my surprise, at runtime, NT throws an exception with a message that says the dataseries type is unexpected:
'OnBarUpdate' method for indicator 'TestIndicator' on bar 0: IndicatorBase.set_Input: Unexpected 'DataSeries' type: NinjaTrader.Indicator.ATMSqueeze+MySeries
Questions:
1) Is NT deliberately doing a runtime check on data types and throwing exceptions if the types are not in a list of “sanctioned” types of NT origin? If so then the abstraction of IDataSeries is a bit misleading to the development community.
2) How can I get LinReg to operate on a data series that I calculate myself?
Comment