@@ -150,6 +150,7 @@ def plot(*, results: pd.Series,
150150 plot_volume = True , plot_drawdown = False ,
151151 smooth_equity = False , relative_equity = True ,
152152 superimpose = True , resample = True ,
153+ reverse_indicators = True ,
153154 show_legend = True , open_browser = True ):
154155 """
155156 Like much of GUI code everywhere, this is a mess.
@@ -488,6 +489,7 @@ def __eq__(self, other):
488489 return self is other
489490
490491 ohlc_colors = colorgen ()
492+ indicator_figs = []
491493
492494 for i , value in enumerate (indicators ):
493495 value = np .atleast_2d (value )
@@ -503,7 +505,7 @@ def __eq__(self, other):
503505 fig = fig_ohlc
504506 else :
505507 fig = new_indicator_figure ()
506- figs_below_ohlc .append (fig )
508+ indicator_figs .append (fig )
507509 tooltips = []
508510 colors = value ._opts ['color' ]
509511 colors = colors and cycle (_as_list (colors )) or (
@@ -556,6 +558,7 @@ def __eq__(self, other):
556558 # have the legend only contain text without the glyph
557559 if len (value ) == 1 :
558560 fig .legend .glyph_width = 0
561+ return indicator_figs
559562
560563 # Construct figure ...
561564
@@ -577,7 +580,10 @@ def __eq__(self, other):
577580
578581 ohlc_bars = _plot_ohlc ()
579582 _plot_ohlc_trades ()
580- _plot_indicators ()
583+ indicator_figs = _plot_indicators ()
584+ if reverse_indicators :
585+ indicator_figs = indicator_figs [::- 1 ]
586+ figs_below_ohlc .extend (indicator_figs )
581587
582588 set_tooltips (fig_ohlc , ohlc_tooltips , vline = True , renderers = [ohlc_bars ])
583589
0 commit comments