fill
Shades the band between two plots, or between two horizontal lines. It has two forms and no mixed one, so you cannot fill between a plot and a level, and like the other output calls it must sit at the top level. The forms differ in argument order, and that is the thing that bites: for two levels the third argument is the colour, for two plots it is the title. Name the arguments and the difference stops mattering. When you fill between two plots, the fill keeps an offset only if both plots carry the same one.
fill(series hline h1, series hline h2, series color color, const string title, const bool fillgaps) → voidfill(series plot p1, series plot p2, const string title, series color color, const bool fillgaps) → void| Parameter | Type | Required | Description |
|---|---|---|---|
h1 | series hline | yes | The first horizontal line. Required in the level form. |
h2 | series hline | yes | The second horizontal line. Required in the level form. |
color | series color | no | The fill colour. Series-form. Third argument in the level form, fourth in the plot form. |
title | const string | no | The fill’s name. Const-form. Fourth argument in the level form, third in the plot form. |
fillgaps | const bool | no | Whether gaps are filled. Const-form, so it is fixed for the run of the script. Last argument in both forms. |
p1 | series plot | yes | The first plot. Required in the plot form. |
p2 | series plot | yes | The second plot. Required in the plot form. |
Returns void — void.
indicator("Range band")
top = plot(high, title = "High")
bottom = plot(low, title = "Low")
fill(p1 = top, p2 = bottom, title = "Range", color = color.blue)See also fills and levels
Part of the function index.
Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.