Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.
verybadsoldier edited this page Dec 27, 2019 · 15 revisions

Welcome to the backtrader_plotting wiki!

Labels

Every plottable glyph will have a lable which consits of these parts:

{label} ({parameters}) @{datas}

label- Either the classname or the plotname if provided

parameters - a stringified list of the object parameters

datas - a list of all datas this object works on

Plot Configuration

When using backrader_plotting then plotting configuration can be done totally separately from strategy configuration. The plotting can be configured in the code after the backtest finished running like this:

    plotconfig = {
        'id:ind#0': dict(
            subplot=True,
        ),
    }
    b = Bokeh(style='bar', plot_mode='single', scheme=Tradimo(), plotconfig=plotconfig)
    cerebro.plot(b)

plotconfig is a dictionary. Every key is an expression that selects one or more entities which plot configuration has to be configured. Each value is another dictionary with attributes that will be assigned to the selected objects.

The key has to be in one of these formats:

  • id:<plotid> - Selects the entitiy with the specified plotid
  • #:<type>-<n> - Selects the n-th object of type. Type can bei i for indicators, o for observers or d for datas
  • r:<regex> - A regular expression matching the label of one or more objects

Additional Plotting Attributes

plotaspectratio Global aspect ratio can be set on the scheme applying to all figures. Individual aspect ratios for specific figures can be overriden though by setting plotaspectratio on a object. It needs to be applied to a plot master object. It will not hae an effect when applied to a slave object.

Clone this wiki locally