Indicators and associated signals can be easily plotted using the
plot_indicator(ctx, name, x, y, signals)
keyword.
Where:
name
: name of the indicator on the chartx
: values to use for the x axisy
: values to use for the y axissignal
: (optional) x values for which a signal is fired
Example where the goal is to plot the value of the rsi indicator from the example script.
await op.plot_indicator(ctx, "RSI", time_values, indicator_values, signal_times)
Anything can be plotted using the plot(ctx, name, ...)
keyword.
The plot arguments are converted into plotly charts parameters.
Where:
name
: name of the indicator on the chart
Optional arguments:
x
: values to use for the x axisy
: values to use for the y axisz
: values to use for the z axistext
: point labelsmode
: plotly mode ("lines", "markers", "lines+markers", "lines+markers+text", "none")chart
: "main-chart" or "sub-chart" (default is "sub-chart")own_yaxis
: when True, uses an independent y axis for this plot (default is False)color
: color the of plotopen
: open values for a candlestick charthigh
: high values for a candlestick chartlow
: low values for a candlestick chartclose
: close values for a candlestick chartvolume
: volume values for a candlestick chartlow
: low values for a candlestick chart
Example:
await op.plot(ctx, "RSI", x=time_values, y=indicator_values, mode="markers")