self.add_marker#

lumibot.strategies.strategy.Strategy.add_marker(self, name, value=None, color=None, symbol='circle', size=None, detail_text=None, dt=None)#

Adds a marker to the indicators plot that loads after a backtest. This can be used to mark important events on the graph, such as price crossing a certain value, marking a support level, marking a resistance level, etc.

Parameters:
  • name (str) – The name of the marker. This is used to display the name on the graph. Eg. “Overbought”, “Oversold”, “Stop Loss”, “Take Profit”, …

  • symbol (str) – The symbol of the marker. Possible values are ‘circle’, ‘circle-open’, ‘circle-dot’, ‘circle-open-dot’, ‘square’, ‘square-open’, ‘square-dot’, ‘square-open-dot’, ‘diamond’, ‘diamond-open’, ‘diamond-dot’, ‘diamond-open-dot’, ‘cross’, ‘cross-open’, ‘cross-dot’, ‘cross-open-dot’, ‘x’, ‘x-open’, ‘x-dot’, ‘x-open-dot’, ‘triangle-up’, ‘triangle-up-open’, ‘triangle-up-dot’, ‘triangle-up-open-dot’, ‘triangle-down’, ‘triangle-down-open’, ‘triangle-down-dot’, ‘triangle-down-open-dot’, ‘triangle-left’, ‘triangle-left-open’, ‘triangle-left-dot’, ‘triangle-left-open-dot’, ‘triangle-right’, ‘triangle-right-open’, ‘triangle-right-dot’, ‘triangle-right-open-dot’, ‘triangle-ne’, ‘triangle-ne-open’, ‘triangle-ne-dot’, ‘triangle-ne-open-dot’, ‘triangle-se’, ‘triangle-se-open’, ‘triangle-se-dot’, ‘triangle-se-open-dot’, ‘triangle-sw’, ‘triangle-sw-open’, ‘triangle-sw-dot’, ‘triangle-sw-open-dot’, ‘triangle-nw’, ‘triangle-nw-open’, ‘triangle-nw-dot’, ‘triangle-nw-open-dot’, ‘pentagon’, ‘pentagon-open’, ‘pentagon-dot’, ‘pentagon-open-dot’, ‘hexagon’, ‘hexagon-open’, ‘hexagon-dot’, ‘hexagon-open-dot’, ‘hexagon2’, ‘hexagon2-open’, ‘hexagon2-dot’, ‘hexagon2-open-dot’, ‘octagon’, ‘octagon-open’, ‘octagon-dot’, ‘octagon-open-dot’, ‘star’, ‘star-open’, ‘star-dot’, ‘star-open-dot’, ‘hexagram’, ‘hexagram-open’, ‘hexagram-dot’, ‘hexagram-open-dot’, ‘star-triangle-up’, ‘star-triangle-up-open’, ‘star-triangle-up-dot’, ‘star-triangle-up-open-dot’, ‘star-triangle-down’, ‘star-triangle-down-open’, ‘star-triangle-down-dot’, ‘star-triangle-down-open-dot’, ‘star-square’, ‘star-square-open’, ‘star-square-dot’, ‘star-square-open-dot’, ‘star-diamond’, ‘star-diamond-open’, ‘star-diamond-dot’, ‘star-diamond-open-dot’, ‘diamond-tall’, ‘diamond-tall-open’, ‘diamond-tall-dot’, ‘diamond-tall-open-dot’, ‘diamond-wide’, ‘diamond-wide-open’, ‘diamond-wide-dot’, ‘diamond-wide-open-dot’, ‘hourglass’, ‘hourglass-open’, ‘bowtie’, ‘bowtie-open’, ‘circle-cross’, ‘circle-cross-open’, ‘circle-x’, ‘circle-x-open’, ‘square-cross’, ‘square-cross-open’, ‘square-x’, ‘square-x-open’, ‘diamond-cross’, ‘diamond-cross-open’, ‘diamond-x’, ‘diamond-x-open’, ‘cross-thin’, ‘cross-thin-open’, ‘x-thin’, ‘x-thin-open’, ‘asterisk’, ‘asterisk-open’, ‘hash’, ‘hash-open’, ‘hash-dot’, ‘hash-open-dot’, ‘y-up’, ‘y-up-open’, ‘y-down’, ‘y-down-open’, ‘y-left’, ‘y-left-open’, ‘y-right’, ‘y-right-open’, ‘line-ew’, ‘line-ew-open’, ‘line-ns’, ‘line-ns-open’, ‘line-ne’, ‘line-ne-open’, ‘line-nw’, ‘line-nw-open’, ‘arrow-up’, ‘arrow-up-open’, ‘arrow-down’, ‘arrow-down-open’, ‘arrow-left’, ‘arrow-left-open’, ‘arrow-right’, ‘arrow-right-open’, ‘arrow-bar-up’, ‘arrow-bar-up-open’, ‘arrow-bar-down’, ‘arrow-bar-down-open’, ‘arrow-bar-left’, ‘arrow-bar-left-open’, ‘arrow-bar-right’, ‘arrow-bar-right-open’, ‘arrow’, ‘arrow-open’, ‘arrow-wide’, ‘arrow-wide-open’

  • value (float or int) – The value of the marker. Default is the current portfolio value.

  • color (str) – The color of the marker. Possible values are “red”, “green”, “blue”, “yellow”, “orange”, “purple”, “pink”, “brown”, “black”, and “white”.

  • size (int) – The size of the marker.

  • detail_text (str) – The text to display when the marker is hovered over.

  • dt (datetime.datetime or pandas.Timestamp) – The datetime of the marker. Default is the current datetime.

Example

>>> # Will add a marker to the chart
>>> self.add_chart_marker("Overbought", symbol="circle", color="red", size=10)