More changes to support BollingerBands.

This commit is contained in:
2025-06-15 13:56:48 -04:00
parent 9bbfc9831f
commit 9b1135b5ec
18 changed files with 631 additions and 221 deletions

View File

@@ -173,9 +173,9 @@ namespace PortfolioManager.Models
LeastSquaresResult leastSquaresResult = bollingerBands.LeastSquaresFitClose();
SortedDateTimeDataAdapter sortedDateTimeDataAdapter = new SortedDateTimeDataAdapter();
List<BollingerBandElement> sortedBollingerBands = bollingerBands.OrderBy(x => x.Date).ToList();
for (int index = 0; index < bollingerBands.Count; index++)
for (int index = 0; index < sortedBollingerBands.Count; index++)
{
BollingerBandElement element = bollingerBands[index];
BollingerBandElement element = sortedBollingerBands[index];
int leastSquaresIndex = (leastSquaresResult.LeastSquares.Length - 1) - index;
sortedDateTimeDataAdapter.Add(element.Date, leastSquaresResult.LeastSquares[leastSquaresIndex]);
}