Home » Symbol Information Functions » Understanding syminfo.description Function in Pine Script

Understanding syminfo.description Function in Pine Script

Photo of author
Published on

In this article, we’ll delve into the syminfo.description built-in variable available in Pine Script Version 5, exploring its usage, application, and some practical examples.

What is syminfo.description?

Definition and Functionality

syminfo.description is a built-in variable in Pine Script that provides a textual description of the current financial instrument or symbol. This description is often more detailed compared to the symbol’s name or ticker, offering additional insights into the traded asset.

Usage in Pine Script

Accessing Symbol Description

To access the symbol description in Pine Script, you can simply use the variable syminfo.description. This variable is read-only and automatically retrieves the description of the symbol on which the script is currently running.


Let’s consider an example where we want to display the symbol’s description on the chart:

indicator("Symbol Description Display", shorttitle="SymDesc", overlay=true)

// Retrieving the symbol description
symbolDescription = syminfo.description

// Plotting the description on the chart
label.new(bar_index, high, text=symbolDescription, style=label.style_label_down, color=color.red)

In this example, symbolDescription is a variable that stores the current symbol’s description. We then create a label on the chart to display this description.

Detailed Walkthrough of the Code

  1. Script Declaration://@version=5 indicator(“Symbol Description Display”, shorttitle=”SymDesc”, overlay=true)
    • This line declares the script using Pine Script version 5. It defines the script as an indicator with a full name and a short title. The overlay=true property ensures that the indicator is displayed over the price chart.
  2. Retrieving Symbol Description:symbolDescription = syminfo.description
    • Here, symbolDescription is assigned the value of syminfo.description, which contains the detailed description of the current symbol.
  3. Displaying the Description:label.new(bar_index, high, text=symbolDescription, style=label.style_labeldown, color=color.red)
    • This line creates a new label on the chart. It is used bar_index for the x-coordinate and high for the y-coordinate, placing the label above the current price. The text of the label is the symbol description, and the label is styled to point downwards with a red color.

Key Features and Takeaways

  • Functionality: syminfo.description provides a detailed description of the financial instrument, offering more context than just the symbol or ticker.
  • Read-Only: This variable is read-only and automatically adapts to the symbol on which the script is applied.
  • Versatility: It can be used for displaying information on charts, filtering symbols based on their description, or adding context to custom indicators or strategies.
  • Ease of Use: Simple to implement, requiring no complex functions or additional settings.

By understanding and utilizing syminfo.description in Pine Script, developers can enhance their trading tools, providing end-users with more informative and context-rich indicators and strategies.

Leave a Comment