Pine Library · 198 open-source scripts

Free Pine Script Libraries (page 4)

Open-source Pine Script libraries: collections of functions that other indicators and strategies import, so you do not write the same code twice.

Pine scripts198
Code shown here159open licence
Updated in a year73
No repaint flag189

Libraries: All

MathComplexExtension

by ricardosantos79
261 stars

This Pine Script v5 library extends complex-number handling for other scripts. It treats a complex value as a two-element float array of real and imaginary parts. It exports get_phase, which returns the argument in radians or degrees with quadrant and axis spe

Library v5
Updated 4 years ago · None stated GitHub repository of MathComplexExtension

MathComplexOperator

by ricardosantos79
261 stars

MathComplexOperator is a Pine Script v5 library of utility functions for pseudo complex numbers stored as two-element float arrays of real and imaginary parts. It computes the conjugate by flipping the imaginary sign, adds two complex values, and subtracts one

Library v5
Updated 4 years ago · None stated GitHub repository of MathComplexOperator

LiquidityFinderLibrary

by alvinng214
2 stars

This Pine Script library exports a liquidity line detection function designed for Smart Money Concepts analysis. It identifies static and dynamic pivot highs and lows over customizable lookback periods, normalizing price differences between consecutive swing p

Library v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of LiquidityFinderLibrary

MathComplexTrignometry

by ricardosantos79
261 stars

MathComplexTrignometry is a Pine Script library that provides trigonometric operations for complex numbers represented as float arrays. It implements standard, hyperbolic, arc, and hyperbolic arc trigonometric functions such as sinh, cosh, and tanh. As a devel

Library v5
Updated 4 years ago · None stated GitHub repository of MathComplexTrignometry

MathConstants

by ricardosantos79
261 stars

This Pine Script v5 library exports frequently used mathematical constants as functions that return fixed numeric values. It includes e, pi, natural and base-10 logarithms of e, 2, 10 and pi, square roots of e, 2, 3 and pi, and related products and inverses su

Library v5
Updated 4 years ago · None stated GitHub repository of MathConstants

MathConstantsAtomic

by ricardosantos79
261 stars

This Pine Script library provides a collection of atomic and nuclear physical constants based on CODATA reference values. It exports functions returning fundamental physical measurements, including the fine-structure constant, Rydberg constant, Bohr radius, Ha

Library v5
Updated 4 years ago · None stated GitHub repository of MathConstantsAtomic

MathConstantsElectromagnetic

by ricardosantos79
261 stars

MathConstantsElectromagnetic is a Pine Script library that provides a collection of predefined electromagnetic constants based on 2007 CODATA reference values. It exports functions for physical parameters including elementary electron charge, magnetic flux qua

Library v5
Updated 4 years ago · None stated GitHub repository of MathConstantsElectromagnetic

MathConstantsScientific

by ricardosantos79
261 stars

This Pine Script v5 library exports named SI scientific prefix factors as constant functions. Each function returns a power of ten, from Yotta through Yocto, covering large prefixes such as Giga and Mega and small prefixes such as Milli, Micro, and Nano. It ca

Library v5
Updated 4 years ago · None stated GitHub repository of MathConstantsScientific

SMC Core Types

by skipp-dev
1 stars

This Pine Script v6 library exports core data types, enums, and drawing wrappers designed for Smart Money Concepts tools. It defines structured arguments for drawing lines, labels, boxes, and chart points to simplify visual rendering on price charts for concep

Library v6 Repaints
Updated 3 days ago · None stated GitHub repository of SMC Core Types

MathConstantsUniversal

by ricardosantos79
261 stars

This Pine Script library provides exported functions for standard physical and universal mathematical constants. It exports high-precision numerical values including the speed of light, gravitational constant, Planck constant, magnetic permeability, and electr

Library v5
Updated 4 years ago · None stated GitHub repository of MathConstantsUniversal

AuthLib

by alboogycOdR
6 stars

AuthLib is a Pine Script utility library providing access control and state management structures for technical indicators. It checks callers against a hardcoded array of authorized TradingView usernames before executing operations. The library exports user-de

Library v5 SMC / ICT / price actionSessions & time
Updated 7 months ago · None stated GitHub repository of AuthLib
2 stars

This library plots order blocks directly on the price chart. It draws lines connecting distal and proximal points of demand order blocks with a middle 50 percent level line and colored zone fills between them. Breaker blocks appear when demand blocks are mitig

Library v5 Support & resistanceSMC / ICT / price action
Updated 2 months ago · None stated GitHub repository of OrderBlockDrawing_TradingFinder

MathExtension

by ricardosantos79
261 stars

MathExtension is a Pine Script v5 library of exported math helpers and does not plot or trade. It supplies base-2 log, floating-point remainder, fractional part, a digit-scaling integral helper, an atan2 approximation in radians, Euclidean hypotenuse, and a ne

Library v5
Updated 4 years ago · None stated GitHub repository of MathExtension

AuthLib

by alboogycOdR
6 stars

AuthLib is a Pine Script v5 library that checks a caller username against a fixed list and, when authorized, prepares drawings for six killzone sessions. It stores boxes, labels, trend lines and price labels in a DrawingData type. For each window it tracks the

Library v5 Sessions & timeSMC / ICT / price action
Updated 7 months ago · None stated GitHub repository of AuthLib
2 stars

This Pine Script v5 library provides a drawing function that renders overlapping supply and demand order blocks directly on the price chart. It calculates proximal, distal, and midpoint mitigation price boundaries when an origin trigger condition is met across

Library v5
Updated 2 months ago · None stated GitHub repository of OrderBlockOverlappingDrawing
1 stars

This Pine Script v6 library exports constant reference data and profiles for Smart Money Concepts (SMC) decision-support systems. It provides over 190 static export fields covering universe tickers, market regime status, macro bias, news heat maps, volatility

Library v6
Updated 3 days ago · None stated GitHub repository of SMC Micro Profiles Generated
261 stars

This Pine Script v5 library exports absolute risk statistics for a float sample. It calculates the standard deviation of positive observations, the standard deviation of negative observations, and downside deviation of values below a caller-supplied minimum ac

Library v5
Updated 4 years ago · None stated GitHub repository of MathFinancialAbsoluteRiskMeasures
2 stars

This Pine Script v5 library exports an order-block refiner for Smart Money Concepts charts. It takes an order-block type, refine flag, refine method, trigger condition and bar index, then measures candle range and body around that bar using a 55-period ATR. Fo

Library v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of OrderBlockRefiner TradingFinder

SMC Overlay Generated

by skipp-dev
1 stars

This library exports constants for SMC trading intelligence. It provides market regime status, global news heat scores, bullish and bearish ticker lists, earnings calendars, and per-ticker sentiment maps. These fields support overlay companions in other script

Library v6 SMC / ICT / price actionScreeners & dashboards
Updated 3 days ago · None stated GitHub repository of SMC Overlay Generated

MathGaussFunction

by ricardosantos79
261 stars

This mathematical utility library implements one-dimensional and two-dimensional Gaussian functions and kernel generators in Pine Script. It calculates standard Gaussian distribution values for single coordinates or coordinate pairs based on a specified sigma

Library v5
Updated 4 years ago · None stated GitHub repository of MathGaussFunction

MathGeometryCurvesChaikin

by ricardosantos79
261 stars

MathGeometryCurvesChaikin is a Pine Script library that implements Chaikin's corner-cutting algorithm to create smooth curved paths from given coordinate arrays. It provides exported functions to calculate single-step curve interpolations and multi-iteration s

Library v5
Updated 4 years ago · None stated GitHub repository of MathGeometryCurvesChaikin

MathOperator

by ricardosantos79
261 stars

This Pine Script v5 library exports named wrappers for basic arithmetic, comparison, and logical operators. It adds, subtracts, multiplies, divides, and returns the remainder of two floats, and tests equality, inequality, and greater or lesser relations, inclu

Library v5
Updated 4 years ago · None stated GitHub repository of MathOperator

MathSearchDijkstra

by ricardosantos79
261 stars

This library provides Dijkstra's algorithm to compute shortest path distances in a weighted graph. It represents the graph as an adjacency matrix and calculates minimum costs from a start vertex to all others using a greedy approach. The min_distance function

Library v5
Updated 4 years ago · None stated GitHub repository of MathSearchDijkstra

MathSpecialFunctionsGamma

by ricardosantos79
261 stars

MathSpecialFunctionsGamma is a Pine Script v5 utility library providing mathematical implementations of the Gamma function and its logarithm. It utilizes the Lanczos approximation to evaluate the natural logarithm of the Gamma function with high precision floa

Library v5
Updated 4 years ago · None stated GitHub repository of MathSpecialFunctionsGamma

MathSpecialFunctionsLogistic

by ricardosantos79
261 stars

MathSpecialFunctionsLogistic is a Pine Script library that provides mathematical helper functions for logistic calculations. It includes exported functions to compute the standard logistic function and the logit function, which serves as the inverse of the sig

Library v5
Updated 4 years ago · None stated GitHub repository of MathSpecialFunctionsLogistic
261 stars

This library provides implementations of standard mathematical test functions used for optimization algorithm evaluation. The Rosenbrock function creates a valley-shaped problem with a global minimum at (1,1), while its multi-dimensional version accepts array

Library v5
Updated 4 years ago · None stated GitHub repository of MathSpecialFunctionsTestFunctions

P_syn_library

by GammaExpansion
1 stars

P_syn_library is a Pine Script v6 library that exports two numeric helpers and a small user-defined type. The double function multiplies a float by two, and mid returns the average of two floats. Pair stores two float fields, and the sum method adds those fiel

Library v6
Updated 6 days ago · MIT GitHub repository of P_syn_library
261 stars

This library calculates non-parametric kernel density estimation for array observations in Pine Script v5. It generates probability density functions across customizable sample sizes, bandwidths, step counts, and kernel types including Gaussian, uniform, and E

Library v5
Updated 4 years ago · None stated GitHub repository of MathStatisticsKernelDensityEstimation

MathStatisticsKernelFunctions

by ricardosantos79
261 stars

MathStatisticsKernelFunctions is a Pine Script utility library providing statistical kernel weighting functions, including uniform, triangular, Epanechnikov, quartic, triweight, and tricubic kernels. Each function takes a distance relative to the kernel origin

Library v5
Updated 4 years ago · None stated GitHub repository of MathStatisticsKernelFunctions

MathTransformsHartley

by ricardosantos79
261 stars

MathTransformsHartley is a Pine Script v5 mathematical library that implements the Discrete Hartley Transform (DHT). It provides functions to calculate naive transforms, fast discrete Hartley transforms (FDHT), and inverse discrete Hartley transforms (IDHT) wi

Library v5
Updated 4 years ago · None stated GitHub repository of MathTransformsHartley

MathTrigonometry

by ricardosantos79
261 stars

This Pine Script v5 library exports trigonometric helpers and draws nothing on the chart. It provides a normalized sinc function plus cotangent, cosecant, and secant, with matching inverse functions arc cotangent, arc secant, and arc cosecant. Hyperbolic sine,

Library v5
Updated 4 years ago · None stated GitHub repository of MathTrigonometry

MLActivationFunctions

by ricardosantos79
261 stars

MLActivationFunctions is a Pine Script v5 library that provides standard activation functions and their derivatives for neural network models built directly in Pine Script. It exports mathematical functions including binary step, linear, sigmoid, hyperbolic ta

Library v5 AI / machine learning
Updated 4 years ago · None stated GitHub repository of MLActivationFunctions

MLLossFunctions

by ricardosantos79
261 stars

MLLossFunctions is a Pine Script v5 library that exports loss-function methods for machine learning calculations. It computes mean squared error as the average of squared differences between expected and predicted float arrays. It also computes binary cross-en

Library v5 AI / machine learning
Updated 4 years ago · None stated GitHub repository of MLLossFunctions

Probability

by ricardosantos79
261 stars

Probability is a Pine Script v5 library of functions for probability calculations. It multiplies two matrices stored as flat float arrays and raises a square matrix to a power, using helpers intended for Markov-chain state probabilities. It depends on imported

Library v5
Updated 4 years ago · None stated GitHub repository of Probability
261 stars

SeasonalDecompositionByMovingAverage is a Pine Script v5 library designed to compute seasonal decomposition elements from array data. Its exported function, seasonal_mean, calculates the mean value for each period within a specified seasonal frequency cycle. I

Library v5
Updated 4 years ago · None stated GitHub repository of SeasonalDecompositionByMovingAverage
261 stars

This Pine Script library provides algorithmic helper functions to perform K-Means clustering calculations. It includes utilities for computing Euclidean distance between two-dimensional coordinates, identifying nearest cluster centers, executing bisection sear

Library v5
Updated 4 years ago · None stated GitHub repository of SignalProcessingClusteringKMeans

StringEvaluation

by ricardosantos79
261 stars

This utility library evaluates mathematical expressions formatted as strings within Pine Script v5. It parses raw input strings, removes whitespace, extracts operators and numeric values, and handles operator precedence. The code includes support for transform

Library v5
Updated 4 years ago · None stated GitHub repository of StringEvaluation

Vector2Operations

by ricardosantos79
261 stars

Vector2Operations is a Pine Script v5 utility library that stores two-dimensional vectors as two-element float arrays and exposes helpers to read and write their components. It computes the fractional part of a number, an approximate atan2 angle in radians fro

Library v5
Updated 4 years ago · None stated GitHub repository of Vector2Operations

getSeries

by ivansoft
1 stars

A Pine Script v5 library whose functions build arrays of values that meet a condition. One function collects the latest values where a condition is true since a reset condition, optionally keeping only a set number of values, and another keeps values within a

Library v5
Updated 1 year ago · None stated GitHub repository of getSeries

lower_tf

by ivansoft
1 stars

A Pine Script v5 library for working with intrabar data from a lower timeframe. It chooses a lower timeframe for the chart based on a precision setting, either by how many chart bars should be covered or by the approximate number of intrabars per chart bar, be

Library v5
Updated 1 year ago · None stated GitHub repository of lower_tf

RiskMetrics

by ivansoft
1 stars

A Pine Script v5 library that tracks compounded monthly return percentages in an array, capped at a maximum number of periods, so that ratio calculations can be built on them. It has an overload for excess returns over a benchmark. Settings include the returns

Library v5
Updated 1 year ago · None stated GitHub repository of RiskMetrics

Strategy

by ivansoft
1 stars

A Pine Script v5 library of helper functions for strategy scripts. It converts a percentage of the average entry price into ticks, price levels or currency amounts, which helps when placing percentage-based stop loss and limit exits. Inputs set a percent stop

Library v5
Updated 1 year ago · None stated GitHub repository of Strategy

Strategy Helpers

by ivansoft
1 stars

A Pine Script v5 library of helper functions for strategy scripts. It converts a percentage of the entry price into ticks, a price level or a currency amount, converts between prices and ticks, and reports the profit of the open position as a percentage if it

Library v5
Updated 1 year ago · None stated GitHub repository of Strategy Helpers

Strings

by ivansoft
1 stars

A Pine Script v5 library of string helpers that add to the built-in string functions. It extracts the text to the left or right of the nth occurrence of a separator, with versions for simple and series strings. The file includes example code that shows the cod

Library v5
Updated 1 year ago · None stated GitHub repository of Strings

ta

by ivansoft
1 stars

Provides a collection of technical analysis calculation functions for use across Pine scripts. It exports implementations for various indicators and mathematical formulas, including oscillators like the Awesome Oscillator, Aroon, and Schaff Trend Cycle, moving

Library v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of ta

Time

by ivansoft
1 stars

A Pine Script v5 library of time helper functions. It formats a timestamp into time, date and weekday strings, and measures how many seconds a condition has stayed true, with an optional reset on each new bar. Settings in the demo code cover tick counts, hold

Library v5 Sessions & time Repaints
Updated 1 year ago · None stated GitHub repository of Time

VisibleChart

by ivansoft
1 stars

A Pine Script v5 library whose functions return values from the bars currently visible on the chart. It can test whether a bar is visible or is the first or last visible bar, and return the highest high, lowest low, their bar indexes and times, and the opening

Library v5
Updated 1 year ago · None stated GitHub repository of VisibleChart

ConditionalAverages

by ivansoft
1 stars

Pine library of functions that average values only when a condition is met. Functions cover a cumulative average when a condition is true, an average over the last chosen number of occurrences, an average over a chosen number of bars back, an average since a c

Library v5
Updated 1 year ago · None stated GitHub repository of ConditionalAverages

More Pine Script Categories

Browse the whole Pine Library

Third-party code. ForexR lists open-source Pine scripts from GitHub; it did not write, test or endorse them, and their summaries are generated automatically from each script's code and README. Indicators describe the past, and a strategy's backtest can look better than live trading. Check a script on a demo account before you rely on it. CFDs and leveraged forex are complex instruments with a high risk of losing money rapidly.

Learn to Use Pine Scripts

Free, plain-English guides: add a script to TradingView, read what it does, test it and avoid the common traps.

  1. 1Using this librarySearch, filters, licences and what the badges mean.
  2. 2Add a script to TradingViewCopy, paste into the Pine Editor, save and add to chart.
  3. 3Indicators, strategies and librariesWhat each type does and how to tell them apart.
  4. 4Spot a script that repaintsWhy some signals change after the bar closes.
  5. 5Backtest a strategyStrategy Tester settings that keep results honest.
  6. 6Send alerts to MT4 or MT5From a TradingView alert to an order in MetaTrader.
  7. 7What Pine Script isThe language, what it can and cannot do, and where to start.
  8. 8Write your first indicatorA complete script, line by line, in the Pine Editor.
  9. 9Read a script before you trust itA routine for checking inputs, logic and red flags.
  10. 10Edit a script safelyChange colours and lengths, add a filter or an alert.
  11. 11Pine Script alertsalertcondition(), alert(), placeholders and webhooks.
  12. 12Build a crossover strategyAn EMA cross strategy with an ATR stop, ready to test.

Trade Your Charts With a Regulated Broker

Compare regulated brokers on platforms, spreads, minimum deposit and leverage.

Compare brokers