OHLC_DayLibrary "OHLC_Day"
TODO: add library description here
openD(x)
Parameters:
x (int)
highD(x)
Parameters:
x (int)
lowD(x)
Parameters:
x (int)
closeD(x)
Parameters:
x (int)
Indicators and strategies
calculate_quantityLibrary "calculate_quantity"
calcualate quantity for each kind of a chart
calculate_position(entry_level, lowest_low, rr)
Parameters:
entry_level (float)
lowest_low (float)
rr (int)
PivotLibrary222Library "PivotLibrary222"
f_determinePivotStrength(_pivotCandidateRelativeIndex, _type, _maxStrength)
Determines the strength of a pivot (low or high).
Parameters:
_pivotCandidateRelativeIndex (int) : The relative bar index of the pivot candidate.
_type (string) : "low" for a pivot low, "high" for a pivot high.
_maxStrength (int) : The maximum number of bars to check on either side for strength.
Returns: An array containing .
f_getPlotColorForStrength(_strength)
Gets a plotting color based on pivot strength.
Parameters:
_strength (int) : The calculated pivot strength.
Returns: A color for plotting.
f_updateExistingPivotLow(f_pivotLows, f_pivotLowInfoIndex, f_newStrength, f_showLabels)
Updates an existing pivot LOW's strength and its corresponding chart label.
Parameters:
f_pivotLows (array) : The array of pivotLowInfo objects.
f_pivotLowInfoIndex (int) : The index of the pivot to update in the array.
f_newStrength (int) : The new (increased) strength of the pivot.
f_showLabels (bool) : A boolean to control if labels should be updated.
f_updateExistingPivotHigh(f_pivotHighs, f_pivotHighInfoIndex, f_newStrength, f_showLabels)
Updates an existing pivot HIGH's strength and its corresponding chart label.
Parameters:
f_pivotHighs (array) : The array of pivotHighInfo objects.
f_pivotHighInfoIndex (int) : The index of the pivot to update in the array.
f_newStrength (int) : The new (increased) strength of the pivot.
f_showLabels (bool) : A boolean to control if labels should be updated.
f_findPivotLows(f_pivotLows, f_minStrength, f_maxStrength, f_showLabels)
Finds and processes pivot lows.
Parameters:
f_pivotLows (array) : The array of pivotLowInfo objects to read from and modify.
f_minStrength (int) : Minimum strength required for a new pivot to be recorded.
f_maxStrength (int) : Maximum strength to search for when determining pivot strength.
f_showLabels (bool) : A boolean to control if new labels should be created.
f_findPivotHighs(f_pivotHighs, f_minStrength, f_maxStrength, f_showLabels)
Finds and processes pivot highs.
Parameters:
f_pivotHighs (array) : The array of pivotHighInfo objects to read from and modify.
f_minStrength (int) : Minimum strength required for a new pivot to be recorded.
f_maxStrength (int) : Maximum strength to search for when determining pivot strength.
f_showLabels (bool) : A boolean to control if new labels should be created.
pivotHighInfo
Represents a detected pivot high.
Fields:
abs_index (series int)
price (series float)
strength (series int)
label_id (series label)
pivotLowInfo
Represents a detected pivot low.
Fields:
abs_index (series int)
price (series float)
strength (series int)
label_id (series label)
myLMAsLibrary "myLMAs"
SMA(sourceData, maxLength)
Dynamic SMA
Parameters:
sourceData (float)
maxLength (int)
EMA(src, length)
Dynamic EMA
Parameters:
src (float)
length (int)
DEMA(src, length)
Dynamic DEMA
Parameters:
src (float)
length (int)
TEMA(src, length)
Dynamic TEMA
Parameters:
src (float)
length (int)
WMA(src, length)
Dynamic WMA
Parameters:
src (float)
length (int)
HMA(src, length)
Dynamic HMA
Parameters:
src (float)
length (int)
VWMA(src, volsrc, length)
Dynamic VWMA
Parameters:
src (float)
volsrc (float)
length (int)
SMMA(src, length)
Dynamic SMMA
Parameters:
src (float)
length (int)
LSMA(src, length, offset)
Dynamic LSMA
Parameters:
src (float)
length (int)
offset (int)
RMA(src, length)
Dynamic RMA
Parameters:
src (float)
length (int)
ALMA(src, length, offset_sigma, sigma)
Dynamic ALMA
Parameters:
src (float)
length (int)
offset_sigma (float)
sigma (float)
ZLSMA(src, length)
Dynamic ZLSMA
Parameters:
src (float)
length (int)
FRAMA(src, length)
Parameters:
src (float)
length (int)
KAMA(src, length)
Dynamic KAMA
Parameters:
src (float)
length (int)
JMA(src, length, phase)
Dynamic JMA
Parameters:
src (float)
length (int)
phase (float)
T3(src, length, volumeFactor)
Dynamic T3
Parameters:
src (float)
length (int)
volumeFactor (float)
TimezoneFormatIANAUTCLibrary "TimezoneFormatIANAUTC"
Provides either the full IANA timezone identifier or the corresponding UTC offset for TradingView’s built-in variables and functions.
tz(_tzname, _format)
Parameters:
_tzname (string) : "London", "New York", "Istanbul", "+1:00", "-03:00" etc.
_format (string) : "IANA" or "UTC"
Returns: "Europe/London", "America/New York", "UTC+1:00"
Example Code
import ARrowofTime/TimezoneFormatIANAUTC/1 as libtz
sesTZInput = input.string(defval = "Singapore", title = "Timezone")
example1 = libtz.tz("London", "IANA") // Return Europe/London
example2 = libtz.tz("London", "UTC") // Return UTC+1:00
example3 = libtz.tz("UTC+5", "IANA") // Return UTC+5:00
example4 = libtz.tz("UTC+4:30", "UTC") // Return UTC+4:30
example5 = libtz.tz(sesTZInput, "IANA") // Return Asia/Singapore
example6 = libtz.tz(sesTZInput, "UTC") // Return UTC+8:00
sesTime1 = time("","1300-1700", example1) // returns the UNIX time of the current bar in session time or na
sesTime2 = time("","1300-1700", example2) // returns the UNIX time of the current bar in session time or na
sesTime3 = time("","1300-1700", example3) // returns the UNIX time of the current bar in session time or na
sesTime4 = time("","1300-1700", example4) // returns the UNIX time of the current bar in session time or na
sesTime5 = time("","1300-1700", example5) // returns the UNIX time of the current bar in session time or na
sesTime6 = time("","1300-1700", example6) // returns the UNIX time of the current bar in session time or na
Parameter Format Guide
This section explains how to properly format the parameters for the tz(_tzname, _format) function.
_tzname (string) must be either;
A valid timezone name exactly as it appears in the chart’s lower-right corner (e.g. New York, London).
A valid UTC offset in ±H:MM or ±HH:MM format. Hours: 0–14 (zero-padded or not, e.g. +1:30, +01:30, -0:00). Minutes: Must be 00, 15, 30, or 45
examples;
"New York" → ✅ Valid chart label
"London" → ✅ Valid chart label
"Berlin" → ✅ Valid chart label
"America/New York" → ❌ Invalid chart label. (Use "New York" instead)
"+1:30" → ✅ Valid offset with single-digit hour
"+01:30" → ✅ Valid offset with zero-padded hour
"-05:00" → ✅ Valid negative offset
"-0:00" → ✅ Valid zero offset
"+1:1" → ❌ Invalid (minute must be 00, 15, 30, or 45)
"+2:50" → ❌ Invalid (minute must be 00, 15, 30, or 45)
"+15:00" → ❌ Invalid (hour must be 14 or below)
_tztype (string) must be either;
"IANA" → returns full IANA timezone identifier (e.g. "Europe/London"). When a time function call uses an IANA time zone identifier for its timezone argument, its calculations adjust automatically for historical and future changes to the specified region’s observed time, such as daylight saving time (DST) and updates to time zone boundaries, instead of using a fixed offset from UTC.
"UTC" → returns UTC offset string (e.g. "UTC+01:00")
DoublePatternsDetects Double Top and Double Bottom patterns from pivot points using structural symmetry, valley/peak depth, and extreme validation. Returns a detailed result object including similarity score, target price, and breakout quality.
WedgePatternsDetects Rising and Falling Wedge chart patterns using pivot points, trendline convergence, and volume confirmation. Includes adaptive wedge length analysis and a quality score for each match. Returns full wedge geometry and classification via WedgeResult.
HeadShouldersPatternsDetects Head & Shoulders and Inverse Head & Shoulders chart patterns from pivot point arrays. Includes neckline validation, shoulder symmetry checks, and head extremeness filtering. Returns a detailed result object with structure points, bar indices, and projected price target.
XABCD_HarmonicsLibrary for detecting harmonic patterns using ZigZag pivots or custom swing points. Supports Butterfly, Gartley, Bat, and Crab patterns with automatic Fibonacci ratio validation and optional D-point projection using extremes. Returns detailed PatternResult including structure points and target projection. Ideal for technical analysis, algorithmic detection, or overlay visualizations.
TextLibrary "Text"
library to format text in different fonts or cases plus a sort function.
🔸 Credits and Usage
This library is inspired by the work of three authors (in chronological order of publication date):
Unicode font function - JD - Duyck
UnicodeReplacementFunction - wlhm
font - kaigouthro
🔹 Fonts
Besides extra added font options, the toFont(fromText, font) method uses a different technique. On the first runtime bar (whether it is barstate.isfirst , barstate.islast , or between) regular letters and numbers and mapped with the chosen font. After this, each character is replaced using the build-in key - value pair map function .
Also an enum Efont is included.
Note: Some fonts are not complete, for example there isn't a replacement for every character in Superscript/Subscript.
Example of usage (besides the included table example):
import fikira/Text/1 as t
i_font = input.enum(t.Efont.Blocks)
if barstate.islast
sentence = "this sentence contains words"
label.new(bar_index, 0, t.toFont(fromText = sentence, font = str.tostring(i_font)), style=label.style_label_lower_right)
label.new(bar_index, 0, t.toFont(fromText = sentence, font = "Circled" ), style=label.style_label_lower_left )
label.new(bar_index, 0, t.toFont(fromText = sentence, font = "Wiggly" ), style=label.style_label_upper_right)
label.new(bar_index, 0, t.toFont(fromText = sentence, font = "Upside Latin" ), style=label.style_label_upper_left )
🔹 Cases
The script includes a toCase(fromText, case) method to transform text into snake_case, UPPER SNAKE_CASE, kebab-case, camelCase or PascalCase, as well as an enum Ecase .
Example of usage (besides the included table example):
import fikira/Text/1 as t
i_case = input.enum(t.Ecase.camel)
if barstate.islast
sentence = "this sentence contains words"
label.new(bar_index, 0, t.toCase(fromText = sentence, case = str.tostring(i_case)), style=label.style_label_lower_right)
label.new(bar_index, 0, t.toCase(fromText = sentence, case = "snake_case" ), style=label.style_label_lower_left )
label.new(bar_index, 0, t.toCase(fromText = sentence, case = "PascalCase" ), style=label.style_label_upper_right)
label.new(bar_index, 0, t.toCase(fromText = sentence, case = "SNAKE_CASE" ), style=label.style_label_upper_left )
🔹 Sort
The sort(strings, order, sortByUnicodeDecimalNumbers) method returns a sorted array of strings.
strings: array of strings, for example words = array.from("Aword", "beyond", "Space", "salt", "pepper", "swing", "someThing", "otherThing", "12345", "_firstWord")
order: "asc" / "desc" (ascending / descending)
sortByUnicodeDecimalNumbers: true/false; default = false
_____
• sortByUnicodeDecimalNumbers: every Unicode character is linked to a Unicode Decimal number ( wikipedia.org/wiki/List_of_Unicode_characters ), for example:
1 49
2 50
3 51
...
A 65
B 66
...
S 83
...
_ 95
` 96
a 97
b 98
...
o 111
p 112
q 113
r 114
s 115
...
This means, if we sort without adjusting ( sortByUnicodeDecimalNumbers = true ), in ascending order, the letter b (98 - small) would be after S (83 - Capital).
By disabling sortByUnicodeDecimalNumbers , Capital letters are intermediate transformed to str.lower() after which the Unicode Decimal number is retrieved from the small number instead of the capital number. For example S (83) -> s (115), after which the number 115 is used to sort instead of 83.
Example of usage (besides the included table example):
import fikira/Text/1 as t
if barstate.islast
aWords = array.from("Aword", "beyond", "Space", "salt", "pepper", "swing", "someThing", "otherThing", "12345", "_firstWord")
label.new(bar_index, 0, str.tostring(t.sort(strings= aWords, order = 'asc' , sortByUnicodeDecimalNumbers = false)), style=label.style_label_lower_right)
label.new(bar_index, 0, str.tostring(t.sort(strings= aWords, order = 'desc', sortByUnicodeDecimalNumbers = false)), style=label.style_label_lower_left )
label.new(bar_index, 0, str.tostring(t.sort(strings= aWords, order = 'asc' , sortByUnicodeDecimalNumbers = true )), style=label.style_label_upper_right)
label.new(bar_index, 0, str.tostring(t.sort(strings= aWords, order = 'desc', sortByUnicodeDecimalNumbers = true )), style=label.style_label_upper_left )
🔸 Methods/functions
method toFont(fromText, font)
toFont : Transforms text into the selected font
Namespace types: series string, simple string, input string, const string
Parameters:
fromText (string)
font (string)
Returns: `fromText` transformed to desired `font`
method toCase(fromText, case)
toCase : formats text to snake_case, UPPER SNAKE_CASE, kebab-case, camelCase or PascalCase
Namespace types: series string, simple string, input string, const string
Parameters:
fromText (string)
case (string)
Returns: `fromText` formatted to desired `case`
method sort(strings, order, sortByUnicodeDecimalNumbers)
sort : sorts an array of strings, ascending/descending and by Unicode Decimal numbers or not.
Namespace types: array
Parameters:
strings (array)
order (string)
sortByUnicodeDecimalNumbers (bool)
Returns: Sorted array of strings
MarketCapLibrary2Library "MarketCapLibrary2"
setMarketCapMap(m)
Parameters:
m (map)
getMarketCap(ticker)
Parameters:
ticker (string)
MarketCapLibrary1Library "MarketCapLibrary1"
setMarketCapMap(m)
Parameters:
m (map)
getMarketCap(ticker)
Parameters:
ticker (string)
AnnualizedReturnCalculatorLibrary "AnnualizedReturnCalculator"
TODO: add library description here
calculateAnnualizedReturn(isStartTime, enableLog)
Parameters:
isStartTime (bool) : 开始时间的BOOL值变量(用于标记策略开始时间)
enableLog (bool) : 是否输出日志
Returns:
返回持仓基准年化收益率、资金基准年化收益率、总收益、平均资金占用
PineVersatilitiesBundleEnhanced the dynamic_MA function by adding five more MA types to the eight existing types.
Added neo_heikin_ashi_ohlc function for Customised or Standard Heikin-Ashi OHLC values tuple.
Library "PineVersatilitiesBundle"
Versatilities (aka, Versatile Utilities) Pack includes:
- Price Variants bundled in a Map,
- Smoothing Variants bundled in a Map,
- Standard and customised Heikin-Ashi values in a tuple,
- Visualisations that plot some indications in the pane and others, including candles/bars, on the chart.
price_variants(lb, hop, op, cl, fmean, hi, lo, mid, pvt, cmean)
Computes Several different averages using current and previous OHLC values
Parameters:
lb (int) : lookback distance for combining OHLC values from the past; optional input, default is 1
hop (int) : skip bars while looking back; optional input, default is 0
op (float) : open value; optional input, default is open
cl (float) : close value; optional input, default is close
fmean (float) : bar average; optional input, default is ohlc4
hi (float) : high value; optional input, default is high
lo (float) : low value; optional input, default is low
mid (float) : range middle; optional input, default is hl2
pvt (float) : active pivot; optional input, default is hlc3
cmean (float) : active average; optional input, default is hlcc4
Returns: Map of, rounded-to-mintick, combinations of single and two-bar OHLC averages
dynamic_MA(masrc, malen, almasgm, almaoff, almaflr, lsmaoff, volfctr)
Dynamically computes Eight different MAs and returns a Map containing Nine MAs
Parameters:
masrc (float) : source series to compute MA
malen (simple int) : lookback distance for MA
almasgm (simple float) : ALMA sigma; optional input, default is 5
almaoff (simple float) : ALMA offset; optional input, default is 0.5
almaflr (simple bool) : ALMA floor flag; optional input, default is false
lsmaoff (simple int) : LSMA offset; optional input, default is 0
volfctr (simple float) : T3/Tilson MA volume factor; optional input, default is 0.5
Returns: Map of, rounded-to-mintick, MAs - 'ALMA', 'DEMA', 'EMA', 'FRAMA', 'HMA', 'LSMA', 'RMA',
'SMA', 'SWMA', 'T3MA', 'TEMA', 'TRIMA', 'WMA', plus an 'ALL' for the average of all other MAs
neo_heikin_ashi_ohlc(customised, standard, op, cl, avbar, hi, lo, avrng, pivot, pvtcl)
Computes customised or standard Heikin Ashi candles/bars OHLC values
Parameters:
customised (bool) : toggle for computing customised Heikin Ashi OHLC; optional input, default is true; ignores standard setting
standard (bool) : toggle for computing standard Heikin Ashi OHLC; optional input, default is false
op (float) : open value; optional input, default is open
cl (float) : close value; optional input, default is close
avbar (float) : bar average; optional input, default is ohlc4
hi (float) : high value; optional input, default is high
lo (float) : low value; optional input, default is low
avrng (float) : range middle; optional input, default is hl2
pivot (float) : active pivot; optional input, default is hlc3
pvtcl (float) : active average; optional input, default is hlcc4
Returns: Tuple of, rounded-to-mintick, Customised or Standard Heikin-Ashi OHLC and its common averages
LiliALHUNTERSystem_v2📚 **Library: LiliALHUNTERSystem_v2**
This library provides a powerful target management system for Pine Script developers.
It includes advanced calculators for EMA, RMA, and Supertrend, and introduces a central `createTargets()` function to dynamically render target lines and labels based on long/short trade logic.
🛠️ **Main Features:**
– Dynamic horizontal & vertical target lines
– Dual target configuration (Target 1 & Target 2)
– Directional logic via `isLong1`, `isLong2`
– Integrated Supertrend validation
– Visual dashboard and label display
– Works seamlessly with custom indicators
🎯 **Purpose:**
The `LiliALHUNTERSystem_v2` Library enables Pine coders to manage and visualize targets consistently across all trading strategies and indicators. It simplifies target logic while maintaining visual clarity and modular usage.
⚠️ **Disclaimer:**
This script is intended for educational and analytical purposes only. It does not constitute financial advice.
Library "LiliALHUNTERSystem_v2"
ema_calc(len, source)
Parameters:
len (simple int)
source (float)
rma_calc(len, source)
Parameters:
len (simple int)
source (float)
supertrend_calc(length, factor)
Parameters:
length (simple int)
factor (float)
createTargets(config, state, source1A, source1B, source2A, source2B)
Parameters:
config (TargetConfig)
state (TargetState)
source1A (float)
source1B (float)
source2A (float)
source2B (float)
showDashboard(state, dashLoc, textSize)
Parameters:
state (TargetState)
dashLoc (string)
textSize (string)
TargetConfig
Fields:
enableTarget1 (series bool)
enableTarget2 (series bool)
isLong1 (series bool)
isLong2 (series bool)
target1Condition (series string)
target2Condition (series string)
target1Color (series color)
target2Color (series color)
target1Style (series string)
target2Style (series string)
distTarget1 (series float)
distTarget2 (series float)
distOptions1 (series string)
distOptions2 (series string)
showLabels (series bool)
showDash (series bool)
TargetState
Fields:
target1LineV (series line)
target1LineH (series line)
target2LineV (series line)
target2LineH (series line)
target1Lbl (series label)
target2Lbl (series label)
target1Active (series bool)
target2Active (series bool)
target1Value (series float)
target2Value (series float)
countTargets1 (series int)
countTgReached1 (series int)
countTargets2 (series int)
countTgReached2 (series int)
MyLibrary神启MT牛熊指数指标 ### Bull and Bear Wave Trend Indicator:
#### Indicator Interpretation
- **Green Fast Line (WT1) and Red Slow Line (WT2)**:
- When the green line crosses the red line from bottom to top, it is usually regarded as a bullish signal, especially when it occurs in the oversold zone (below -50), the signal strength is higher.
- When the green line crosses the red line from top to bottom, it is usually regarded as a bearish signal, especially when it occurs in the overbought zone (above +50), the signal strength is higher.
- **Overbought/Oversold Zones**:
- When both lines enter **above the red dotted line (overbought zone)**, it indicates that the market may be overheated and there is a risk that the upward momentum will be exhausted.
- When both lines enter **below the blue dotted line (oversold zone)**, it indicates that the market may be oversold, which is a potential bottom or rebound area.
- **Custom Settings**:
You can click the small gear icon next to the indicator name to enter "Settings" and adjust the "Channel Length", "Average Length" and "Overbought/Oversold Levels" according to your own trading style.
EventFilterLib🧠 EventFilterLib – Summary & Usage
📘 Purpose
EventFilterLib helps suppress trading signals around sensitive market times, improving signal quality and reducing risk during volatile or illiquid periods.
🔢 Included Event Filters
🟥 Tier 1 – High Impact Events (3h buffer default)
--FOMC Meetings
--NFP
--CPI
--Fed Chair Speeches
--US Federal Holidays
🟧 Tier 2 – Medium Impact Events (2h buffer default)
--ADP Employment Reports
--Retail Sales
--PPI Releases
--ISM Reports
--Crude Oil Inventories
🟦 Tier 3 – Session-Based Filters (built-in)
--NY Open/Close (±30min)
--Asia–London Overlap (07:00–09:00 UTC)
--NY Lunch (17:00–18:00 UTC)
--Midnight GMT Volatility Spike (00:00–00:30 UTC)
🟨 Weekend Filter
--Full-day block on Saturday/Sunday
--Optional buffer (e.g. Friday after 3pm)
The library returns 4 Booleans, . You can call the function in your script using the following snippet:
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
barTime = time
// === Inputs
weekendMode = input.bool(true, "Enable Weekend Filter")
bufferT1Before = input.int(180, "Tier 1 Buffer Before (min)")
bufferT1After = input.int(180, "Tier 1 Buffer After (min)")
bufferT2Before = input.int(120, "Tier 2 Buffer Before (min)")
bufferT2After = input.int(120, "Tier 2 Buffer After (min)")
bufferWBefore = input.int(180, "Weekend Buffer Before (min)")
bufferWAfter = input.int(180, "Weekend Buffer After (min)")
// === Call Function
= EventFilterLib.isInQuietPeriod(
barTime, weekendMode, bufferT1Before, bufferT1After,
bufferWBefore, bufferWAfter, bufferT2Before, bufferT2After
)
// === Apply to Visualization or Signal Filter
bgcolor(tier1 ? color.red : na, title="Tier 1 Quiet")
bgcolor(tier2 ? color.orange : na, title="Tier 2 Quiet")
bgcolor(weekend ? color.blue : na, title="Weekend Quiet")
bgcolor(session ? color.purple : na, title="Session Quiet")
// Example Trade Block
allowTrade = not (tier1 or tier2 or weekend or session)
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
/Novo Algo Team
OneMonthFVGLibrary "OneMonthFVG"
The library is searching the open 1M FVG
find_one_m_fvg(provided_bull_fvgs)
Parameters:
provided_bull_fvgs (array)
BullFVG
Fields:
right (series int)
top (series float)
left (series int)
bottom (series float)
SIC_TICKER_DATAThe SIC Ticker Data is an advanced and efficient library for ticker-to-industry classification and sector analysis. Built with enterprise-grade performance optimizations, this library provides instant access to SIC codes, industry classifications, and peer company data for comprehensive market analysis.
Perfect for: Sector rotation strategies, peer analysis, portfolio diversification, market screening, and financial research tools.
The simple idea behind this library is to pull any data related to SIC number of any US stock market ticker provided by SEC in order to see the industry and also see the exact competitors of the ticker.
The library stores 3 types of data: SIC number, Ticker, and Industry name. What makes it very useful is that you can pull any one of this data using the other. For example, if you would like to know which tickers are inside a certain SIC, or what's the SIC number of a specific ticker, or even which tickers are inside a certain industry, you can use this library to pull this data. The idea for data inside this library is to be accessible in any direction possible as long as they're related to each other.
We've also published a simple indicator that uses this library in order to demonstrate the inner workings of this library.
The library stores thousands of tickers and their relevant SIC code and industry for your use and is constantly updated with new data when available. This is a large library but it is optimized to run as fast as possible. The previous unpublished versions would take over 40 seconds to load any data but the final public version here loads the data in less than 5 seconds.
🔍 Primary Lookup Functions
createDataStore()
Initialize the library with all pre-loaded data.
store = data.createDataStore()
getSicByTicker(store, ticker)
Get SIC code for any ticker symbol.
sic = data.getSicByTicker(store, "AAPL") // Returns: "3571"
getIndustryByTicker(store, ticker)
Get industry classification for any ticker.
industry = data.getIndustryByTicker(store, "AAPL") // Returns: "Computer Hardware"
getTickersBySic(store, sic)
Get all companies in a specific SIC code.
software = data.getTickersBySic(store, "7372") // Returns: "MSFT,GOOGL,META,V,MA,CRM,ADBE,ORCL,NOW,INTU"
getTickersByIndustry(store, industry)
Get all companies in an industry.
retail = data.getTickersByIndustry(store, "Retail") // Returns: "AMZN,HD,WMT,TGT,COST,LOW"
📊 Array & Analysis Functions
getTickerArrayBySic(store, sic)
Get tickers as array for processing.
techArray = data.getTickerArrayBySic(store, "7372")
for i = 0 to array.size(techArray) - 1
ticker = array.get(techArray, i)
// Process each tech company
getTickerCountBySic(store, sic)
Count companies in a sector (ultra-fast).
pinescripttechCount = data.getTickerCountBySic(store, "7372") // Returns: 10
🎯 Utility Functions
tickerExists(store, ticker)
Check if ticker exists in database.
exists = data.tickerExists(store, "AAPL") // Returns: true
tickerInSic(store, ticker, sic)
Check if ticker belongs to specific sector.
isInTech = data.tickerInSic(store, "AAPL", "3571") // Returns: true
💡 Usage Examples
Example 1: Basic Ticker Lookup
// @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Ticker Analysis", overlay=true)
store = data.createDataStore()
currentSic = data.getSicByTicker(store, syminfo.ticker)
currentIndustry = data.getIndustryByTicker(store, syminfo.ticker)
if barstate.islast and currentSic != "NOT_FOUND"
label.new(bar_index, high, syminfo.ticker + " SIC: " + currentSic + " Industry: " + currentIndustry)
Example 2: Sector Analysis
// @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Sector Comparison", overlay=false)
store = data.createDataStore()
// Compare sector sizes
techCount = data.getTickerCountBySic(store, "7372") // Software
financeCount = data.getTickerCountBySic(store, "6199") // Finance
healthCount = data.getTickerCountBySic(store, "2834") // Pharmaceutical
plot(techCount, title="Tech Companies", color=color.blue)
plot(financeCount, title="Finance Companies", color=color.green)
plot(healthCount, title="Health Companies", color=color.red)
Example 3: Peer Analysis
// @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Find Competitors", overlay=true)
store = data.createDataStore()
currentSic = data.getSicByTicker(store, syminfo.ticker)
if currentSic != "NOT_FOUND"
competitors = data.getTickersBySic(store, currentSic)
peerCount = data.getTickerCountBySic(store, currentSic)
if barstate.islast
label.new(bar_index, high, "Competitors (" + str.tostring(peerCount) + "): " + competitors)
Example 4: Portfolio Sector Allocation
// @version=6
import EdgeTerminal/SIC_TICKER_DATA/1 as data
indicator("Portfolio Analysis", overlay=false)
store = data.createDataStore()
// Analyze your portfolio's sector distribution
portfolioTickers = array.from("AAPL", "MSFT", "GOOGL", "JPM", "JNJ")
sectorCount = map.new()
for i = 0 to array.size(portfolioTickers) - 1
ticker = array.get(portfolioTickers, i)
industry = data.getIndustryByTicker(store, ticker)
if industry != "NOT_FOUND"
currentCount = map.get(sectorCount, industry)
newCount = na(currentCount) ? 1 : currentCount + 1
map.put(sectorCount, industry, newCount)
🔧 Advanced Feature
You can also bulk load data for large data sets like this:
// Pre-format your data as pipe-separated string
bulkData = "AAPL:3571:Computer Hardware|MSFT:7372:Software|GOOGL:7372:Software"
store = data.createDataStoreFromBulk(bulkData)
DespGeneralLibrary "DespGeneral"
GetAvgVolotility(sHigh, sLow, countLast)
Parameters:
sHigh (float)
sLow (float)
countLast (int)
GetCandleSize(sHigh, sLow, barIndexBack)
Parameters:
sHigh (float)
sLow (float)
barIndexBack (int)
IsNegative(sClose, sOpen, barIndexBack)
Parameters:
sClose (float)
sOpen (float)
barIndexBack (int)
GetBottomWickSize(sClose, sOpen, sLow, barIndexBack)
Parameters:
sClose (float)
sOpen (float)
sLow (float)
barIndexBack (int)
GetTopWickSize(sClose, sOpen, sHigh, barIndexBack)
Parameters:
sClose (float)
sOpen (float)
sHigh (float)
barIndexBack (int)
GetDistanceInTicksAbs(fromPrice, toPrice, tickSize)
Parameters:
fromPrice (float)
toPrice (float)
tickSize (float)
MaayaBaseLibrary "MaayaBase"
TODO: add library description here
GetMaayaBaseValues(pivotTimeframe)
TODO: add function description here
Parameters:
pivotTimeframe (string)
Returns: TODO: add what function returns
HalfTrendLibraryLibrary "HalfTrendLibrary"
getHalfTrend(_high, _low, _close)
Parameters:
_high (float)
_low (float)
_close (float)
MonthlyProfitTable# Monthly Profit Table Library
**Automatically create beautiful monthly profit/loss tables for your Pine Script strategies with just 3 lines of code!**
## 🎯 What It Does
This library automatically tracks your strategy's performance and displays it in a clean, professional monthly profit table similar to what you see in institutional trading reports. No manual calculations required - just import and use!
## ✨ Key Features
- **🚀 Super Easy Setup**: Just 3 lines of code to get started
- **📊 Automatic Tracking**: Monitors your strategy's P&L automatically
- **📅 Monthly & Yearly Breakdown**: Shows profits/losses by month and year
- **🎨 Customizable Colors**: Choose your own color scheme
- **📍 Flexible Positioning**: Place the table anywhere on your chart
- **💯 Percentage & Dollar Values**: Shows both absolute and percentage returns
- **🔄 Real-time Updates**: Updates automatically as your strategy runs
## 🛠️ How to Use
// Import the library
import your_username/MonthlyProfitTable/1 as mpt
// In your strategy:
// Step 1: Create a profit tracker
var profitData = mpt.newProfitData()
// Step 2: Update tracking data
profitData := mpt.updateProfitData(profitData)
// Step 3: Display the table
mpt.showSimpleProfitTable(profitData)
## 🎨 Customization Options
- **Precision**: Control decimal places for numbers
- **Colors**: Customize header, cell, positive, and negative colors
- **Position**: Place table in any corner of your chart
- **Styling**: Choose between simple or custom styling
## 💡 Perfect For
- Strategy backtesting analysis
- Performance monitoring
- Professional strategy presentations
- Trading journals and reports
- Risk management analysis
## 📈 Example Output
Creates a table showing:
- Monthly profits/losses for each month
- Yearly totals and percentages
- Color-coded positive (green) and negative (red) values
- Clean, professional appearance
Transform your strategy analysis from basic equity curves to professional-grade monthly breakdowns!
**Compatible with all Pine Script v6 strategies. Works with any timeframe and symbol.**
ArraysAssorted🟩 OVERVIEW
This library provides utility methods for working with arrays in Pine Script. The first method finds extreme values (highest/lowest) within a rolling lookback window and returns both the value and its position. I might extend the library for other ad-hoc methods I use to work with arrays.
🟩 HOW TO USE
Pine Script libraries contain reusable code for importing into indicators. You do not need to copy any code out of here. Just import the library and call the method you want.
For example, for version 1 of this library, import it like this:
import SimpleCryptoLife/ArraysAssorted/1
See the EXAMPLE USAGE sections within the library for examples of calling the methods.
You do not need permission to use Pine libraries in your open-source scripts.
However, you do need explicit permission to reuse code from a Pine Script library’s functions in a public protected or invite-only publication .
In any case, credit the author in your description. It is also good form to credit in open-source comments.
For more information on libraries and incorporating them into your scripts, see the Libraries section of the Pine Script User Manual.
🟩 METHOD 1: m_getHighestLowestFloat()
Finds the highest or lowest float value from an array. Simple enough. It also returns the index of the value as an offset from the end of the array.
• It works with rolling lookback windows, so you can find extremes within the last N elements
• It includes an offset parameter to skip recent elements if needed
• It handles edge cases like empty arrays and invalid ranges gracefully
• It can find either the first or last occurrence of the extreme value
We also export two enums whose sole purpose is to look pretty as method arguments.
method m_getHighestLowestFloat(_self, _highestLowest, _lookbackBars, _offset, _firstLastType)
Namespace types: array
This method finds the highest or lowest value in a float array within a rolling lookback window, and returns the value along with the offset (number of elements back from the end of the array) of its first or last occurrence.
Parameters:
_self (array) : The array of float values to search for extremes.
_highestLowest (HighestLowest) : Whether to search for the highest or lowest value. Use the enum value HighestLowest.highest or HighestLowest.lowest.
_lookbackBars (int) : The number of array elements to include in the rolling lookback window. Must be positive. Note: Array elements only correspond to bars if the consuming script always adds exactly one element on consecutive bars.
_offset (int) : The number of array elements back from the end of the array to start the lookback window. A value of zero means no offset. The _offset parameter offsets both the beginning and end of the range.
_firstLastType (FirstLast) : Whether to return the offset of the first (lowest index) or last (highest index) occurrence of the extreme value. Use FirstLast.first or FirstLast.last.
Returns: (tuple) A tuple containing the highest or lowest value and its offset -- the number of elements back from the end of the array. If not found, returns . NOTE: The _offsetFromEndOfArray value is not affected by the _offset parameter. In other words, it is not the offset from the end of the range but from the end of the array. This number may or may not have any relation to the number of *bars* back, depending on how the array is populated. The calling code needs to figure that out.
EXPORTED ENUMS
HighestLowest
Whether to return the highest value or lowest value in the range.
• highest : Find the highest value in the specified range
• lowest : Find the lowest value in the specified range
FirstLast
Whether to return the first (lowest index) or last (highest index) occurrence of the extreme value.
• first : Return the offset of the first occurrence of the extreme value
• last : Return the offset of the last occurrence of the extreme value