plotting indicators that are inside another indicator
יהודה שפירא last edited by
I have build an indicator ('A') that uses other indicators for calculate itself (B, C, D). However I see only the main indicator ('A') when printing, but I want to see also the other indicators (B, C, and D). I tried adding 'plotforce' and LinePlotterIndicator like written in https://www.backtrader.com/docu/induse/ without success...
The plotting code doesn't do recursion and doesn't see see the embedded indicators. The solutions you attempted as shown in the documentation page you linked are for the indicators and operations which happen directly in the strategy code.
The only trick I can offer you (not tested)
Create your indicator.
Create moving averages of period 1 which use your embedded indicators as data
my_indicator = MyIndicator(....) emb_ind_1 = bt.ind.SMA(my_indicator.embedded_indicator1, period=1)
SMAdoesn't know still where to plot itself, because the indicators won't be plotted.
emb_ind_1.plotinfo.plotmaster = self.data emb_ind_1.plotinfo.subplot = True
which says that they should be considered indicators of
self.datafor plotting purposes and be plotted in an own sub-graph.