diff --git a/docs/plotting.md b/docs/plotting.md index a3d886473..2f084b66a 100644 --- a/docs/plotting.md +++ b/docs/plotting.md @@ -161,6 +161,8 @@ Sample configuration with inline comments explaining the process: # Specifies `ema10` to be red, and `ema50` to be a shade of gray 'ema10': {'color': 'red'}, 'ema50': {'color': '#CCCCCC'}, + # By omitting color, a random color is selected. + 'sar': {}, }, 'subplots': { # Create subplot MACD diff --git a/freqtrade/templates/base_strategy.py.j2 b/freqtrade/templates/base_strategy.py.j2 index 32573ec9e..fbf083387 100644 --- a/freqtrade/templates/base_strategy.py.j2 +++ b/freqtrade/templates/base_strategy.py.j2 @@ -78,7 +78,7 @@ class {{ strategy }}(IStrategy): 'buy': 'gtc', 'sell': 'gtc' } - + {{ plot_config | indent(4) }} def informative_pairs(self): """ Define additional, informative pair/interval combinations to be cached from the exchange. diff --git a/freqtrade/templates/sample_strategy.py b/freqtrade/templates/sample_strategy.py index 228e56b82..92f6aefba 100644 --- a/freqtrade/templates/sample_strategy.py +++ b/freqtrade/templates/sample_strategy.py @@ -80,6 +80,22 @@ class SampleStrategy(IStrategy): 'sell': 'gtc' } + plot_config = { + 'main_plot': { + 'tema': {}, + 'sar': {'color': 'white'}, + }, + 'subplots': { + "MACD": { + 'macd': {'color': 'blue'}, + 'macdsignal': {'color': 'orange'}, + }, + "RSI": { + 'rsi': {'color': 'red'}, + } + } + } + def informative_pairs(self): """ Define additional, informative pair/interval combinations to be cached from the exchange. diff --git a/freqtrade/templates/subtemplates/plot_config_full.j2 b/freqtrade/templates/subtemplates/plot_config_full.j2 new file mode 100644 index 000000000..ab02c7892 --- /dev/null +++ b/freqtrade/templates/subtemplates/plot_config_full.j2 @@ -0,0 +1,18 @@ + +plot_config = { + # Main plot indicators (Moving averages, ...) + 'main_plot': { + 'tema': {}, + 'sar': {'color': 'white'}, + }, + 'subplots': { + # Subplots - each dict defines one additional plot + "MACD": { + 'macd': {'color': 'blue'}, + 'macdsignal': {'color': 'orange'}, + }, + "RSI": { + 'rsi': {'color': 'red'}, + } + } +} diff --git a/freqtrade/templates/subtemplates/plot_config_minimal.j2 b/freqtrade/templates/subtemplates/plot_config_minimal.j2 new file mode 100644 index 000000000..e69de29bb diff --git a/freqtrade/utils.py b/freqtrade/utils.py index 9fe15aea6..2f7b2d717 100644 --- a/freqtrade/utils.py +++ b/freqtrade/utils.py @@ -102,12 +102,14 @@ def deploy_new_strategy(strategy_name, strategy_path: Path, subtemplate: str): indicators = render_template(templatefile=f"subtemplates/indicators_{subtemplate}.j2",) buy_trend = render_template(templatefile=f"subtemplates/buy_trend_{subtemplate}.j2",) sell_trend = render_template(templatefile=f"subtemplates/sell_trend_{subtemplate}.j2",) + plot_config = render_template(templatefile=f"subtemplates/plot_config_{subtemplate}.j2",) strategy_text = render_template(templatefile='base_strategy.py.j2', arguments={"strategy": strategy_name, "indicators": indicators, "buy_trend": buy_trend, "sell_trend": sell_trend, + "plot_config": plot_config, }) logger.info(f"Writing strategy to `{strategy_path}`.")