Adding an Indicator
Directory Structure
custom_modules/indicators/<name_of_your_indicator>.py
Implementing a Custom Indicator
from ats.indicators.base_indicator import BaseIndicator class CustomIndicator(BaseIndicator): def running_calc(self, popped_data_point, new_data_point) -> float: """ Calculates the indicator in a running window. Args: popped_data_point: The data point removed from the time series (if window size is reached). new_data_point: The new data point being added. Returns: The new calculated data point. """ # Example logic for a moving average indicator if popped_data_point is not None: self.sums -= popped_data_point else: self.sums = 0 self.sums += new_data_point self.result = self.sums / self.N return new_data_point
Accessing and Using Indicators
Example Directory Structure
Notes on Indicator Logic
Last updated