Pine Library · 198 open-source scripts

Free Pine Script Libraries (page 3)

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

ColorScheme

by ricardosantos79
261 stars

ColorScheme is a Pine Script v5 library that stores named colors in paired string and color arrays. It creates an empty registry, checks that the key and color arrays stay the same length, and adds, reads, or renames entries by unique keys. Duplicate or missin

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

PositionSizing

by iamrichardD
57 stars

This Pine Script v6 library calculates trade position sizes and provides risk management functions for external scripts. It computes position sizes from account equity, percentage risk, and stop-loss distance, and offers dynamic sizing adjustments based on vol

Library v6
Updated 1 year ago · Apache-2.0 GitHub repository of PositionSizing

MathX

by heyphat
26 stars

MathX is a Pine Script v6 library that exports a z-score function. It measures how far a source series sits from its simple moving average, divided by the standard deviation over the same length. A private mean helper wraps the built-in simple moving average a

Library v6
Updated 2 months ago · AGPL-3.0 GitHub repository of MathX

TheStratGrammar

by 345-strategies
5 stars

This library calculates TheStrat price action states, classifying candles by directional break structure, close relative to open, and rejected break conditions. It draws demo bar labels directly on the price chart using standard or glyph notation. User inputs

Library v6 Repaints
Updated 3 days ago · MPL-2.0 GitHub repository of TheStratGrammar

LocalLimit

by Electrified-Trading
2 stars

LocalLimit is a Pine Script library designed to calculate local upper and local lower limits for price or indicator series. By tracking local price extrema through multi-phase state logic, it helps scripts construct dynamic support and resistance boundaries. T

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of LocalLimit

SMC Engine Private

by skipp-dev
1 stars

This Pine Script v6 library serves as an internal engine for Smart Money Concepts (SMC), providing types, tracking, and rendering logic for order blocks, fair value gaps, and market structure. It calculates order block parameters including quality scores, heig

Library v6 SMC / ICT / price actionSupport & resistance
Updated 3 days ago · None stated GitHub repository of SMC Engine Private

CorrelationExtendsStatistics

by ricardosantos79
261 stars

This Pine Script v5 library exposes numerical helpers for correlation and special-function work and draws nothing on a chart. It returns machine-dependent floating-point constants, truncates a Chebyshev coefficient array to a requested accuracy, and evaluates

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

PriceAction

by alvinng214
2 stars

PriceAction is a Pine Script v6 library designed to calculate and track market structure elements based on customizable pivot lengths. It exports custom data structures for pivots, structure breaks, and market trends, categorizing price movement into internal

Library v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of PriceAction

Momentum

by Electrified-Trading
2 stars

This Pine Script library calculates various momentum metrics and oscillator values for other scripts to use. It provides functions for standard-deviation-normalized price change, dual-moving-average momentum, Stochastic RSI, and a customizable MACD. Function p

Library v5 Oscillators & momentumMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum

ValueAtTime

by ivansoft
1 stars

A Pine Script v6 library that stores timestamped values and retrieves the value at a past point in time, such as one week, one month or year-to-date ago. It defines a data type with parallel time and value arrays, helper functions that limit array size to the

Library v6 Repaints
Updated 1 year ago · None stated GitHub repository of ValueAtTime

DebugConsole

by ricardosantos79
261 stars

DebugConsole is a Pine Script v5 library that stores debug text in a fixed-length string array and shows it in a single chart table cell. init creates a bottom-left table and an empty line buffer whose size defaults to 20. queue drops the oldest line and appen

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

MyLabUtils

by mitchell-917
4 stars

MyLabUtils is an open-source utility library for Pine Script v5 that provides reusable functions for custom indicator and strategy development. It includes an example calculation for a normalized Relative Strength Index, which scales standard values relative t

Library v5
Updated 11 months ago · Custom licence GitHub repository of MyLabUtils

ta

by alvinng214
2 stars

This Pine Script library exports multiple technical analysis functions for use in TradingView indicators and strategies. It includes helper functions for moving averages such as dema, ema2, t3, tema, and rma2, oscillators like macd2, stochFull, stochRsi, and p

Library v6
Updated 2 months ago · None stated GitHub repository of ta

MomentumSignals

by Electrified-Trading
2 stars

MomentumSignals is a Pine Script utility library designed to detect changes in momentum across technical series such as moving averages and oscillator histograms. It offers helper functions that quantize directional changes, detect reversal signals, and comput

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of MomentumSignals

PivotPointsDailyTraditional

by Electrified-Trading
2 stars

PivotPointsDailyTraditional is a Pine Script library that provides calculation functions for standard daily pivot points. It imports daily high, low, and close values to compute the main pivot point along with multiple resistance and support levels. The librar

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of PivotPointsDailyTraditional

Points

by Electrified-Trading
2 stars

Points is a Pine Script v5 library that stores paired x and y coordinates as two synchronized arrays. It creates empty or sized integer and float arrays, checks that both arrays share the same length, and raises a runtime error when they diverge or when an ind

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of Points

A Pine Script library providing helper functions to evaluate local trend conditions across a user-defined lookback period. It exports functions that check if the current candle's low price is strictly higher or lower than all preceding lows within the specifie

Library v5
Updated 2 years ago · None stated GitHub repository of Uptrend Downtrend Loopback Candle Identification Lib

SessionInfo

by Electrified-Trading
2 stars

SessionInfo is a Pine Script utility library providing functions for session-specific state tracking and calculations. It exports routines to determine whether the current intraday bar falls within a specified session, before the session begins, or after it co

Library v5 Sessions & time
Updated 1 year ago · MPL-2.0 GitHub repository of SessionInfo

SMC Lifecycle Private

by skipp-dev
1 stars

SMC Lifecycle Private is a Pine Script library that provides modular helper functions to manage setup lifecycle states and market environment gating for Smart Money Concepts calculations. It evaluates market regime, volatility, and event risk conditions, compu

Library v6
Updated 3 days ago · None stated GitHub repository of SMC Lifecycle Private

Signal Processing

by Electrified-Trading
2 stars

This library supplies utility functions for handling signal values in Pine Script. The quantize function selects one of four results depending on whether the input value is positive, negative, zero or NaN. The negMult function multiplies the value by a given m

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of Signal Processing

Support Resistance and Trend

by Electrified-Trading
2 stars

This Pine Script utility library provides exported helper functions and data structures for calculating market trend directions and key support and resistance boundaries. It includes a custom SuperTrend function with configurable bar confirmation requirements

Library v5
Updated 1 year ago · MPL-2.0 GitHub repository of Support Resistance and Trend

MirPapa Lib Box

by alvinng214
2 stars

This Pine Script v6 library defines shared types and price checks for smart-money boxes. It stores box type, bullish or bearish direction, start and end breach modes, state, and top, bottom, and midpoint prices, plus a box and line handle. A higher-timeframe c

Library v6
Updated 2 months ago · None stated GitHub repository of MirPapa Lib Box

Mirpapa Lib Line

by alvinng214
2 stars

This library creates and tracks horizontal lines on the chart. It supports two breach modes: price and close. When a line is breached, it increments a break count up to a maximum value and can finalize the line with a close color. The data structure holds line

Library v6 Support & resistanceSMC / ICT / price action
Updated 2 months ago · None stated GitHub repository of Mirpapa Lib Line

Mirpapa Lib Struct

by alvinng214
2 stars

This Pine Script v6 library provides custom exported data types and initialization functions for tracking Smart Money Concepts and ICT market structure shifts. It defines structures to manage states for Break of Structure, Change of Character, Market Structure

Library v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of Mirpapa Lib Struct
1 stars

This Pine Script library provides reusable helper functions for composing and formatting Smart Money Concepts (SMC) debug text strings and observability data. It builds structured labels and diagnostic lines containing setup sources, zone quality metrics, touc

Library v6 SMC / ICT / price action
Updated 3 days ago · None stated GitHub repository of SMC Observability Private

Mirpapa Lib SumBox

by alvinng214
2 stars

This library provides data structures and validation functions for bundled candle analysis in ICT trading scripts. It defines SumCandleStates type with pending, confirmed and completed values, plus a function to create instances of the state set. SumCandleData

Library v6 SMC / ICT / price action
Updated 2 months ago · None stated GitHub repository of Mirpapa Lib SumBox

MirPapa Library ICT

by alvinng214
2 stars

MirPapa Library ICT is a Pine Script utility library designed to support Inner Circle Trader (ICT) analysis across trading scripts. It exports custom data structures, including BoxData and HTFCache, to manage higher-timeframe historical price data and track zo

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

SMC Profile Engine

by skipp-dev
1 stars

SMC Profile Engine is a Pine Script library designed to build custom volume profiles on TradingView. It provides structured data types including Bucket, ProfileConfig, and Profile to manage volume calculations across price levels. The library facilitates track

Library v6 VolumeSupport & resistance Repaints
Updated 3 days ago · None stated GitHub repository of SMC Profile Engine

Mirpapa_Lib_Structs

by alvinng214
2 stars

Mirpapa_Lib_Structs is a Pine Script library designed to assist in detecting Smart Money Concepts (ICT) market structure shifts. It provides exported custom types and helper functions to manage trend state, track swing highs and swing lows, and verify structur

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

ZenLibrary

by Web3Degenerate
2 stars

ZenLibrary is a custom Pine Script utility library providing standard helper functions for trading scripts. It includes calculations for quote currency decimal precision, market pip sizes, decimal truncation, pip conversions, percentage change over lookback pe

Library v5
Updated 2 years ago · None stated GitHub repository of ZenLibrary

Mirpapa_Lib_Unicorn

by alvinng214
2 stars

The Mirpapa_Lib_Unicorn library defines data structures and logic for the Unicorn pattern within smart money concepts trading. It creates UnicornData types that track order blocks, fair value gaps, their overlaps into Unicorn zones, CHoCH confirmations, retest

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

FunctionArrayMovingAverage

by ricardosantos79
261 stars

This Pine Script v5 library provides an exported function to calculate moving averages directly over float arrays. Users can supply a sample array, set the smoothing length, choose whether to omit initial values prior to reaching the lookback window, and speci

Library v5 Moving averages
Updated 4 years ago · None stated GitHub repository of FunctionArrayMovingAverage

FunctionBestFitFrequency

by ricardosantos79
261 stars

FunctionBestFitFrequency is a Pine Script v5 library that smooths a float array with a rolling average and searches a frequency range for the moving-average length whose residual signs are closest to evenly split. The array function can omit early values short

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

FunctionDatestring

by ricardosantos79
261 stars

This Pine Script v5 library turns a Unix timestamp into zero-padded text for date, time, or both. It exports datetime, date_, and time_, each defaulting to the current time, and prefixes single-digit months, days, hours, minutes, and seconds with a leading zer

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

SMC Utils

by skipp-dev
1 stars

SMC Utils is a Pine Script library providing helper functions for Smart Money Concepts indicators and strategies. It features functions for value range checks, range overlap determination, lower-timeframe selection, formatting price levels and trend states, dy

Library v6
Updated 3 days ago · None stated GitHub repository of SMC Utils

FunctionLinearRegression

by ricardosantos79
261 stars

This Pine Script v5 library provides functions to calculate and plot linear regression channels using sample point arrays. It evaluates paired X and Y arrays to calculate the regression slope, intercept, fitted values, maximum deviation, minimum deviation, and

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

This Pine Script library provides a standardized function to format and send custom trade alerts. It processes incoming parameters such as trade direction, setup types, chart timeframe, and price levels including entry, take profit, and stop loss. The library

Library v5
Updated 2 months ago · None stated GitHub repository of AlertSenderLibrary TradingFinder

FunctionLinearRegression

by ricardosantos79
261 stars

This library exports a linreg method that fits a straight line through paired sample arrays. It returns fitted Y values plus the largest positive deviation, the largest negative deviation, and the average absolute deviation. Callers pass matching X and Y array

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

smc_core_types

by skipp-dev
1 stars

This Pine Script library provides core enumeration types used across the SMC script ecosystem. It exports standardized definitions for moving average options including SMA, EMA, RMA, WMA, VWMA, Hull, and Zero Lag variations. Additionally, it defines break mode

Library v6
Updated 3 days ago · None stated GitHub repository of smc_core_types

FunctionNNetwork

by ricardosantos79
261 stars

This Pine Script v5 library exposes methods for a generalized neural network. It builds random weight arrays, runs a forward pass through stacked layers using an imported layer function, and begins a backward pass that compares output nodes with targets. Calle

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

FunctionNNLayer

by ricardosantos79
261 stars

FunctionNNLayer is a Pine Script v5 library providing a generalized neural network layer computation. It accepts an input array, a weight matrix flattened into an array, the target number of nodes, a bias value, and an activation function name. It computes per

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

This Pine Script v5 library exports SwitchingColorMode, which takes a color and a mode string and returns a theme-adjusted color. It reads red, green, blue, and transparency, classifies brightness into coarse channel buckets, and labels the color as hard dark,

Library v5
Updated 2 months ago · None stated GitHub repository of Dark Light Theme TradingFinder Switching Colors Library

FunctionNNPerceptron

by ricardosantos79
261 stars

This library exports a generalized perceptron node for neural networks. The function takes float arrays of inputs and weights, adds a bias, and applies a named activation function to the weighted sum. Bias defaults to 1.0 and the activation defaults to sigmoid

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

FVGDetectorLibrary

by alvinng214
2 stars

This Pine Script library detects and plots Smart Money Concept Fair Value Gaps (FVGs) for both demand and supply zones directly on the price chart. It exports a detection function that accepts configurable filter thresholds ranging from standard three-bar imba

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

HarmonicPattern

by ricardosantos79
261 stars

This Pine Script library provides helper functions to detect and validate harmonic patterns using price and time ratio calculations. It includes utilities to calculate price and time rates between consecutive pattern points, check if values fall within specifi

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

MathComplexArray

by ricardosantos79
261 stars

MathComplexArray is a Pine Script v5 utility library that provides array functions for managing complex numbers. It represents complex arrays as flat float arrays storing interleaved real and imaginary components. The library includes functions to instantiate

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

MathComplexCore

by ricardosantos79
261 stars

This library provides core functions to handle complex numbers in Pine Script v5. Complex numbers are represented as float arrays containing real and imaginary parts. Functions set the real or imaginary component of a number, create new complex numbers from gi

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

MathComplexEvaluate

by ricardosantos79
261 stars

MathComplexEvaluate is a Pine Script v5 utility library designed to evaluate string-based mathematical expressions containing complex numbers. It parses tokens into reverse Polish notation using external helper libraries and computes arithmetic operations such

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

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