From 12b4ae7f46518395b8ab53a74f26288c3943e4be Mon Sep 17 00:00:00 2001 From: Gert Wohlgemuth Date: Sun, 6 May 2018 18:32:25 -0700 Subject: [PATCH] added support to plot markers of a dataframe, like hammers, etc. Added support to plot as many ticks as you want --- freqtrade/arguments.py | 2 +- scripts/plot_dataframe.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index 42275a4cc..d3168fc82 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -296,7 +296,7 @@ class Arguments(object): self.parser.add_argument( '--plot-dataframe-marker', - help='Renders the specified dataframes as markers', + help='Renders the specified dataframes as markers. Accepted values for a marker are either 100 or -100', dest='plotdataframemarker', default=None, nargs='+', diff --git a/scripts/plot_dataframe.py b/scripts/plot_dataframe.py index 9a9248c7c..794536365 100755 --- a/scripts/plot_dataframe.py +++ b/scripts/plot_dataframe.py @@ -29,6 +29,33 @@ from freqtrade.configuration import Configuration logger = logging.getLogger(__name__) +def plot_dataframes_markers(data, fig, args): + """ + plots additional dataframe markers in the main plot + :param data: + :param fig: + :param args: + :return: + """ + + if args.plotdataframemarker: + for x in args.plotdataframemarker: + filter = data[(data[x] == 100 ) | (data[x] == -100) ] + marker = go.Scatter( + x=filter.date, + y=filter.low * 0.99, + mode='markers', + name=x, + marker=dict( + symbol='diamond-tall-open', + size=10, + line=dict(width=1) + ) + + ) + + fig.append_trace(marker, 1, 1) + def plot_dataframes(data, fig, args): """ @@ -337,6 +364,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None: # plot other dataframes plot_dataframes(data, fig, args) + plot_dataframes_markers(data, fig, args) fig['layout'].update(title=args.pair) fig['layout']['yaxis1'].update(title='Price')