-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Feature Request
Pine Script's fill() function supports value-range gradient fills:
fill(tsiPlot, midLinePlot, 1, 0, top_color = bullishColor, bottom_color = color.new(bullishColor, 100), title = "Bullish Gradient Fill")
fill(tsiPlot, midLinePlot, 0, -1, top_color = color.new(bearishColor, 100), bottom_color = bearishColor, title = "Bearish Gradient Fill")
This creates fills where opacity varies based on the value position within a range (e.g., fully opaque at the extremes, fully transparent near zero).
Current state
FillData supports static single-color fills between two plots via options.color and options.transp. There is no support for:
- Value-range based fills (the 4-parameter form:
fill(plot1, plot2, topValue, bottomValue, ...)) - Gradient between two colors (
top_color/bottom_color) - Per-bar opacity variation based on value position
Use case
The official Trend Strength Index indicator uses this for a gradient fill between the TSI line and zero, fading from opaque near ±1 to transparent near 0. Without this, there's no way to reproduce the official display.
Suggested API
interface FillOptions {
// existing
color?: string;
transp?: number;
// new
topValue?: number;
bottomValue?: number;
topColor?: string;
bottomColor?: string;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels