infoLine
Draw a line between two points that also shows extra information, like the price difference, percentage change, or even a custom label. Think of it as a measuring tool that’s always attached to the chart.
Syntax
infoLine(fromPoint, toPoint, styles?, text?)
Parameters
fromPoint: Starting point of the line. Use
newPoint(time, price).toPoint: End point of the line. Also built with
newPoint(time, price).styles (optional) Options to style the info line:
text (optional): A short custom label you want to show on the line.
Return Value
string — A unique drawing
idyou can later use to update or delete the line.
Example
Draw one info line between the last two candle closes, showing the label “Measure”:
You’ll see one green info line connecting the last two closing prices, with a small label showing “Measure.”
Result

Tips
Tip: Use
infoLinewhen you want to highlight movement between two points (like high vs. low, or yesterday vs. today).Tip: If you add
showLabel: truewithout customtext, it still shows useful info (like % change).
Warning
Warning: If you forget to provide both
fromPointandtoPoint, nothing will be drawn.Warning: Passing a label in
textwithoutshowLabel: truemeans the label won’t appear.
Good Practice
Good Practice: Keep your info lines temporary (like measuring tools), so don’t clutter the chart with many of them.
Good Practice: Pick neutral colors (gray/blue) for measuring lines so they don’t distract from your main signals.
Last updated