1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new library, select all of the template text and paste. Press Save and give it a name.
4Publish or import itA library draws nothing. Publish it from the editor, then import its functions in your own scripts.
Source Code
263 lines of Pine Script v5 from edu_lib/time.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Time 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 duration in seconds, line offsets and the text size and corner of an on-chart table. Timing uses the real-time clock, so results on live bars differ from history.
Formatted time, date and weekday strings
Seconds-since-condition timer with reset option
Offset and unit settings for time-based lines
Real-time clock use, so live bars behave differently
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Number Of Ticks From Open
int
0
ticksInput
Seconds condition must last
int
20
secondsInput
Reset timing on new bar
bool
true
resetInput
Lines End At Offset n (+/-)
int
20
nInput
Offset Units
string
TU1
unitsInput
Calculated from
string
OF1
fromInput
Use Input Time
bool
false
useTimeInput
Unit of Time
string
seconds
timeInput
Timeframe Multiplier
float
1.0
tfMultInput
Text size
string
large
textSizeInput
Position
string
bottom
tableYposInput
tableXposInput
string
right
tableXposInput
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
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
This library calculates arrays of daily price deviations from the open to the high, low, and close over a user-specified number of days. It optionally filters outliers using a maximum deviation threshold. The fromOpen function returns a normalized value showin
The SFA FlowLiquidity library computes structural flow and liquidity events from price data. It detects sweep ups and downs with associated scores, identifies liquidity levels, and applies session and regime filters. Persistent arrays track liquidity prices, b
AIActivationFunctionsBipolarSigmoid is a Pine Script library that provides mathematical implementations of the bipolar sigmoid activation function and its derivatives for machine learning algorithms. It calculates bipolar sigmoid values bounded between -1 and
KernelFunctions is a Pine Script v5 library that exports kernel weight functions for Nadaraya-Watson style estimation. It calculates a Rational Quadratic kernel, a Gaussian kernel based on a radial basis function, and a periodic kernel that models repeating be
This Pine Script v5 library exports thin wrappers around built-in technical analysis functions. It covers moving averages, momentum measures such as RSI and CCI, volatility tools including ATR and standard deviation, range extremes, cross detection, and runnin