A comprehensive plugin that adds full PineScript v6 language support to PyCharm and IntelliJ IDEA, enabling syntax highlighting, code completion, and intelligent editing features for TradingView's PineScript language.
- Full v6 Syntax: Complete support for PineScript v6 features including:
typekeyword for user-defined types (UDTs)enumkeyword for enumerationsmethodkeyword for method declarationsswitchstatement support- Logical operators:
and,or,not
- Smart Highlighting: Distinct colors for keywords, constants, strings, numbers, comments, identifiers, operators, and annotations
- Annotation Support: Special highlighting for PineScript annotations:
@version- Script version specification@type- Type documentation@enum- Enumeration documentation@field- Field documentation@function- Function documentation@param- Parameter documentation@returns- Return value documentation@variable- Variable documentation@description- General description
Over 500+ autocomplete items covering all major PineScript namespaces:
50+ functions including:
- Moving averages:
sma,ema,wma,vwma,rma,alma,kama - Oscillators:
rsi,macd,stoch,cci,mfi,tsi - Channels:
bb,bbw,kc - Volatility:
atr,tr,stdev,variance - Trend:
sar,supertrend,adx,dmi,aroon - Statistics:
correlation,median,mode,percentrank - Utilities:
cross,crossover,crossunder,change,valuewhen,barssince
- Constructors:
new_float,new_int,new_bool,new_string,new_color,new_line,new_label,new_box - Operations:
get,set,push,pop,shift,unshift,insert,remove,clear - Manipulation:
concat,copy,slice,reverse,sort,sort_indices - Search:
includes,indexof,lastindexof,binary_search - Statistics:
min,max,sum,avg,median,mode,stdev,variance
new,get,put,put_all,remove,clearcontains,keys,values,size,copy
- Creation:
new,copy,submatrix - Access:
get,set,row,col,rows,columns - Manipulation:
add_row,add_col,remove_row,remove_col,swap_rows,swap_columns - Operations:
transpose,reshape,concat,mult,pow,diff,reverse,fill - Linear algebra:
det,inv,pinv,rank,trace,eigenvalues,eigenvectors - Statistics:
sum,avg,median,mode,max,min,range,stdev,variance - Predicates:
is_square,is_identity,is_binary,is_zero,is_stochastic,is_symmetric,is_antisymmetric
- Lines (line.*):
new,delete,get_*,set_*,copy,all - Labels (label.*):
new,delete,get_*,set_*,copy,all - Boxes (box.*):
new,delete,get_*,set_*,copy,all - Polylines (polyline.*) - v6:
new,delete,copy,all - Linefills (linefill.*) - v6:
new,delete,get_line1,get_line2,set_color,copy
- Functions:
rgb,new,from_gradient - Constants:
aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,orange,purple,red,silver,teal,white,yellow
- Strings (str.*):
tostring,tonumber,format,substring - Math (math.*): 20+ mathematical functions
- Request (request.*):
security,earnings,dividends - Strategy (strategy.*):
entry,exit,order,position_avg_price,position_size - Input (input.*):
bool,color,float,int,string,session,timeframe,symbol,enum - Timeframe (timeframe.*):
in_seconds,from_seconds - Ticker (ticker.*):
new,heikinashi,renko,linebreak,kagi,pointfigure - Table (table.*): Table creation and manipulation functions
- Chart (chart.*): Chart type constants and variables
- OHLCV:
open,high,low,close,volume,time - Derived prices:
hl2,hlc3,ohlc4,hlcc4 - Bar state:
barstate.*(isconfirmed, isfirst, ishistory, islast, isnew, isrealtime) - Symbol info:
syminfo.*(basecurrency, currency, description, ticker, timezone, type, etc.) - Timeframe:
timeframe.*(period, multiplier, isdaily, isintraday, isweekly, ismonthly, etc.) - Chart:
chart.*(is_standard, bg_color, left_visible_bar_time, etc.)
- Bracket Matching: Automatic matching for
(),{},[] - Quote Handling: Smart quote pairing for strings
- Code Style: Configurable code style settings
- File extensions:
.pine,.pinescript - Proper file type icons and associations
- IntelliJ IDEA or PyCharm: Version 2023.1 or later (up to 2024.1)
- Java Development Kit (JDK): Version 17 or higher
- Gradle: Version 7.0 or higher (for building from source)
- Open PyCharm or IntelliJ IDEA
- Go to File → Settings (or IntelliJ IDEA → Preferences on macOS)
- Navigate to Plugins
- Search for "PineScript Language Support"
- Click Install
- Restart the IDE
- Download the latest
.zipfile from the Releases page - Open PyCharm or IntelliJ IDEA
- Go to File → Settings → Plugins
- Click the gear icon ⚙️ and select Install Plugin from Disk...
- Select the downloaded
.zipfile - Restart the IDE
See the Building the Plugin section below.
-
Install JDK 17 or higher
# Verify Java installation java -version -
Install Gradle (if not already installed)
# On macOS with Homebrew brew install gradle # On Linux (Debian/Ubuntu) sudo apt-get install gradle # On Windows with Chocolatey choco install gradle # Verify Gradle installation gradle --version
-
Clone the repository
git clone https://github.com/deepentropy/intellij-pinescript.git cd intellij-pinescript -
Generate Gradle Wrapper (if not present)
gradle wrapper
-
Build the plugin
./gradlew buildPlugin
Or on Windows:
gradlew.bat buildPlugin
-
Locate the built plugin
The plugin
.zipfile will be created in:build/distributions/intellij-pinescript-1.0.3.zip
✅ Supported Gradle Versions:
- Gradle 8.10 or higher (recommended: 8.10.2)
- Gradle 9.x (including 9.2.0)
✅ Supported IDE Versions:
- IntelliJ IDEA 2024.1+ (build 241+)
- PyCharm 2024.1+ up to 2025.2.4 (build 252.*)
The project uses IntelliJ Platform Gradle Plugin 2.1.0 which supports modern Gradle versions.
Issue 1: "Type org.gradle.api.internal.plugins.DefaultArtifactPublicationSet not present"
This error occurs with older plugin versions. The project now uses plugin 2.1.0 which fixes this.
Solution:
# Pull the latest changes
git pull
# Use the wrapper (downloads correct Gradle version automatically)
./gradlew buildPlugin
# On Windows
gradlew.bat buildPluginIssue 2: Gradle Compatibility Error
If you get an error about incompatible Gradle versions:
-
Clear Gradle caches
# Linux/Mac ./gradlew clean rm -rf ~/.gradle/caches # Windows (PowerShell) .\gradlew.bat clean Remove-Item -Recurse -Force $env:USERPROFILE\.gradle\caches
-
Delete wrapper and regenerate
# Remove existing wrapper files rm -rf gradle/wrapper # Windows rmdir /s /q gradle\wrapper # Then run gradle wrapper again gradle wrapper
-
Use offline mode (if you have cached dependencies)
./gradlew buildPlugin --offline
-
Check network connectivity
Ensure you can access:
-
Verify settings.gradle.kts
Ensure
settings.gradle.ktscontains:pluginManagement { repositories { gradlePluginPortal() mavenCentral() } } -
Check Java version
java -version
Ensure you have JDK 17 or higher installed.
If Gradle build fails, you can manually compile:
# Create output directory
mkdir -p build/classes/java/main
# Compile Java sources (you'll need IntelliJ SDK jars)
javac -d build/classes/java/main \
-cp "/path/to/intellij/lib/*" \
$(find src/main/java -name "*.java")
# Create JAR
cd build/classes/java/main
jar cvf ../../../../intellij-pinescript.jar .
cd ../../../..
# Package as plugin (create META-INF and add plugin.xml)
mkdir -p plugin/lib
cp intellij-pinescript.jar plugin/lib/
cp plugin.xml plugin/META-INF/
cd plugin
zip -r ../intellij-pinescript-1.0.3.zip .-
Restart PyCharm/IntelliJ IDEA after installation
-
Verify Installation
- Go to File → Settings → Plugins
- Look for "PineScript Language Support" in the installed plugins list
- Ensure it's enabled (checkbox is checked)
-
Open or Create PineScript Files
- Create a new file with
.pineor.pinescriptextension - The file should automatically be recognized with proper syntax highlighting
- Create a new file with
-
Test Code Completion
- Type
ta.and pressCtrl+Space(orCmd+Spaceon macOS) - You should see autocomplete suggestions for technical analysis functions
- Try typing
@versionin a comment to see annotation highlighting
- Type
-
Configure Color Scheme (Optional)
- Go to File → Settings → Editor → Color Scheme → PineScript
- Customize colors for keywords, strings, comments, annotations, etc.
-
New File Method 1:
- Right-click in the Project view
- Select New → File
- Name it with
.pineextension (e.g.,my_indicator.pine)
-
New File Method 2:
- Use File → New → File
- Enter filename:
my_indicator.pine
-
Start Coding:
//@version=6 //@description My custom indicator indicator("My Indicator", overlay=true) //@type Price bar structure type PriceBar float open float high float low float close // Calculate SMA smaValue = ta.sma(close, 20) // Plot plot(smaValue, color=color.blue, title="SMA 20")
- Code Completion:
Ctrl+Space(Windows/Linux) orCmd+Space(macOS) - Parameter Info:
Ctrl+P(Windows/Linux) orCmd+P(macOS) - Quick Documentation:
Ctrl+Q(Windows/Linux) orF1(macOS) - Reformat Code:
Ctrl+Alt+L(Windows/Linux) orCmd+Opt+L(macOS)
//@version=6
indicator("UDT Example")
//@type Represents a candlestick pattern
type Candle
float open
float high
float low
float close
bool isBullish = close > open
candle = Candle.new()
plot(candle.close)
//@version=6
indicator("Enum Example")
//@enum Trading session types
enum Session
asian = "Asian Session"
european = "European Session"
american = "American Session"
selectedSession = input.enum(Session.american, "Session")
//@version=6
indicator("Method Example")
//@function Calculates percentage change
method pctChange(series float src, simple int length) =>
(src - src[length]) / src[length] * 100
pct = close.pctChange(10)
plot(pct, title="10-bar % Change")
//@version=6
indicator("Switch Example")
maType = input.string("EMA", "MA Type", options=["SMA", "EMA", "WMA"])
ma = switch maType
"SMA" => ta.sma(close, 20)
"EMA" => ta.ema(close, 20)
=> ta.wma(close, 20)
plot(ma)
intellij-pinescript/
├── src/main/java/io/github/deepentropy/pinescript/
│ ├── PineScriptLanguage.java # Core language definition
│ ├── PineScriptFileType.java # File type registration
│ ├── PineScriptBraceMatcher.java # Bracket matching
│ ├── PineScriptQuoteHandler.java # Quote handling
│ ├── PineScriptCodeStyleSettingsProvider.java
│ ├── lexer/
│ │ └── PineScriptLexer.java # Lexical analyzer
│ ├── psi/
│ │ └── PineScriptTokenTypes.java # Token definitions
│ ├── highlighting/
│ │ ├── PineScriptSyntaxHighlighter.java
│ │ ├── PineScriptSyntaxHighlighterFactory.java
│ │ └── PineScriptColorSettingsPage.java
│ └── completion/
│ └── PineScriptCompletionContributor.java
├── docs/markdown/built-in-indicators/ # Indicator documentation
├── src/main/resources/META-INF/
│ └── plugin.xml # Plugin configuration
├── build.gradle.kts # Build configuration
├── settings.gradle.kts # Gradle settings
└── README.md # This file
-
Open project in IntelliJ IDEA
idea . -
Run the plugin in development
./gradlew runIde
This launches a new IntelliJ IDEA instance with the plugin installed
-
Enable debug mode
./gradlew runIde --debug-jvm
- Modify source files in
src/main/java/ - Test changes with
./gradlew runIde - Build final plugin with
./gradlew buildPlugin
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- TradingView for creating PineScript
- JetBrains for the IntelliJ Platform SDK
- The PineScript community for feedback and suggestions
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: PineScript v6 Reference
- Full PineScript v6 syntax support
- 500+ autocomplete items
- User-defined types, enums, and methods
- Annotation highlighting
- Comprehensive namespace coverage
Made with ❤️ for the PineScript community