Source code for lightningchart_trader.indicators.choppiness_index

from lightningchart_trader.indicators import LineIndicator, PeriodIndicator


[docs] class ChoppinessIndex(LineIndicator, PeriodIndicator): def __init__(self, trader, period_count=20): super().__init__(trader) self.instance.send( self.id, 'addChoppinessIndex', {'traderID': trader.id, 'periodCount': period_count}, )
[docs] def set_fill_color(self, color: str): """Sets the fill color for the Choppiness Index visualization. Args: color (str): The fill color in hexadecimal or RGB format. """ self.instance.send(self.id, 'setFillColor', {'color': color}) return self
[docs] def set_threshold_levels(self, upper_threshold: int | float, lower_threshold: int | float): """Sets the upper and lower thresholds. Args: upper_threshold (int | float): Upper threshold level. lower_threshold (int | float): Lower threshold level. """ self.instance.send(self.id, 'setThresholdLevels', {'upperThreshold': upper_threshold, 'lowerThreshold': lower_threshold}) return self