I want to outsource recurring calculations from my strategy and simplify my code. That's why I wrote the following code.
protected override void OnBarUpdate()
{
// create dummy signal to evaluate
barCounter++;
if (barCounter % 2 == 0) barCounter2 += 2;
testSeries[0] = barCounter2;
MyHistoricSeries myHistoricSeries = new MyHistoricSeries();
// Does not add!
methodCounter = myHistoricSeries.Counter(testSeries);
Print (Time[0]
+ " barCounter " + barCounter
+ " barCounter2 " + barCounter2
+ " methodCounter " + methodCounter
);
}
}
}
public class MyHistoricSeries
{
int myCounter;
// Evaluate testSeries
public int Counter (Series<int>mySeries)
{
if (mySeries[0] > mySeries[1]) myCounter++;
return myCounter;
}
}
The testSeries is passed to the Counter method and returns the evaluation.
But I want the methodCounter to cumulate!
Is that basically possible or what other solution is there for my problem?
Many thanks for the support!

Comment