comment arrondir self.lines.src = (self.data.open + self.data.high + self.data.low +…
- User
comment arrondir self.lines.src = (self.data.open + self.data.high + self.data.low + self.data.close) / 4 à 2 points après la virgule
- Assistant
Pour arrondir la valeur de
self.lines.srcà deux décimales, vous pouvez utiliser la fonction intégréeround()de Python. Voici comment vous pouvez modifier votre ligne de code :pythonself.lines.src = round((self.data.open + self.data.high + self.data.low + self.data.close) / 4, 2)Explication :
-
Calcul de la moyenne :
python
-