diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 7898c36fb..e8ebd6280 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -1142,9 +1142,10 @@ class AwesomeStrategy(IStrategy): ) -> list[AnnotationType]: """ Retrieve area annotations for a chart. - Must be returned as array, with label, start, end, y_start, y_end and color. - All settings are optional - though it usually makes sense to include either "start and end" - or "y_start and y_end" for either horizontal or vertical plots (or all 4 for boxes). + Must be returned as array, with type, label, color, start, end, y_start, y_end. + All settings except for type are optional - though it usually makes sense to include either + "start and end" or "y_start and y_end" for either horizontal or vertical plots + (or all 4 for boxes). :param pair: Pair that's currently analyzed :param start_date: Start date of the chart data being requested :param end_date: End date of the chart data being requested diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 6217b1c39..1840f231e 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -840,9 +840,10 @@ class IStrategy(ABC, HyperStrategyMixin): ) -> list[AnnotationType]: """ Retrieve area annotations for a chart. - Must be returned as array, with label, start, end, y_start, y_end and color. - All settings are optional - though it usually makes sense to include either "start and end" - or "y_start and y_end" for either horizontal or vertical plots (or all 4 for boxes). + Must be returned as array, with type, label, color, start, end, y_start, y_end. + All settings except for type are optional - though it usually makes sense to include either + "start and end" or "y_start and y_end" for either horizontal or vertical plots + (or all 4 for boxes). :param pair: Pair that's currently analyzed :param start_date: Start date of the chart data being requested :param end_date: End date of the chart data being requested diff --git a/freqtrade/templates/base_strategy.py.j2 b/freqtrade/templates/base_strategy.py.j2 index 16998ab52..e4c617ddf 100644 --- a/freqtrade/templates/base_strategy.py.j2 +++ b/freqtrade/templates/base_strategy.py.j2 @@ -28,6 +28,7 @@ from freqtrade.strategy import ( merge_informative_pair, stoploss_from_absolute, stoploss_from_open, + AnnotationType, ) # -------------------------------- diff --git a/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 b/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 index dc133c75a..306329742 100644 --- a/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 +++ b/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 @@ -399,3 +399,21 @@ def order_filled( :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. """ pass + +def plot_annotations( + self, pair: str, start_date: datetime, end_date: datetime, dataframe: DataFrame, **kwargs +) -> list[AnnotationType]: + """ + Retrieve area annotations for a chart. + Must be returned as array, with type, label, color, start, end, y_start, y_end. + All settings except for type are optional - though it usually makes sense to include either + "start and end" or "y_start and y_end" for either horizontal or vertical plots + (or all 4 for boxes). + :param pair: Pair that's currently analyzed + :param start_date: Start date of the chart data being requested + :param end_date: End date of the chart data being requested + :param dataframe: DataFrame with the analyzed data for the chart + :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. + :return: List of AnnotationType objects + """ + return []