Session Bar/Candle ColoringChange the color of candles within a user-defined trading session.  Borders and wicks can be changed as well, not just the body color.
 PREFACE 
This script can be used an educational resource for those who are interested in learning Pine Script.  Therefore, the script is published open source and is organized in a manner that follows the recommended  Style Guide .
While the main premise of the indicator is rather simple, the script showcases various things that can be achieved such as conditional plotting, alignment of indicator settings, user input validation, script optimization, and more.  The script also has examples of taking into consideration the chart timeframe and/or different chart types (Heikin Ashi, Renko, etc.) that a user might be running it on.  Note: for complete beginners, I strongly suggest going through the  Pine Script User Manual  (possibly more than once).
 FEATURES 
Besides being able to select a specific time window, the indicator also provides additional color settings for changing the background color or changing the colors of neutral/indecisive candles, as shown in the image below.
  
This allows for a higher level of customization beyond the TradingView chart settings or other similar scripts that are currently available.
 HOW TO USE 
 
  First, define the intraday trading session that will contain the candles to modify.  The session can be limited to specific days of the week.
  Next, select the parts of the candles that should be modified: Body, Borders, Wick, and/or Background.
  For each of the candle parts that were enabled, you can select the colors that will be used depending on whether a candle is bullish (⇧), bearish (⇩), or neutral (⇆).
 
All other indicator settings will have a detailed tooltip to describe its usage and/or effect.
 LIMITATIONS 
 
  The indicator is not intended to function on Daily or higher timeframes due to the intraday nature of session time windows.
  The indicator cannot always automatically detect the chart type being used, therefore the user is requested to manually input the chart type via the " Chart Style " setting.
  Depending on the available historical data and the selected choice for the " Portion of bar in session " setting, the indicator may not be able to update very old candles on the chart.
 
 EXAMPLE USAGE 
This section will show examples of different scenarios that the indicator can be used for.
  
Emphasizing a main trading session.
  
Defining a "Pre/post market hours background" like is available for some symbols (e.g.,  NASDAQ:AAPL ).
  
Highlighting in which bar the midnight candle occurs.
  
Hiding indecision bars (neutral candles).
  
Showing only "Regular Trading Hours" for a chart that does not have the option to toggle ETH/RTH.  To achieve this, the actual chart data is hidden, and only the indicator is visible; alternatively, a 2nd instance of the indicator could change colors to match the chart background.
  
Using a combination of Bars and Japanese Candlesticks.  Alternatively, this could be done by hiding the main chart data and using 2 instances of the indicator (one with " Chart Style " setting as  Bars , and the other set to  Candles ).
  
Using a combination of thin and thick bars on  Range  charts.  Note: requires disabling the "Thin Bars" setting for  Bar  charts in the TradingView chart settings.
 NOTES 
 
  If using more than one instance of this indicator on the same chart, you can use the TradingView "Save Indicator Template" feature to avoid having to re-configure the multiple indicators at a later time.
  This indicator is intended to work "out-of-the-box" thanks to the  behind_chart  option introduced to Pine Script in October 2024.  But you can always manually bring the indicator to the front just in case the color changes are not being seen (using the "More" option in the indicator status line:  More  >  Visual Order  >  Bring to front ).
  Many thanks to  fikira  for their help and inspiring me to create open source scripts.
  Any feedback including bug reports or suggestions for improving the indicator (or source code itself) are always welcome in the comments section.
Colorscheme
Material Design ColorsThis library provides a standard set of colors defined in Material Design 2.0.
🔵 API
Step 1: Import this library.
 
import algotraderdev/material/1
// remember to check the latest version of this library and replace the 1 above.
 
Step 2: Get the color you like. Check the source code or the screenshot above to see all the supported colors.
 
material.red()
 
Each color function (except for `black()` and `white()`) accepts an optional `variant` parameter. You can choose any of 50, 100, 200, 300, 400, 500, 600, 700, 800, and 900. By default, 500 is chosen if this parameter is not provided.
DarkWaveColorThemesLibrary   "DarkWaveColorThemes" 
 Description: 
A simple, binary color-theming library that provides you with easy-access 'bullish and bearish' colors which you can use to make your indicators more aesthetically pleasing. These color themes were developed to help the community make indicators look excellent with ease.
 Functions: 
 1. getThemeColor(themeName, colorType) 
 Description: 
This function returns a color (either a 'Bullish' or 'Bearish' color, depending on your 'colorType' parameter input) according to the theme you have supplied as the 'themeName' parameter.
 Parameters: 
 
   themeName (string) : Specify the theme you want to reference. Options include: 'DarkWave', 'Synthwave', 'DarkWave Crypto', 'Crystal Pool', 'Aquafarer', 'Mystic Armor', 'Futurist', 'Electric Zest', 'Stealth Ride', 'Long Trader', 'Short Trader', 'Emerald Glow', 'Gold Heist', 'Floral', 'Cobalt Twilight', and 'Sunrise'.
   colorType (string) : Specify which color you want to reference from the theme. Options include: 'Bullish' and 'Bearish'.
 Returns:  
Your specified color type according to your specified theme.
UtilsLibrary   "Utils" 
Utility functions. Mathematics, colors, and auxiliary algorithms.
 setTheme(vc, theme) 
  Set theme for levels (predefined colors).
  Parameters:
     vc : (valueColorSpectrum) Object to associate a color with a value, taking into account the previous value and its levels.
     theme : (int) Theme (predefined colors). 
0 = 'User defined'
1 = 'Spectrum Blue-Green-Red'
2 = 'Monokai'
3 = 'Green'
4 = 'Purple'
5 = 'Blue'
6 = 'Red'
  Returns: (void)
 setTheme(vc, colorLevel_Lv1, colorLevel_Lv1_Lv2, colorLevel_Lv2_Lv3, colorLevel_Lv3_Lv4, colorLevel_Lv4_Lv5, colorLevel_Lv5) 
  Set theme for levels (customized colors).
  Parameters:
     vc : (valueColorSpectrum) Object to associate a color with a value, taking into account the previous value and its levels
     colorLevel_Lv1 : (color) Color associeted with value when below Level 1.
     colorLevel_Lv1_Lv2 : (color) Color associeted with value when between Level 1 and 2.
     colorLevel_Lv2_Lv3 : (color) Color associeted with value when between Level 2 and 3.
     colorLevel_Lv3_Lv4 : (color) Color associeted with value when between Level 3 and 4.
     colorLevel_Lv4_Lv5 : (color) Color associeted with value when between Level 4 and 5.
     colorLevel_Lv5 : (color) Color associeted with value when above Level 5.
  Returns: (void)
 setCurrentColorValue(vc) 
  Set color to a current value, taking into account the previous value and its levels
  Parameters:
     vc : (valueColorSpectrum) Object to associate a color with a value, taking into account the previous value and its levels
  Returns: (void)
 setCurrentColorValue(vc, gradient) 
  Set color to a current value, taking into account the previous value.
  Parameters:
     vc : (valueColor) Object to associate a color with a value, taking into account the previous value
     gradient 
  Returns: (void)
 setCustomLevels(vc, level1, level2, level3, level4, level5) 
  Set boundaries for custom levels.
  Parameters:
     vc : (valueColorSpectrum) Object to associate a color with a value, taking into account the previous value and its levels
     level1 : (float) Boundary for level 1
     level2 : (float) Boundary for level 2
     level3 : (float) Boundary for level 3
     level4 : (float) Boundary for level 4 
     level5 : (float) Boundary for level 5
  Returns: (void)
 getPeriodicColor(originalColor, density) 
  Returns a periodic color. Useful for creating dotted lines for example.
  Parameters:
     originalColor : (color) Original color.
     density : (float) Density of color. Expression used in modulo to obtain the integer remainder.
If the remainder equals zero, the color appears, otherwise it remains hidden.
  Returns: (color) Periodic color.
 dinamicZone(source, sampleLength, pcntAbove, pcntBelow) 
  Get Dynamic Zones
  Parameters:
     source : (float) Source
     sampleLength : (int) Sample Length
     pcntAbove : (float) Calculates the top of the dynamic zone, considering that the maximum values are above x% of the sample
     pcntBelow : (float) Calculates the bottom of the dynamic zone, considering that the minimum values are below x% of the sample
  Returns:   A tuple with 3 series of values: (1) Upper Line of Dynamic Zone; 
(2) Lower Line of Dynamic Zone; (3) Center of Dynamic Zone (x = 50%)
 valueColorSpectrum 
  # Object to associate a color with a value, taking into account the previous value and its levels.
  Fields:
     currentValue 
     previousValue 
     level1 
     level2 
     level3 
     level4 
     level5 
     currentColorValue 
     colorLevel_Lv1 
     colorLevel_Lv1_Lv2 
     colorLevel_Lv2_Lv3 
     colorLevel_Lv3_Lv4 
     colorLevel_Lv4_Lv5 
     colorLevel_Lv5 
     theme 
 valueColor 
  # Object to associate a color with a value, taking into account the previous value
  Fields:
     currentValue 
     previousValue 
     currentColorValue 
     colorUp 
     colorDown
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
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
Donchian Range, RSI, and Levels SystemThe Donchian average is defined as average(highest, lowest) for a given period length. By plotting many different lengths, clustering of the lines seems to form natural support/resistance levels. A Donchian Channel and RSI rainbow colors are also provided to define the range and trend.
Standard Deviation Candles (With Emoji)In crypto, significant price moves can be a sign of continuation or reversal. This script measures if price move is greater than a certain number of standard deviations vs. previous periods, then alters bar colours and/or prints an emoji signal.
RSI CrayonsThis simple script colors candles based on the Relative Strength Index. RSI Values > 50 are solid colors, RSI values < 50 are pastels, with additional colors/fills/alerts for overheated and oversold (both user adjustable thresholds) conditions. 
As an added bonus, RSI can be calculated by non-traditional methods (not using the running/smoothed moving average) using a variety of different moving averages, but you may have to adjust the time-frame for 'faster' moving averages. An option for plotting the moving average basis is also available.
 Value Added: 
 
 This indicator can be used to chart RSI without adding an "oscillator frame" to your chart, since we don't normally care too much about RSI values between 30 and 70 under normal conditions.
RK's Framework 01 - Auto Color GradientThis started as a personal arrays study, but after a few tests I decided to made a framework to get my own scripts simplest, lighter and faster.
And now I'm sharing with you guys.
Is very simple to use:
 
  Copy evething inside "RK's Auto Color Gradient Framework" block;
   Paste anywhere before the plotting;
   Declare the color variable name calling the function "f_autocolor(___, ___)" with the source you gonna plot and the size of the scale do you want to use to compare the data.
 
Feel free to use.
Hope brings some profits for you guys!!
RK's 04 - Lots of MA Types RibbonHello again,
I made this script to test what is the better Moving Average type to predict the market direction, so I put a function with All the MA I know.
To go beyond, this script have an option to increase the MA length as a Fibonacci Number or any other simple number to step.
If the drawing is too slow, just reduce the amount of MA lines in the input option ("Number of MA to Plot:") to 10 or less and it will be faster.
Hope you like, and if you know other Moving Average type, just tell me how can I get the formula and (if its good, not copyrighted and I have time) I can add here and update for all of us.
Obs: To avoid errors, the Maximum Nth Fibonacci Term to use in MA Length is 19 (4181)
RSI & Volume Coloured BarsCandles get darker when volume is high, and brighter when volume is low. They are red or green depending on whether the RSI is above or below a threshold value, or alternatively you can pick a more vanilla coloring based on current close vs last close or last open.
For personal use as I enjoy the aesthetics of it. The more solid RSI coloring helps highlight the brightness variations from changing volume and makes trends crystal clear.
Inspired by "Volume Based Coloured Bars" by KivancOzbilgic:
and by and by RSI bars chart by taskman9:
 
Line & Label RGB Color Editor [DW]This script is a template designed to provide developers with UI color customization for v4 lines and labels.
The color pallete used within this script is a full spectrum "web safe" format with 216 colors to choose from.
Colors are easily modified via the RGB inputs. The designated color selector function takes in the RGB values and returns the corresponding hex color.
Transparency can be modified as well. However, the color.new function only supports constant integers for transparency value, so it has to be manually adjusted within the code.
On line 42, you'll see a variable within the color selector function named trans. This is the transparency value, which can be set to any integer from 0 to 100. I have it set to 0 by default.
I included a sample label to demonstrate how the color editor works. It also displays the hex codes for the current label and text colors for some additional reference.
Implementing this in your own script is pretty straightforward.
All you need to do is copy the color selector function and inputs (feel free to name them whatever you want) into your desired script. Then, you can use them to declare your color variables.












