Indicators
Can I create an indicator that plots like the built-in Volume or Volume Profile indicators?
The Volume and Visible Range Volume Profile indicators (along with some other built-in indicators) are written in Java. They display data on the main chart pane in a unique way:
- The bars are anchored to the bottom or right edge of the chart, not to an absolute x or y value.
- The length of the bars is a relative percentage of the available space and is not an absolute price or number of bars.
- The length of the bars adjusts automatically according to the data from the range of bars that are visible on the chart. The lengths of the bars are normalized so as never to appear too small or too large.
- The width of the bars adjusts automatically to fit the visible space.
It is difficult for Lipi Script indicators to plot values in the same way.
Limitations of plotStyle.columns
Volume, or another series, plotted as columns, is anchored to the bottom of the chart, and the width and length of the bars can adjust dynamically. However, the tops of the bars are defined by absolute price values. This means that it is not possible for the series to be plotted on the main chart without distorting the price scale. Also, plots must be defined during the processing of the bar they are plotted on and cannot be plotted retroactively.
How can I use the output from one script as input to another?
Scripts with an input of type input.source()
can take a plot from another script (up to a maximum of ten) as an input. Select the script and plot to take as input in the script’s “Settings” tab. If the user removes the script from the chart and adds it again, they must select the correct inputs again.
The sources used as external inputs must originate from indicators; they cannot originate from strategies. However, plots originating from indicators can be used in strategies.
Can my script draw on the main chart when it’s running in a separate pane?
Scripts that have the overlay
parameter in the indicator()
functions set to false appear in a separate pane from the main chart. Such scripts can affect the display of the main chart in only two ways:
- Changing bar colors, using the
barcolor()
function. - Forcing plots to overlay, using
force_overlay = true
in the plotting function. Theforce_overlay
parameter is available in most functions that draw on the chart.