self.add_line

lumibot.strategies.strategy.Strategy.add_line(self, name, value, color=None, style='solid', width=None, detail_text=None, dt=None)

Adds a line data point to the indicator chart. This can be used to add lines such as bollinger bands, prices for specific assets, or any other line you want to add to the chart.

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

  • value (float or int) – The value of the line.

  • color (str) – The color of the line. Possible values are “red”, “green”, “blue”, “yellow”, “orange”, “purple”, “pink”, “brown”, “black”, “white”, “gray”, “lightgray”, “darkgray”, “lightblue”, “darkblue”, “lightgreen”, “darkgreen”, “lightred”, “darkred” and any hex color code.

  • style (str) – The style of the line. Possible values are “solid”, “dotted”, and “dashed”.

  • width (int) – The width of the line.

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

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

Example

>>> # Will add a line to the chart
>>> self.add_chart_line("Overbought", value=80, color="red", style="dotted", width=2)