closePosition method

void closePosition(
  1. String positionId
)

Closes an open position and removes it from the chart canvas.

Implementation

void closePosition(String positionId) {
  final index = _positions.indexWhere((p) => p.id == positionId);
  if (index >= 0) {
    final removed = _positions.removeAt(index);
    onPositionClosed?.call(removed);
    notifyListeners();
  }
}