I have a few follow-up questions...
First, is it necessary to use lambda functions here? It seems a bit complicated. Wouldn't it be easier for the signal (e.g., MovAvg_Cross_LE) just to pass its "length" value to the function? E.g., something like:
Code: Select all
protected override void StartCalc(){
...
m_averagefc1.length = this.length;
...
}
Alternatively, the m_averagefc1 object is getting a reference to the parent object in the constructor:
Code: Select all
m_averagefc1 = new AverageFC(this);
Since the m_averagefc1 object has a reference to the parent object, couldn't it simply access the ".length" property of the parent itself, without using a separate lambda function?
Second, I also see that the AverageFC class is taking an "ISeries<int>" for the length value. (You can see this if you right-click on the "AverageFC" reference in Visual Studio, and select "Go to Definition....")
Is there a reason that it needs an "ISeries<int>" for the length, as opposed to just a regular int? To me, it seems that the "length" value is something that's static -- it shouldn't change from bar to bar, and therefore shouldn't need to be a series variable. Perhaps I'm missing something.
I hope I'm not being difficult -- I'm just trying to get my head around the nuances of the API for MC .Net.