@@ -150,6 +150,7 @@ def plot(*, results: pd.Series,
150
150
plot_volume = True , plot_drawdown = False ,
151
151
smooth_equity = False , relative_equity = True ,
152
152
superimpose = True , resample = True ,
153
+ reverse_indicators = True ,
153
154
show_legend = True , open_browser = True ):
154
155
"""
155
156
Like much of GUI code everywhere, this is a mess.
@@ -488,6 +489,7 @@ def __eq__(self, other):
488
489
return self is other
489
490
490
491
ohlc_colors = colorgen ()
492
+ indicator_figs = []
491
493
492
494
for i , value in enumerate (indicators ):
493
495
value = np .atleast_2d (value )
@@ -503,7 +505,7 @@ def __eq__(self, other):
503
505
fig = fig_ohlc
504
506
else :
505
507
fig = new_indicator_figure ()
506
- figs_below_ohlc .append (fig )
508
+ indicator_figs .append (fig )
507
509
tooltips = []
508
510
colors = value ._opts ['color' ]
509
511
colors = colors and cycle (_as_list (colors )) or (
@@ -556,6 +558,7 @@ def __eq__(self, other):
556
558
# have the legend only contain text without the glyph
557
559
if len (value ) == 1 :
558
560
fig .legend .glyph_width = 0
561
+ return indicator_figs
559
562
560
563
# Construct figure ...
561
564
@@ -577,7 +580,10 @@ def __eq__(self, other):
577
580
578
581
ohlc_bars = _plot_ohlc ()
579
582
_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 )
581
587
582
588
set_tooltips (fig_ohlc , ohlc_tooltips , vline = True , renderers = [ohlc_bars ])
583
589
0 commit comments