Pine Script Learning Resources
A curated collection of the best Pine Script resources, documentation, tutorials, and tools to accelerate your trading automation journey.
Where can I find Pine Script strategy examples and reference?
Your language reference is TradingView's own Pine Script v6 User Manual, and it is free. For worked examples, three places pay off, and the largest of them is the least reliable. The manual is authoritative, the public script library is the biggest collection of real code, and the PineCoders community writes the conventions the other two mostly ignore.
TradingView gives a script two minutes to compile, and after three consecutive warnings it enforces a one-hour ban on compilation attempts.
TradingView Pine Script v6 User Manual, Limitations. Source checked 28 October 2026.
Pine Script Documentation Hub
Access comprehensive documentation for all Pine Script versions with version comparison and migration guides.
Key Features
| Feature | V6 | V5 | V4 | V3 |
|---|---|---|---|---|
| Enhanced Type System | ✓ | — | — | — |
| Improved Performance | ✓ | — | — | — |
| New Built-in Functions | ✓ | — | — | — |
| Better Error Messages | ✓ | — | — | — |
| Advanced Debugging Tools | ✓ | — | — | — |
| Objects and Methods | — | ✓ | — | — |
| Libraries Support | — | ✓ | — | — |
| Enhanced Arrays | — | ✓ | — | — |
| Improved Maps | — | ✓ | — | — |
| Type System Improvements | — | ✓ | — | — |
| Core Pine Script Features | — | — | ✓ | — |
| Basic Type System | — | — | ✓ | — |
| Essential Built-ins | — | — | ✓ | — |
| Standard Library | — | — | ✓ | — |
| Basic Pine Script | — | — | — | ✓ |
| Simple Indicators | — | — | — | ✓ |
| Core Functions | — | — | — | ✓ |
Interactive Reference Manual
All 935 entries of TradingView's Pine Script v6 reference, searchable here. Open any row to land on that entry in the official reference.
Bookmarks stay in this browser, under pss.pine.reference.bookmarks.
935 entries
expr1 - expr2Subtraction or unary minus. Applicable to numerical expressions.
Open in the official referenceexpr1 -= expr2Subtraction assignment. Applicable to numerical expressions.
Open in the official reference<var_name> := <new_value>Reassignment operator. It is used to assign a new value to a previously declared variable.
Open in the official referenceexpr1 != expr2Inequality operator. Returns true if the operands are considered not equal, and false otherwise. This operator is compatible with all value types, including "int", "float", "bool", "color", and "string". The operator can also compare two line or label IDs.
Open in the official referenceexpr1[expr2]Series subscript. Provides access to previous values of series expr1. expr2 is the number of bars back, and must be numerical. Floats will be rounded down.
Open in the official referenceexpr1 *= expr2Multiplication assignment. Applicable to numerical expressions.
Open in the official referenceexpr1 /= expr2Division assignment. Applicable to numerical expressions.
Open in the official referenceexpr1 % expr2Modulo (integer remainder). Applicable to numerical expressions.
Open in the official referenceexpr1 + expr2Addition or unary plus. Applicable to numerical expressions or strings.
Open in the official referenceexpr1 += expr2Addition assignment. Applicable to numerical expressions or strings.
Open in the official referenceexpr1 <= expr2Less than or equal to. Applicable to numerical expressions.
Open in the official reference<var_name> := <initial_value>Assignment operator. Assigns an initial value or reference to a declared variable. It means this is a new variable, and it starts with this value.
Open in the official referenceexpr1 == expr2Equality operator. Returns true if the operands are considered equal, and false otherwise. This operator is compatible with all value types, including "int", "float", "bool", "color", and "string". The operator can also compare two line or label IDs.
Open in the official reference<identifier>([<parameter_name>[=<default_value>]], ...) => <local_block> <function_result>The '=>' operator is used in user-defined function declarations and in switch statements.
Open in the official referenceexpr1 >= expr2Greater than or equal to. Applicable to numerical expressions.
Open in the official referenceConstant for dividends adjustment type (dividends adjustment is applied).
Open in the official referenceConstant for none adjustment type (no adjustment is applied).
Open in the official referenceConstant for splits adjustment type (splits adjustment is applied).
Open in the official referencealert(message, freq) → voidCreates an alert trigger for an indicator or strategy, with a specified frequency, when called on the latest realtime bar. To activate alerts for a script containing calls to this function, open the "Create Alert" dialog box, then select the script name and "Any alert() function…
Open in the official referenceA named constant for use with the freq parameter of the alert() function.
Open in the official referenceA named constant for use with the freq parameter of the alert() function.
Open in the official referenceA named constant for use with the freq parameter of the alert() function.
Open in the official referencealertcondition(condition, title, message) → voidCreates alert condition, that is available in Create Alert dialog. Please note, that alertcondition() does NOT create an alert, it just gives you more options in Create Alert dialog. Also, alertcondition() effect is invisible on chart.
Open in the official referenceKeyword used to explicitly declare the "array" type of a variable or a parameter. Array objects (or IDs) can be created with the array.new<type>(), array.from() function.
Open in the official referencearray.abs(id) → array<float>Returns an array containing the absolute value of each element in the original array.
Open in the official referencearray.avg(id) → series floatThe function returns the mean of an array's elements.
Open in the official referencearray.binary_search(id, val) → series intPerforms a binary search through a sorted array to locate an element corresponding to a target value. The function returns an element's index if the value from that element equals the target value. Otherwise, it returns -1.
Open in the official referencearray.binary_search_leftmost(id, val) → series intPerforms a binary search through a sorted array to locate an element corresponding to a target value. If the function locates the target value in the array's elements or referenced object fields, it returns the index of the first element whose retrieved value equals that value.
Open in the official referencearray.binary_search_rightmost(id, val) → series intPerforms a binary search through a sorted array to locate an element corresponding to a target value. If the function locates the target value in the array's elements or referenced object fields, it returns the index of the last element whose retrieved value equals that value.
Open in the official referencearray.clear(id) → voidThe function removes all elements from an array.
Open in the official referencearray.concat(id1, id2) → array<type>The function is used to merge two arrays. It pushes all elements from the second array to the first array, and returns the first array.
Open in the official referencearray.copy(id) → array<type>The function creates a copy of an existing array.
Open in the official referencearray.covariance(id1, id2, biased) → series floatThe function returns the covariance of two arrays.
Open in the official referencearray.every(id) → series boolReturns true if all elements of the id array are true, false otherwise.
Open in the official referencearray.fill(id, value, index_from, index_to) → voidThe function sets elements of an array to a single value. If no index is specified, all elements are set. If only a start index (default 0) is supplied, the elements starting at that index are set.
Open in the official referencearray.first(id) → series <type>Returns the array's first element. Throws a runtime error if the array is empty.
Open in the official referencearray.from(arg0, arg1, ...) → array<type>The function takes a variable number of arguments with one of the types: int, float, bool, string, label, line, color, box, table, linefill, and returns an array of the corresponding type.
Open in the official referencearray.get(id, index) → series <type>The function returns the value of the element at the specified index.
Open in the official referencearray.includes(id, value) → series boolThe function returns true if the value was found in an array, false otherwise.
Open in the official referencearray.indexof(id, value) → series intThe function returns the index of the first occurrence of the value, or -1 if the value is not found.
Open in the official referencearray.insert(id, index, value) → voidThe function changes the contents of an array by adding new elements in place.
Open in the official referencearray.join(id, separator) → series stringThe function creates and returns a new string by concatenating all the elements of an array, separated by the specified separator string.
Open in the official referencearray.last(id) → series <type>Returns the array's last element. Throws a runtime error if the array is empty.
Open in the official referencearray.lastindexof(id, value) → series intThe function returns the index of the last occurrence of the value, or -1 if the value is not found.
Open in the official referencearray.max(id, nth) → series floatThe function returns the greatest value, or the nth greatest value in a given array.
Open in the official referencearray.median(id) → series floatThe function returns the median of an array's elements.
Open in the official referencearray.min(id, nth) → series floatThe function returns the smallest value, or the nth smallest value in a given array.
Open in the official referencearray.mode(id) → series floatThe function returns the mode of an array's elements. If there are several values with the same frequency, it returns the smallest value.
Open in the official referencearray.new_bool(size, initial_value) → array<bool>The function creates a new array object of bool type elements.
Open in the official referencearray.new_box(size, initial_value) → array<box>The function creates a new array object of box type elements.
Open in the official referencearray.new_color(size, initial_value) → array<color>The function creates a new array object of color type elements.
Open in the official referencearray.new_float(size, initial_value) → array<float>The function creates a new array object of float type elements.
Open in the official referencearray.new_int(size, initial_value) → array<int>The function creates a new array object of int type elements.
Open in the official referenceOffline Downloads
TradingView's Pine Script manual, mirrored into a file you can read with no connection: every page, every figure, searchable. Fetched 29 October 2026, free, no account needed.
Community Resources
Handpicked resources from the Pine Script community to help you learn, develop, and master trading automation.

TradingView Official Website
The official platform for charting, trading, and Pine Script automation.

PineCoders Website
An excellent resource managed by the Official Pine Script Team, with FAQs and code snippets.

Pine Script Blog (TradingView)
Official blog for updates on the newest Pine Script advancements and features.

BackTest Rookies
A solid website offering tutorials and tips and tricks on Pine Script and TradingView.

Kodify
An independent website with a blog and tutorials on Pine Script, particularly good for beginners.

GitHub Repos Tagged with Pine Script
Explore open-source scripts and projects related to Pine Script on GitHub.

Keyboard Shortcuts For Pine Editor
Become a Pine Maestro with quick hands and shortcuts for the Pine Editor.

Awesome Pine Script (GitHub)
A curated GitHub repository with a comprehensive collection of Pine Script resources.