f_maSelectLibrary "f_maSelect"
Easy to use drop-in facade function to lots of different moving average calculations, including some that are not natively available in PineScript v5 such as Zero-Lag EMA. Simply call f_maSelect(series float serie, simple string ma_type="sma", ma_length=14) instead of a ta.*ma() call and you get access to all MAs offered by PineScript and more.
zema(src, len)
Zero-lag EMA (ZLMA)
Parameters:
src : Input series
len : Lookback period
Returns: Series smoothed with ZLMA
approximate_sma(x, ma_length)
Approximate Standard Moving Average, which substracts the average instead of popping the oldest element, hence losing the base frequency and is why it is approximative. For some reason, this appears to give the same results as a standard RMA
Parameters:
x : Input series.
ma_length : Lookback period.
Returns: Approximate SMA series.
f_maSelect(serie, ma_type, ma_length)
Generalized moving average selector
Parameters:
serie : Input series
ma_type : String describing which moving average to use
ma_length : Lookback period
Returns: Serie smoothed with the selected moving average.
generalized_dev(src, length, avg, lmode)
Generalized deviation calculation: Whereas other Bollinger Bands often just change the basis but not the stdev calculation, the correct way to change the basis is to also change it inside the stdev calculation.
Parameters:
src : Series to use (default: close)
length : Lookback period
avg : Average basis to use to calculate the standard deviation
lmode : L1 or L2 regularization? (ie, lmode=1 uses abs() to cutoff negative values hence it calculates the Mean Absolute Deviation as does the ta.dev(), lmode=2 uses sum of squares hence it calculates the true Standard Deviation as the ta.stdev() function does). See also the research works of everget:
Returns: stdev Standard deviation series
generalized_dev_discount(src, length, avg, lmode, temporal_discount)
Standard deviation calculation but with different probabilities assigned to each bar, with newer bars having more weights en.wikipedia.org
Parameters:
src : Series to use (default: close)
length : Lookback period
avg : Average basis to use to calculate the standard deviation
lmode : L1 or L2 regularization? (ie, lmode=1 uses abs() to cutoff negative values hence it calculates the Mean Absolute Deviation as does the ta.dev(), lmode=2 uses sum of squares hence it calculates the true Standard Deviation as the ta.stdev() function does). See also the research works of everget:
temporal_discount : Probabilistic gamma factor to discount old values in favor of new ones, higher value = more weight to newer bars
Returns: stdev Standard deviation series
median_absdev(src, length, median)
Median Absolute Deviation
Parameters:
src : Input series
length : Lookback period
median : Median already calculated on the input series
Returns: mad, the median absolute deviation value
Colors
ColorsLibrary "Colors"
Helpers for color manipulations
opacify(oldColor, opacity)
Applies opacity to color
Parameters:
oldColor : color
opacity : opacity
Returns: color with opacity
theme_presetsStyle Made Easy with 175 Reversable light/dark themes
Built on to of my theme engine, so any tools built with one
will work with the other.
getTheme(_input)
Get a theme by name. (see lib for copy/paste list)
Parameters:
_input : string Name of Theme to use.
apathy()
Theme preset -> "Apathy"
Returns: Theme object
apprentice()
Theme preset -> "Apprentice"
Returns: Theme object
ashes()
Theme preset -> "Ashes"
Returns: Theme object
atelier_cave()
Theme preset -> "Atelier Cave"
Returns: Theme object
atelier_dune()
Theme preset -> "Atelier Dune"
Returns: Theme object
atelier_estuary()
Theme preset -> "Atelier Estuary"
Returns: Theme object
atelier_forest()
Theme preset -> "Atelier Forest"
Returns: Theme object
atelier_heath()
Theme preset -> "Atelier Heath"
Returns: Theme object
atelier_lakeside()
Theme preset -> "Atelier Lakeside"
Returns: Theme object
atelier_plateau()
Theme preset -> "Atelier Plateau"
Returns: Theme object
atelier_savanna()
Theme preset -> "Atelier Savanna"
Returns: Theme object
atelier_seaside()
Theme preset -> "Atelier Seaside"
Returns: Theme object
atelier_sulphurpool()
Theme preset -> "Atelier Sulphurpool"
Returns: Theme object
atlas()
Theme preset -> "Atlas"
Returns: Theme object
ayu()
Theme preset -> "Ayu"
Returns: Theme object
ayu_mirage()
Theme preset -> "Ayu Mirage"
Returns: Theme object
bespin()
Theme preset -> "Bespin"
Returns: Theme object
black_metal()
Theme preset -> "Black Metal"
Returns: Theme object
black_metal_bathory()
Theme preset -> "Black Metal (bathory)"
Returns: Theme object
black_metal_burzum()
Theme preset -> "Black Metal (burzum)"
Returns: Theme object
black_metal_funeral()
Theme preset -> "Black Metal (dark Funeral)"
Returns: Theme object
black_metal_gorgoroth()
Theme preset -> "Black Metal (gorgoroth)"
Returns: Theme object
black_metal_immortal()
Theme preset -> "Black Metal (immortal)"
Returns: Theme object
black_metal_khold()
Theme preset -> "Black Metal (khold)"
Returns: Theme object
black_metal_marduk()
Theme preset -> "Black Metal (marduk)"
Returns: Theme object
black_metal_mayhem()
Theme preset -> "Black Metal (mayhem)"
Returns: Theme object
black_metal_nile()
Theme preset -> "Black Metal (nile)"
Returns: Theme object
black_metal_venom()
Theme preset -> "Black Metal (venom)"
Returns: Theme object
blue_forest()
Theme preset -> "Blue Forest"
Returns: Theme object
blueish()
Theme preset -> "Blueish"
Returns: Theme object
brewer()
Theme preset -> "Brewer"
Returns: Theme object
bright()
Theme preset -> "Bright"
Returns: Theme object
brogrammer()
Theme preset -> "Brogrammer"
Returns: Theme object
brush_trees()
Theme preset -> "Brush Trees"
Returns: Theme object
catppuccin()
Theme preset -> "Catppuccin"
Returns: Theme object
chalk()
Theme preset -> "Chalk"
Returns: Theme object
circus()
Theme preset -> "Circus"
Returns: Theme object
classic()
Theme preset -> "Classic"
Returns: Theme object
clrs()
Theme preset -> "Colors"
Returns: Theme object
codeschool()
Theme preset -> "Codeschool"
Returns: Theme object
cupcake()
Theme preset -> "Cupcake"
Returns: Theme object
cupertino()
Theme preset -> "Cupertino"
Returns: Theme object
da_one_black()
Theme preset -> "Da One Black"
Returns: Theme object
da_one_gray()
Theme preset -> "Da One Gray"
Returns: Theme object
da_one_ocean()
Theme preset -> "Da One Ocean"
Returns: Theme object
da_one_paper()
Theme preset -> "Da One Paper"
Returns: Theme object
da_one_sea()
Theme preset -> "Da One Sea"
Returns: Theme object
da_one_white()
Theme preset -> "Da One White"
Returns: Theme object
danqing()
Theme preset -> "Danqing"
Returns: Theme object
darcula()
Theme preset -> "Darcula"
Returns: Theme object
dark_violet()
Theme preset -> "Dark Violet"
Returns: Theme object
darkmoss()
Theme preset -> "Darkmoss"
Returns: Theme object
darktooth()
Theme preset -> "Darktooth"
Returns: Theme object
decaf()
Theme preset -> "Decaf"
Returns: Theme object
dirtysea()
Theme preset -> "Dirtysea"
Returns: Theme object
dracula()
Theme preset -> "Dracula"
Returns: Theme object
edge()
Theme preset -> "Edge"
Returns: Theme object
eighties()
Theme preset -> "Eighties"
Returns: Theme object
embers()
Theme preset -> "Embers"
Returns: Theme object
emil()
Theme preset -> "Emil"
Returns: Theme object
equilibrium()
Theme preset -> "Equilibrium"
Returns: Theme object
equilibrium_gray()
Theme preset -> "Equilibrium Gray"
Returns: Theme object
espresso()
Theme preset -> "Espresso"
Returns: Theme object
eva()
Theme preset -> "Eva"
Returns: Theme object
everforest()
Theme preset -> "Everforest"
Returns: Theme object
flat()
Theme preset -> "Flat"
Returns: Theme object
framer()
Theme preset -> "Framer"
Returns: Theme object
fruit_soda()
Theme preset -> "Fruit Soda"
Returns: Theme object
gigavolt()
Theme preset -> "Gigavolt"
Returns: Theme object
github()
Theme preset -> "Github"
Returns: Theme object
google()
Theme preset -> "Google"
Returns: Theme object
gotham()
Theme preset -> "Gotham"
Returns: Theme object
grayscale()
Theme preset -> "Grayscale"
Returns: Theme object
green_screen()
Theme preset -> "Green Screen"
Returns: Theme object
gruber()
Theme preset -> "Gruber"
Returns: Theme object
gruvbox_hard()
Theme preset -> "Gruvbox Dark, Hard"
Returns: Theme object
gruvbox_medium()
Theme preset -> "Gruvbox Dark, Medium"
Returns: Theme object
gruvbox_pale()
Theme preset -> "Gruvbox Dark, Pale"
Returns: Theme object
gruvbox_soft()
Theme preset -> "Gruvbox Dark, Soft"
Returns: Theme object
gruvbox_material_hard()
Theme preset -> "Gruvbox Material Dark, Hard"
Returns: Theme object
gruvbox_material_medium()
Theme preset -> "Gruvbox Material Dark, Medium"
Returns: Theme object
gruvbox_material_soft()
Theme preset -> "Gruvbox Material Dark, Soft"
Returns: Theme object
hardcore()
Theme preset -> "Hardcore"
Returns: Theme object
harmonic16()
Theme preset -> "Harmonic16"
Returns: Theme object
heetch()
Theme preset -> "Heetch"
Returns: Theme object
helios()
Theme preset -> "Helios"
Returns: Theme object
hopscotch()
Theme preset -> "Hopscotch"
Returns: Theme object
horizon()
Theme preset -> "Horizon"
Returns: Theme object
horizon_terminal()
Theme preset -> "Horizon Terminal"
Returns: Theme object
humanoid()
Theme preset -> "Humanoid"
Returns: Theme object
ia()
Theme preset -> "Ia"
Returns: Theme object
icy()
Theme preset -> "Icy"
Returns: Theme object
ir_black()
Theme preset -> "Ir Black"
Returns: Theme object
isotope()
Theme preset -> "Isotope"
Returns: Theme object
kanagawa()
Theme preset -> "Kanagawa"
Returns: Theme object
katy()
Theme preset -> "Katy"
Returns: Theme object
kimber()
Theme preset -> "Kimber"
Returns: Theme object
lime()
Theme preset -> "Lime"
Returns: Theme object
london_tube()
Theme preset -> "London Tube"
Returns: Theme object
macintosh()
Theme preset -> "Macintosh"
Returns: Theme object
marrakesh()
Theme preset -> "Marrakesh"
Returns: Theme object
materia()
Theme preset -> "Materia"
Returns: Theme object
material()
Theme preset -> "Material"
Returns: Theme object
materialdarker()
Theme preset -> "Material Darker"
Returns: Theme object
material_palenight()
Theme preset -> "Material Palenight"
Returns: Theme object
material_vivid()
Theme preset -> "Material Vivid"
Returns: Theme object
mellow_purple()
Theme preset -> "Mellow Purple"
Returns: Theme object
mocha()
Theme preset -> "Mocha"
Returns: Theme object
monokai()
Theme preset -> "Monokai"
Returns: Theme object
Nebula()
Theme preset -> "Nebula"
Returns: Theme object
nord()
Theme preset -> "Nord"
Returns: Theme object
nova()
Theme preset -> "Nova"
Returns: Theme object
ocean()
Theme preset -> "Ocean"
Returns: Theme object
oceanicnext()
Theme preset -> "Oceanicnext"
Returns: Theme object
onedark()
Theme preset -> "Onedark"
Returns: Theme object
outrun()
Theme preset -> "Outrun"
Returns: Theme object
pandora()
Theme preset -> "Pandora"
Returns: Theme object
papercolor()
Theme preset -> "Papercolor"
Returns: Theme object
paraiso()
Theme preset -> "Paraiso"
Returns: Theme object
pasque()
Theme preset -> "Pasque"
Returns: Theme object
phd()
Theme preset -> "Phd"
Returns: Theme object
pico()
Theme preset -> "Pico"
Returns: Theme object
pinky()
Theme preset -> "Pinky"
Returns: Theme object
pop()
Theme preset -> "Pop"
Returns: Theme object
porple()
Theme preset -> "Porple"
Returns: Theme object
primer()
Theme preset -> "Primer"
Returns: Theme object
purpledream()
Theme preset -> "Purpledream"
Returns: Theme object
qualia()
Theme preset -> "Qualia"
Returns: Theme object
railscasts()
Theme preset -> "Railscasts"
Returns: Theme object
rebecca()
Theme preset -> "Rebecca"
Returns: Theme object
rose_pine()
Theme preset -> "Rosé Pine"
Returns: Theme object
rose_pine_dawn()
Theme preset -> "Rosé Pine Dawn"
Returns: Theme object
rose_pine_moon()
Theme preset -> "Rosé Pine Moon"
Returns: Theme object
sagelight()
Theme preset -> "Sagelight"
Returns: Theme object
sakura()
Theme preset -> "Sakura"
Returns: Theme object
sandcastle()
Theme preset -> "Sandcastle"
Returns: Theme object
seti_ui()
Theme preset -> "Seti Ui"
Returns: Theme object
shades_of_purple()
Theme preset -> "Shades Of Purple"
Returns: Theme object
shadesmear()
Theme preset -> "Shadesmear"
Returns: Theme object
shapeshifter()
Theme preset -> "Shapeshifter"
Returns: Theme object
silk()
Theme preset -> "Silk"
Returns: Theme object
snazzy()
Theme preset -> "Snazzy"
Returns: Theme object
solar_flare()
Theme preset -> "Solar Flare"
Returns: Theme object
solarized()
Theme preset -> "Solarized"
Returns: Theme object
spaceduck()
Theme preset -> "Spaceduck"
Returns: Theme object
spacemacs()
Theme preset -> "Spacemacs"
Returns: Theme object
stella()
Theme preset -> "Stella"
Returns: Theme object
still_alive()
Theme preset -> "Still Alive"
Returns: Theme object
summercamp()
Theme preset -> "Summercamp"
Returns: Theme object
summerfruit()
Theme preset -> "Summerfruit"
Returns: Theme object
synth_midnight_terminal()
Theme preset -> "Synth Midnight Terminal"
Returns: Theme object
tango()
Theme preset -> "Tango"
Returns: Theme object
tender()
Theme preset -> "Tender"
Returns: Theme object
tokyo_city()
Theme preset -> "Tokyo City"
Returns: Theme object
tokyo_city_terminal()
Theme preset -> "Tokyo City Terminal"
Returns: Theme object
tokyo_night()
Theme preset -> "Tokyo Night"
Returns: Theme object
tokyo_night_storm()
Theme preset -> "Tokyo Night Storm"
Returns: Theme object
tokyo_night_terminal()
Theme preset -> "Tokyo Night Terminal"
Returns: Theme object
tokyo_night_terminal_storm()
Theme preset -> "Tokyo Night Terminal Storm"
Returns: Theme object
tokyodark()
Theme preset -> "Tokyodark"
Returns: Theme object
tokyodark_terminal()
Theme preset -> "Tokyodark Terminal"
Returns: Theme object
tomorrow()
Theme preset -> "Tomorrow"
Returns: Theme object
tomorrow_night()
Theme preset -> "Tomorrow Night"
Returns: Theme object
tomorrow_night_eighties()
Theme preset -> "Tomorrow Night Eighties"
Returns: Theme object
twilight()
Theme preset -> "Twilight"
Returns: Theme object
unikitty()
Theme preset -> "Unikitty"
Returns: Theme object
unikitty_reversible()
Theme preset -> "Unikitty Reversible"
Returns: Theme object
uwunicorn()
Theme preset -> "Uwunicorn"
Returns: Theme object
vice()
Theme preset -> "Vice"
Returns: Theme object
vulcan()
Theme preset -> "Vulcan"
Returns: Theme object
windows_10()
Theme preset -> "Windows 10"
Returns: Theme object
windows_95()
Theme preset -> "Windows 95"
Returns: Theme object
windows_high_contrast()
Theme preset -> "Windows High Contrast"
Returns: Theme object
windows_nt()
Theme preset -> "Windows Nt"
Returns: Theme object
woodland()
Theme preset -> "Woodland"
Returns: Theme object
xcode_dusk()
Theme preset -> "Xcode Dusk"
Returns: Theme object
theme_engineLibrary "theme_engine"
Theme Builder and Structure for live generative themes
init(_name)
New theme object.
Parameters:
_name : (string) opptional name
Returns: a VAR theme (holds it's vals when updated if not overwritten)
globals(theme, _h1, _h2, _h3, _h4, _s, _val, _contrast)
Create light/dark theme globals
Parameters:
theme : (theme) Theme to add theses to
_h1 : (float) Hue #1 for Template
_h2 : (float) Hue #2 for Template
_h3 : (float) Hue #3 for Template
_h4 : (float) Hue #4 for Template
_s : (float) Saturation of theme
_val : (float) Luminosity (light/dark)
_contrast : (float) Contrast to apply
Returns: Theme wwith adjusted colors
setConfig(theme, setting)
Apply a Settings object to a theme
Parameters:
theme : Theme object to apply settings to.
setting : settings to apply
Returns: theme
Types :
settings
Settings for a theme
Fields:
h1 : (float) Hue #1 for Template
h2 : (float) Hue #2 for Template
h3 : (float) Hue #3 for Template
h4 : (float) Hue #4 for Template
sat : (float) Saturation of theme
lum : (float) Luminosity (light/dark)
vib : (float) Vibrance (Contrast)
r : (float) Hue of Red
o : (float) Hue of Orange
y : (float) Hue of Yellow
g : (float) Hue of Green
a : (float) Hue of Aqua
b : (float) Hue of Blue
i : (float) Hue of Indigo
v : (float) Hue of Violet
satvals : (settings) Array for use if desired to customize Saturation per color
lumvals : (settings) Array for use if desired to customize Luminancce per color
mods
Modifiers Item for Use if desired
Fields:
val : (float)
size : (float)
depth : (float)
hue : (float)
sat : (float)
alpha : (float)
mix : (float)
emit : (float)
ch : (float)
step : (int)
dist : (int)
holds : (mods)
isin : (mods)
track : (color)
varient
Light/Dark/Custom Theme Varients
Fields:
bg : (color) Bacckground Color
fg : (color) Foreground Color
accent : (color) Accccent Color
secondary : (color) Secondary Color
txt : (color) Text Color
theme
Theme Object
Fields:
name : (string) Theme name
dark : (varient) Theme dark Varient
light : (varient) Theme light Varient
red : (color) Color for red
orange : (color) Color for orange
yellow : (color) Color for yellow
green : (color) Color for green
aqua : (color) Color for aqua
blue : (color) Color for blue
purple : (color) Color for purple
pink : (color) Color for pink
tweaks : (mods) Modifiers UDT to use for adjusters
themedict
Fields:
names : (string ) Names of themes
themes : (theme ) Theme Items
ColorUtility for working with colors.
Get the luminosity of a color and determine the optimal (black or white) foreground color.
base16Library "base16"
Base16 Syntax Theme Collection. dark/light Pairs placed into 2 matched groups.
included is tool for assembling your own themes, as well as all themes String names
to create your own Input menus / add to your own theme matrix, and theme selectors
addToMatrix(_mtx, _title, _choices, _theme)
To create a theme matrix with string index, use a color matrix global
add theme name to string array of theme titles
and last input a theme from above, or create your own theme arrays.
Parameters:
_mtx : (color ) matrix for storage
_title : (string ) Name of theme being added
_choices : (string ) name index
_theme : (color ) colors being added
Returns: void
addToMatrix(_mtx, _theme)
Add theme to color matrix Non-indexed
Parameters:
_mtx : (color ) matrix for storage
_theme : (color ) colors being added
dark()
Dark Themne Selection (With light Equivalent in same location)
Returns: Color matrix of dark themes
light()
light Themne Selection (With dark Equivalent in same location)
Returns: Color matrix of light themes
selectTheme(_mtx, _themes, _theme)
Get a Theme By Name
Parameters:
_mtx : (Matrix color) Name of Theme
_themes : (Array string) Array with Names of Themes
_theme : (string ) Name of Theme to select
selectTheme(_mtx, _theme)
Get a Theme By Number
Parameters:
_mtx : (Matrix color) Name of Theme
_theme : (int ) Number of Theme to select
/// all themes included:
3024
apathy
apprentice
ashes
atelier_cave_light
atelier_cave
atelier_dune_light
atelier_dune
atelier_estuary_light
atelier_estuary
atelier_forest_light
atelier_forest
atelier_heath_light
atelier_heath
atelier_lakeside_light
atelier_lakeside
atelier_plateau_light
atelier_plateau
atelier_savanna_light
atelier_savanna
atelier_seaside_light
atelier_seaside
atelier_sulphurpool_light
atelier_sulphurpool
atlas
ayu_dark
ayu_light
ayu_mirage
bespin
black_metal_bathory
black_metal_burzum
black_metal_dark_funeral
black_metal_gorgoroth
black_metal_immortal
black_metal_khold
black_metal_marduk
black_metal_mayhem
black_metal_nile
black_metal_venom
black_metal
blue_forest
blueish
brewer
bright
brogrammer
brush_trees_dark
brush_trees
catppuccin
chalk
circus
classic_dark
classic_light
codeschool
clrs
cupcake
cupertino
da_one_black
da_one_gray
da_one_ocean
da_one_paper
da_one_sea
da_one_white
danqing_light
danqing
darcula
darkmoss
darktooth
dark_violet
decaf
default_dark
default_light
dirtysea
dracula
edge_dark
edge_light
eighties
embers
emil
equilibrium_dark
equilibrium_gray_dark
equilibrium_gray_light
equilibrium_light
espresso
eva_dim
eva
everforest
flat
framer
fruit_soda
gigavolt
github
google_dark
google_light
gotham
grayscale_dark
grayscale_light
green_screen
gruber
gruvbox_dark_hard
gruvbox_dark_medium
gruvbox_dark_pale
gruvbox_dark_soft
gruvbox_light_hard
gruvbox_light_medium
gruvbox_light_soft
gruvbox_material_dark_hard
gruvbox_material_dark_medium
gruvbox_material_dark_soft
gruvbox_material_light_hard
gruvbox_material_light_medium
gruvbox_material_light_soft
hardcore
harmonic16_dark
harmonic16_light
heetch_light
heetch_dark
helios
hopscotch
horizon_dark
horizon_light
horizon_terminal_dark
horizon_terminal_light
humanoid_dark
humanoid_light
ia_dark
ia_light
icy_dark
ir_black
isotope
kanagawa
katy
kimber
lime
macintosh
marrakesh
materia
material_darker
material_lighter
material_palenight
material_vivid
material
mellow_purple
mexico_light
mocha
monokai
Nebula
nord
nova
ocean
oceanicnext
one_light
onedark
outrun_dark
pandora
papercolor_dark
papercolor_light
paraiso
pasque
phd
pico
pinky
pop
porple
primer_dark_dimmed
primer_dark
primer_light
purpledream
qualia
railscasts
rebecca
rose_pine_dawn
rose_pine_moon
rose_pine
sagelight
sakura
sandcastle
seti_ui
shades_of_purple
shadesmear_dark
shadesmear_light
shapeshifter
silk_dark
silk_light
snazzy
solar_flare_light
solar_flare
solarized_dark
solarized_light
spaceduck
spacemacs
stella
still_alive
summercamp
summerfruit_dark
summerfruit_light
synth_midnight_terminal_dark
synth_midnight_terminal_light
tango
tender
tokyo_city_dark
tokyo_city_light
tokyo_city_terminal_dark
tokyo_city_terminal_light
tokyo_night_dark
tokyo_night_light
tokyo_night_storm
tokyo_night_terminal_dark
tokyo_night_terminal_light
tokyo_night_terminal_storm
tokyodark_terminal
tokyodark
tomorrow_night_eighties
tomorrow_night
tomorrow
london_tube
twilight
unikitty_dark
unikitty_light
unikitty_reversible
uwunicorn
vice
vulcan
windows_10_light
windows_10
windows_95_light
windows_95
windows_high_contrast_light
windows_high_contrast
windows_nt_light
windows_nt
woodland
xcode_dusk
zenburn
HSV and HSL gradient Tools ( Built-in Drop-in replacement )Library "hsvColor"
HSV and HSL Gradient Tool Alternatives and helpers. Demo'd is built-in in the middle with HSL/HSV gradients on top/bottom
TODO: Solve for #000000 issue
rgbhsv(_col)
RGB Color to HSV Values
Parameters:
_col : Color input (#abc012 or color.name or color.rgb(0,0,0,0))
Returns: values
rgbhsv(_r, _g, _b, _t)
RGB Color to HSV Values
Parameters:
_r : Red 0 - 255
_g : Green 0 - 255
_b : Blue 0 - 255
_t : Transp 0 - 100
Returns: values
hsv(_h, _s, _v, _a)
HSV colors, Auto fix if past boundaries
Parameters:
_h : Hue Input (-360 - 360) or further
_s : Saturation 0.- 1.
_v : Value 0.- 1.
_a : Alpha 0.- 1.
Returns: Color output
hue(_col)
returns 0-359 hue on color wheel
Parameters:
_col :
Returns: 360 degree hue value
hsv_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal : Control signal
_startVal : start color limit
_endVal : end color limit
_startCol : start color
_endCol : end color
Returns: HSV calculated gradient
hsl_gradient(signal, _startVal, _endVal, _startCol, _endCol)
Color Gradient Replacement Function for HSV calculated Gradents
Parameters:
signal : Control signal
_startVal : start color limit
_endVal : end color limit
_startCol : start color
_endCol : end color
Returns: HSV calculated gradient
Color Library: Rainbow Index & Simplest Return ColorLibrary "Color Library!"
To help with large projects that need colors!
If you guys make the library bigger, share it so we can all have tons of colors!
2 Functions
Uppercase and Lowercase, because why not?
import library as color
1.) color.this("Brown") // or color.this("brown") both work
2.) color.rainbow(1) //Returns first index of Rainbow
this(x)
TODO: color.this(Brown)
Parameters:
x : TODO: String Color Name
Returns: TODO: Color
rainbow(x)
TODO: Return Rainbow Index
Parameters:
x : TODO: Number is index of Rainbow :)
Returns: TODO: Color
ColorArrayLibrary "ColorArray"
Simple color array gradient tool.
makeGradient(size, _col1, _col2, _col3, _col4, _col5) Color Gradient Array from 5 colors.
Parameters:
size : : default 10
_col1 : : default #ff0000
_col2 : : default #ffff00
_col3 : : default #00ff00
_col4 : : default #00ffff
_col5 : : default #0000ff
Returns: array of colors to specified size.
HTV_LibraryLibrary "HTV_LibraryV2"
up_bar() 'up_bar' checks true for every candle that closed above open price.
Returns: custom Series Bool
last_up_bar() 'last_up_bar' checks true for every last candle that closed above open price.
Returns: custom Series Bool
down_bar() 'down_bar' checks true for every candle that closed below open price.
Returns: custom Series Bool
last_down_bar() 'last_down_bar' checks true for every last candle that closed below open price.
Returns: custom Series Bool
TBR_Up() 'TBR_Up' checks true for every last confirmed 2 Bar Reversal.
Returns: custom Series Bool
TBR_Down() 'TBR_Down' checks true for every last confirmed 2 Bar Reversal.
Returns: custom Series Bool
TCR_Up() 'TCR_Up' checks true for every last confirmed 3 Candle Reversal.
Returns: custom Series Bool
TCR_Down() 'TCR_Down' checks true for every last confirmed 3 Candle Reversal.
Returns: custom Series Bool
f_fib() 'f_fib' gives a fibonacci number based on rising numericial order starting from 0
Returns: custom Series Bool
WHITE() uses color.rgb(r,g,b,t) function
Returns: literal color
WHITE_25T()
WHITE_50T()
WHITE_90T()
BLACK()
BLACK_25T()
BLACK_50T()
BLACK_90T()
RED()
RED_25T()
RED_50T()
RED_90T()
GREEN()
GREEN_25T()
GREEN_50T()
GREEN_90T()
BLUE()
BLUE_25T()
BLUE_50T()
BLUE_90T()
GREY()
GREY_25T()
GREY_50T()
GREY_90T()
NEON_YELLOW()
NEON_YELLOW_25T()
NEON_YELLOW_50T()
NEON_YELLOW_90T()
NEON_GREEN()
NEON_GREEN_25T()
NEON_GREEN_50T()
NEON_GREEN_90T()
NEON_PINK()
NEON_PINK_25T()
NEON_PINK_50T()
NEON_PINK_90T()
PURPLE()
PURPLE_25T()
PURPLE_50T()
PURPLE_90T()
SMA()
EMA()
WMA()
VWMA()
RMA()
HMA()
STMA()
ETMA()
CanvasLibrary "Canvas"
A library implementing a kind of "canvas" using a table where each pixel is represented by a table cell and the pixel color by the background color of each cell.
To use the library, you need to create a color matrix (represented as an array) and a canvas table.
The canvas table is the container of the canvas, and the color matrix determines what color each pixel in the canvas should have.
max_canvas_size() Function that returns the maximum size of the canvas (100). The canvas is always square, so the size is equal to rows (as opposed to not rows multiplied by columns).
Returns: The maximum size of the canvas (100).
get_bg_color(color_matrix) Get the current background color of the color matrix. This is the default color used when erasing pixels or clearing a canvas.
Parameters:
color_matrix : The color matrix.
Returns: The current background color.
get_fg_color(color_matrix) Get the current foreground color of the color matrix. This is the default color used when drawing pixels.
Parameters:
color_matrix : The color matrix.
Returns: The current foreground color.
set_bg_color(color_matrix, bg_color) Set the background color of the color matrix. This is the default color used when erasing pixels or clearing a canvas.
Parameters:
color_matrix : The color matrix.
bg_color : The new background color.
set_fg_color(color_matrix, fg_color) Set the foreground color of the color matrix. This is the default color used when drawing pixels.
Parameters:
color_matrix : The color matrix.
fg_color : The new foreground color.
color_matrix_rows(color_matrix, rows) Function that returns how many rows a color matrix consists of.
Parameters:
color_matrix : The color matrix.
rows : (Optional) The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
Returns: The number of rows a color matrix consists of.
pixel_color(color_matrix, x, y, rows) Get the color of the pixel at the specified coordinates.
Parameters:
color_matrix : The color matrix.
x : The X coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
y : The Y coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
rows : (Optional) The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
Returns: The color of the pixel at the specified coordinates.
draw_pixel(color_matrix, x, y, pixel_color, rows) Draw a pixel at the specified X and Y coordinates. Uses the specified color.
Parameters:
color_matrix : The color matrix.
x : The X coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
y : The Y coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
pixel_color : The color of the pixel.
rows : (Optional) The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
draw_pixel(color_matrix, x, y, rows) Draw a pixel at the specified X and Y coordinates. Uses the current foreground color.
Parameters:
color_matrix : The color matrix.
x : The X coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
y : The Y coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
rows : (Optional) The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
erase_pixel(color_matrix, x, y, rows) Erase a pixel at the specified X and Y coordinates, replacing it with the background color.
Parameters:
color_matrix : The color matrix.
x : The X coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
y : The Y coordinate for the pixel. Must be between 0 and "color_matrix_rows() - 1".
rows : (Optional) The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
init_color_matrix(rows, bg_color, fg_color) Create and initialize a color matrix with the specified number of rows. The number of columns will be equal to the number of rows.
Parameters:
rows : The number of rows the color matrix should consist of. This can be omitted, but if used, can speed up execution. It can never be greater than "max_canvas_size()".
bg_color : (Optional) The initial background color. The default is black.
fg_color : (Optional) The initial foreground color. The default is white.
Returns: The array representing the color matrix.
init_canvas(color_matrix, pixel_width, pixel_height, position) Create and initialize a canvas table.
Parameters:
color_matrix : The color matrix.
pixel_width : (Optional) The pixel width (in % of the pane width). The default width is 0.35%.
pixel_height : (Optional) The pixel width (in % of the pane height). The default width is 0.60%.
position : (Optional) The position for the table representing the canvas. The default is "position.middle_center".
Returns: The canvas table.
clear(color_matrix, rows) Clear a color matrix, replacing all pixels with the current background color.
Parameters:
color_matrix : The color matrix.
rows : The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
update(canvas, color_matrix, rows) This updates the canvas with the colors from the color matrix. No changes to the canvas gets plotted until this function is called.
Parameters:
canvas : The canvas table.
color_matrix : The color matrix.
rows : The number of rows of the color matrix. This can be omitted, but if used, can speed up execution.
TPCThemeBlackAndBlue_PublicLibrary "TPCThemeBlackAndBlue_Public"
Provides calculated colors.
colorPrimary()
colorSecondary()
colorTertiary()
labelBgColor()
lHP()
lHS()
lHT()
lV()
TPCColors_PublicLibrary "TPCColors_Public"
Provides calculated colors.
get(colorKey, colorModifier) Returns the length in ms for the given amount of the given interval.
Parameters:
colorKey : Color name, for example "black", "red", or "greenDark"
colorModifier : Color modifier, for example "lightX", "light", or "dark"
Returns: The calculated color.
MakeLoveNotWarLibrary "MakeLoveNotWar"
Make Love Not War, place a flag of support on your chart!
flag(pos, text_size) Make Love Not War function.
Parameters:
pos : string, position.
text_size : string, text size.
Returns: table.
ColorsLibrary "Colors"
This Library delivers Hex Codes of Colors frequently used in indicators and strategies.
v3(colorName) Collection: Pinescript v3 Colors.
Parameters:
colorName : Color Name.
Returns: Hex code of the inquired color.
v4(colorName) Collection: Pinescript v4 Colors.
Parameters:
colorName : Color Name.
Returns: Hex code of the inquired color.
ChikouLibrary "Chikou"
This library contains Chikou Filter function to enhances functionality of Chikou-Span from Ichimoku Cloud using a simple trend filter.
Chikou is basically close value of ticker offset to close and it is a good for indicating if close value has crossed potential Support/Resistance zone from past. Chikou is usually used with 26 period.
Chikou filter uses a lookback length calculated from provided lookback percentage and checks if trend was bullish or bearish within that lookback period.
Bullish : Trend is bullish if Chikou span is above high values of all candles within defined lookback period. Bull color shows bullish trend .
Bearish : Trend is bearish if Chikou span is below low values of all candles within defined lookback period. This is indicated by Bearish color.
Reversal / Choppiness : Reversal color indicates that Chikou are swinging around candles within defined lookback period which is an indication of consolidation or trend reversal.
chikou(src, len, perc, _high, _low, bull_col, bear_col, r_col) Chikou Filter for Ichimoku Cloud with Color and Signal Output
Parameters:
src : Price Source (better to use (OHLC4+high+low/3 instead of default close value)
len : Chikou Legth (displaced source value)
perc : Percentage lookback period for Chikou Filter with defined how much candels of total length should be considered for backward filteration
_high : Ticker High Value
_low : Ticker Low Value
bull_col : Color to be returned if source value is greater than all candels within provided lookback percentage.
bear_col : Color to be returned if source value is lower than all candels within provided lookback percentage.
r_col : Color to be returned if source value is swinging around candles within defined lookback period which is an indication of consolidation or trend reversal.
Returns: Color based on trend. 'bull_col' if trend is bullish, 'bear_col' if trend is bearish. 'r_col' if no prominent trend. Integer Signal is also returned as 1 for Bullish, -1 for Bearish and 0 for no prominent trend.
easytableLibrary "easytable"
Create tables easily, with minimal code
▦ FEATURES ▦
█ Create tables █ JSON To Table █ Change Colors █ Array to Rows/Columns █ Pre-Styles █ Change Text Size █ Delete Rows/Columns █ Blink Cells
indentify_table_id() Identifies all tables ID number in each cell(0,0).
get_table_by_id(id_number) Get table object by ID number.
Parameters:
id_number : (int) ID number of the table to fetch.
Returns: table.
change_cells_color(table_object, cells_color, start_column, end_column, start_row, end_row) Change cells background colors.
Parameters:
table_object : (table) table object to be changed.
cells_color : (color) Cells color.
start_column : (int) Start column.
end_column : (int) End column.
start_row : (int) Start Row.
end_row : (int) End Row to change.
Returns: Void.
change_cells_text_color(table_object, text_color, start_column, end_column, start_row, end_row) Change cells text colors.
Parameters:
table_object : (table) table object to be changed.
text_color : (color) Text color.
start_column : (int) Start column.
end_column : (int) End column.
start_row : (int) Start Row.
end_row : (int) End Row.
Returns: Void.
change_all_table_text_color(table_object, text_color, table_column_size, table_row_size) Change All table text color.
Parameters:
table_object : (table) table object to be changed.
text_color : (color) Text color.
table_column_size : (int) Size of the table columns.
table_row_size : (int) Size of the table rows.
Returns: Void.
change_table_size(table_object, n_of_columns, n_of_rows, tbl_size) Change table size.
Parameters:
table_object : (table) table object to be changed.
n_of_columns : (int) Size of the table columns.
n_of_rows : (int) Size of the table rows.
tbl_size : (string) size of the table.
Returns: Void.
change_cells_text_size(text_size, start_column, end_column, start_row, end_row, table_id) Change table cells text size .
Parameters:
text_size : (string) Text size.
start_column : (int) Start column.
end_column : (int)(optional) End column.
start_row : (int)(optional) Start Row.
end_row : (int)(optional) End Row.
table_id : (int)(optional) Number of the ID of the table.
Returns: Void.
table_delete_row(table_object, table_column_size, start_row, end_row) Delete specified rows from table.
Parameters:
table_object : (table) table object to be changed.
table_column_size : (int) Table columns max size.
start_row : (int) Start row to delete.
end_row : (int)(optional) End row to delete (optional — Assumes start_row value).
Returns: Void.
table_delete_column(table_object, table_row_size, start_column, end_column) Delete specified columns from table.
Parameters:
table_object : (table) table object to be changed.
table_row_size : (int) Table rows max size.
start_column : (int) Start column to delete.
end_column : (int)(optional) End column to delete (optional — Assumes start_column value).
Returns: Void.
array_to_table_column_auto(column_to_insert, array_to_insert, table_id) Insert string array to table column without passing table object.
Parameters:
column_to_insert : (int) Column to be inserted.
array_to_insert : (string array) Start column to delete.
table_id : (int)(optional) Number of the ID of the table.
Returns: Void.
array_to_table_row_auto(row_to_insert, array_to_insert, table_id) Insert string array to table row without passing table object.
Parameters:
row_to_insert : (int) Column to be inserted.
array_to_insert : (string array) Start column to delete.
table_id : (int)(optional) Number of the ID of the table.
Returns: Void.
array_to_table_row(table_object, row_to_insert, array_to_insert) Insert string array to table row by passing table object.
Parameters:
table_object : (table) table object to be changed.
row_to_insert : (int) Row to be inserted.
array_to_insert : (string array) Start column to delete.
Returns: Void.
array_to_table_column(table_object, column_to_insert, array_to_insert) Insert string array to table column by passing table object.
Parameters:
table_object : (table) table object to be changed.
column_to_insert : (int) Column to be inserted.
array_to_insert : (string array) Start column to delete.
Returns: Void.
blink_cell(cell_column, cell_row, c_color, blink_interval_ms, table_id) Changes cell color at set intervals (blink).
Parameters:
cell_column : (int) Cell column position.
cell_row : (int) Cell row position.
c_color : (color) Color to blink.
blink_interval_ms : (int)(opt) Interval in milliseconds.
table_id : (int)(opt) Table ID number.
change_table_style(table_object, number_of_columns, number_of_rows, color) Changes table pre-style by selecting a pre-style number.
Parameters:
table_object : (table) table object to be changed.
number_of_columns : (int) Table column size.
number_of_rows : (int) Table row size.
color : 1 (color) Color of .
Returns: Void.
create_table_clean(n_of_columns, n_of_rows, position) Create a simple(blank) table without any styling.
Parameters:
n_of_columns : (int) Numbers of columns in the table.
n_of_rows : (int) Number of rows in the table.
position : (string) table position.
Returns: table object.
create_table_with_style(n_of_columns, n_of_rows, style_number, position) Create table with a pre-set style.
Parameters:
n_of_columns : (int) Numbers of columns in the table.
n_of_rows : (int) Number of rows in the table.
style_number : (int) Style number.
position : (string) table position.
Returns: table object.
json_to_table(raw_json) Create table based on input raw json string.
Parameters:
raw_json : (int) Raw json string.
Returns: table object.
json_example() Example function that display a table based on a json
example_create_table()
Logger Library For Pinescript (Logging and Debugging)Library "LoggerLib"
This is a logging library for Pinescript. It is aimed to help developers testing and debugging scripts with a simple to use logger function.
Pinescript lacks a native logging implementation. This library would be helpful to mitigate this insufficiency.
This library uses table to print outputs into its view. It is simple, customizable and robust.
You can start using it's .log() method just like any other logging method in other languages.
//////////////////
USAGE
//////////////////
-- Recommended: Please Read The Documentation From Source Code Below. It Is Much More Readable There And Will Be Updated Along With Newer Versions. --
Importing the Library
---------------------
import paragjyoti2012/LoggerLib/ as Logger
.init() : Initializes the library and returns the logger pointer. (Later will be used as a function parameter)
.initTable: Initializes the Table View for the Logger and returns the table id. (Later will be used as a function parameter)
parameters:
logger: The logger pointer got from .init()
max_rows_count: Number of Rows to display in the Logger Table (default is 10)
offset: The offset value for the rows (Used for scrolling the view)
position: Position of the Table View
Values could be:
left
right
top-right
(default is left)
size: Font Size of content
Values could be:
small
normal
large
(default is small)
hide_date: Whether to hide the Date/Time column in the Logger (default is false)
returns: Table
example usage of .initTable()
import paragjyoti2012/LoggerLib/1 as Logger
var logger=Logger.init()
var logTable=Logger.initTable(logger, max_rows_count=20, offset=0, position="top-right")
-------------------
LOGGING
-------------------
.log() : Logging Method
params: (string message, |string| logger, table table_id, string type="message")
logger: pass the logger pointer from .init()
table_id: pass the table pointer from .initTable()
message: The message to log
type: Type of the log message
Values could be:
message
warning
error
info
success
(default is message)
returns: void
///////////////////////////////////////
Full Boilerplate For Using In Indicator
///////////////////////////////////////
P.S: Change the | (pipe) character into square brackets while using in script (or copy it from the source code instead)
offset=input.int(0,"Offset",minval=0)
size=input.string("small","Font Size",options=|"normal","small","large"|)
rows=input.int(15,"No Of Rows")
position=input.string("left","Position",options=|"left","right","top-right"|)
hide_date=input.bool(false,"Hide Time")
import paragjyoti2012/LoggerLib/1 as Logger
var logger=Logger.init()
var logTable=Logger.initTable(logger,rows,offset,position,size,hide_date)
rsi=ta.rsi(close,14)
|macd,signal,hist|=ta.macd(close,12,26,9)
if(ta.crossunder(close,34000))
Logger.log("Dropped Below 34000",logger,logTable,"warning")
if(ta.crossunder(close,35000))
Logger.log("Dropped Below 35000",logger,logTable)
if(ta.crossover(close,38000))
Logger.log("Crossed 38000",logger,logTable,"info")
if(ta.crossunder(rsi,20))
Logger.log("RSI Below 20",logger,logTable,"error")
if(ta.crossover(macd,signal))
Logger.log("Macd Crossed Over Signal",logger,logTable)
if(ta.crossover(rsi,80))
Logger.log("RSI Above 80",logger,logTable,"success")
////////////////////////////
// For Scrolling the Table View
////////////////////////////
There is a subtle way of achieving nice scrolling behaviour for the Table view. Open the input properties panel for the table/indicator. Focus on the input field for "Offset", once it's focused, you could use your mouse scroll wheel to increment/decrement the offset values; It will smoothly scroll the Logger Table Rows as well.
/////////////////////
For any assistance using this library or reporting issues, please write in the comment section below.
I will try my best to guide you and update the library. Thanks :)
/////////////////////
CRCPaintLibrary "CRCPaint"
black(trans)
Parameters:
trans : Transparency value (float)
Returns: color
-------------------------------------------------------------------------- //
white()
silver()
gray()
fuchsia()
maroon()
red()
orange()
yellow()
blue()
navy()
aqua()
purple()
teal()
green()
lime()
olive()
malachite()
fern()
feldgrau()
skobeloff()
viridian()
violet()
denim()
saphhire()
cyan()
auburn()
pink()
tawny()
rust()
goldenrod()
mahogany()
boysenberry()
mauve()
cosmos()
sepia()
jazzberry()
wenge()
idx_mix()
idx_mix_size()
transparent()
rgb()
shade_mint()
shade_blush()
random()
AwesomeColorLibrary "AwesomeColor"
This library provides a variety of colors.
The following functions all provide different sets of colors.
The name of the function indicates the color scheme.
The usage of arguments for all functions is the same.
// @function {Color set name}
// @param _color TODO: The name of the color group.
// @returns TODO: Returns an array of colors.
TableColorThemeLibrary "TableColorTheme"
TODO: This library provides the color for the table.
monokai(name) theme: Provides the colors of monokai.
Parameters:
name : TODO: The name of the color group.
Returns: TODO: Returns an array of colors.
kolormark.com
monokaipro(name) theme: Provides the colors of monokai pro.
Parameters:
name : TODO: The name of the color group.
Returns: TODO: Returns an array of colors.
theme(name) theme This function provides the color for the table.
Parameters:
name : TODO: The name of the color group.
Returns: TODO: Returns an array of colors.
arsenalLibrary "arsenal"
This library is a collection of weapons that will help us win the war against the market.
isNewbar(res, timezone) Checks if the res is in new bar at the current timeframe
Parameters:
res : - resolution of the bar to check if new
timezone : - timezone of the resolution
Returns: ch: - 1=true, 0=false