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

Understanding syminfo.type Function in Pine Script

Photo of author
Published on

Introduction to syminfo.type

Pine Script, primarily used in the TradingView platform, is a versatile tool for creating custom trading indicators and strategies. A crucial aspect of scripting in Pine Script is understanding various built-in variables that provide valuable information about the trading environment. One such variable is syminfo.type, which holds significant importance in discerning the market type of the currently selected symbol.

What is syminfo.type?

syminfo.type is a built-in string variable in Pine Script that indicates the type of market the current symbol belongs to. This can be critical in customizing scripts based on the market type, as different markets like stocks, futures, and forex may require different analytical approaches.

Possible Values of syminfo.type

The syminfo.type variable can take on one of the following values, each representing a different market type:

  • “stock”
  • “futures”
  • “index”
  • “forex”
  • “crypto”
  • “fund”
  • “dr” (Depositary Receipt)
  • “cfd” (Contract for Difference)
  • “bond”
  • “warrant”
  • “structured”
  • “right”

These values help in tailoring strategies or indicators to specific market types. For instance, a strategy suitable for forex might not be suitable for stocks due to differences in market behavior.


Let’s create a basic Pine Script example that utilizes syminfo.type to display the type of market of the selected symbol.

Code Example

indicator("Market Type Display", overlay=true)

// Define a variable to hold the market type
string marketType = syminfo.type

// Display the market type on the chart
label.new(bar_index, high, "Market Type: " + marketType, color=color.red)


  1. Version Specification: //@version=5 specifies that this script uses Pine Script version 5.
  2. Indicator Declaration: indicator("Market Type Display", overlay=true) defines a new indicator named “Market Type Display” and sets it to overlay on the price chart.
  3. Variable Declaration: string marketType = syminfo.type declares a string variable marketType and assigns it the value of syminfo.type, which represents the market type of the current symbol.
  4. Displaying the Market Type: label.new(bar_index, high, "Market Type: " + marketType, color=color.red) creates a new label on the chart that displays the market type. It positions the label at the current bar and at the high price level.

Key Features of syminfo.type

  • Function Usability: syminfo.type is a read-only variable that provides the market type of the symbol on which the script is running.
  • Syntax and Application: Being a string variable, it’s often used in conditional statements to apply different logic based on the market type.
  • Versatility: This variable is crucial for scripts intended to be used across various market types, enabling customization and adaptability.


  • syminfo.type is an essential variable for identifying the market type in Pine Script.
  • It offers a range of values corresponding to different market types.
  • The simple example provided demonstrates how to use syminfo.type to display the market type on a TradingView chart.

Leave a Comment