7AM + 12AM ET MarkersShows 12AM and 7AM EST Markers on your chart. You are able to change colors of the 7AM marker and line style type. Great to see when the next day starts and when the market opens!
Indicatori e strategie
Double Bottom Strategy (Long Only, ATR Trailing Stop + Alerts)Updated chart script:
This script implements a long-only breakout strategy based on the recognition of a Double Bottom price pattern, enhanced with a 50 EMA trend filter and a dynamic ATR-based trailing stop. It is suitable for traders looking to capture reversals in trending markets using a structured pattern-based entry system.
🧠 Key Features:
Double Bottom Detection: Identifies double bottom structures using pivot lows with configurable tolerance.
ATR-Based Trailing Stop: Manages exits using a trailing stop calculated from Average True Range (ATR), dynamically adjusting to market volatility.
EMA Filter (Optional): Filters trades to only go long when price is above the 50 EMA (trend confirmation).
Alerts: Real-time alerts on entry and exit, formatted in JSON for webhook compatibility.
Backtest Range Controls: Customize historical testing period with start and end dates.
✅ Recommended Markets:
Gold (XAUUSD)
S&P 500 (SPX, ES)
Nasdaq (NDX, NQ)
Stocks (Equities)
⚠️ Not recommended for Forex due to differing behavior and noise levels in currency markets.
🛠️ User Guidance:
Tune the pivot period, tolerance, and ATR settings for best performance on your chosen asset.
Backtest thoroughly over your selected date range to assess historical effectiveness.
Use small position sizes initially to test viability in live or simulated environments.
S4_IBS_Mean_Rev_3candleExitOverview:
This is a rules-based, mean reversion strategy designed to trade pullbacks using the Internal Bar Strength (IBS) indicator. The system looks for oversold conditions based on IBS, then enters long trades , holding for a maximum of 3 bars or until the trade becomes profitable.
The strategy includes:
✅ Strict entry rules based on IBS
✅ Hardcoded exit conditions for risk management
✅ A clean visual table summarizing key performance metrics
How It Works:
1. Internal Bar Strength (IBS) Setup:
The IBS is calculated using the previous bar’s price range:
IBS = (Previous Close - Previous Low) / (Previous High - Previous Low)
IBS values closer to 0 indicate price is near the bottom of the previous range, suggesting oversold conditions.
2. Entry Conditions:
IBS must be ≤ 0.25, signaling an oversold setup.
Trade entries are only allowed within a user-defined backtest window (default: 2024).
Only one trade at a time is permitted (long-only strategy).
3. Exit Conditions:
If the price closes higher than the entry price, the trade exits with a profit.
If the trade has been open for 3 bars without showing profit, the trade is forcefully exited.
All trades are closed automatically at the end of the backtest window if still open.
Additional Features:
📊 A real-time performance metrics table is displayed on the chart, showing:
- Total trades
- % of profitable trades
- Total P&L
- Profit Factor
- Max Drawdown
- Best/Worst trade performance
📈 Visual markers indicate trade entries (green triangle) and exits (red triangle) for easy chart interpretation.
Who Is This For?
This strategy is designed for:
✅ Traders exploring systematic mean reversion approaches
✅ Those who prefer strict, rules-based setups with no subjective decision-making
✅ Traders who want built-in performance tracking directly on the chart
Note: This strategy is provided for educational and research purposes. It is a backtested model and past performance does not guarantee future results. Users should paper trade and validate performance before considering real capital.
Niveaux Dealers + Previous M W D📊 TradingView Script – Dealers Levels & Previous D/W/M
First SR
🔹 General Purpose:
This advanced script provides a clear view of key market levels used by professional traders for scalping, day trading, and technical analysis. It combines manual levels (Dealer) set by the user with automated levels based on the previous day, week, and month’s highs and lows.
⸻
🧩 1. Dealers Levels Module (Manual)
✅ Features:
• Displays 28 customizable levels, grouped into 4 categories:
• Maxima: Buyer Control, Max Day, Max Event, Max Extreme
• Minima: Seller Control, Min Day, Min Event, Min Extreme
• Call Resistance: 10 user-defined levels
• Pull Support: 10 user-defined levels
🎨 Customization:
• Each level’s value is manually entered
• Line color, style, and thickness can be customized
• Display includes transparent labels with a clean design
🔧 Options:
• Line extension configurable:
• To the left: from 1 to 499 bars
• To the right: from 1 to 100 bars
• Label display can be toggled on/off
⸻
🧩 2. Previous Daily / Weekly / Monthly Levels Module (Automatic)
✅ Features:
• Automatically detects and plots:
• Previous Daily High / Low
• Previous Weekly High / Low
• Previous Monthly High / Low
🎯 Technical Details:
• Accurate calculation based on closed periods
• Dynamically extended lines (past and future projection)
• Labels aligned with the right-hand extension of each line
🎨 Customization:
• Each level has configurable color, line style, and thickness
• Labels use rectangle style with transparent background
⸻
⚙ Global Script Settings:
• Toggle display of labels (✔/❌)
• Configurable left extension (1–499) and right extension (1–100)
• Settings panel organized into groups for clarity and ease of use
⸻
💡 Usefulness:
This script provides traders with a precise map of price reaction zones, combining fixed institutional zones (Dealer levels) with dynamic historical levels (D/W/M). It’s ideal for intraday strategies on indices (e.g., Nasdaq), crypto, or forex markets.
Niveaux Dealers + Previous M W D📊 TradingView Script – Dealers Levels & Previous D/W/M
🔹 General Purpose:
This advanced script provides a clear view of key market levels used by professional traders for scalping, day trading, and technical analysis. It combines manual levels (Dealer) set by the user with automated levels based on the previous day, week, and month’s highs and lows.
⸻
🧩 1. Dealers Levels Module (Manual)
✅ Features:
• Displays 28 customizable levels, grouped into 4 categories:
• Maxima: Buyer Control, Max Day, Max Event, Max Extreme
• Minima: Seller Control, Min Day, Min Event, Min Extreme
• Call Resistance: 10 user-defined levels
• Pull Support: 10 user-defined levels
🎨 Customization:
• Each level’s value is manually entered
• Line color, style, and thickness can be customized
• Display includes transparent labels with a clean design
🔧 Options:
• Line extension configurable:
• To the left: from 1 to 499 bars
• To the right: from 1 to 100 bars
• Label display can be toggled on/off
⸻
🧩 2. Previous Daily / Weekly / Monthly Levels Module (Automatic)
✅ Features:
• Automatically detects and plots:
• Previous Daily High / Low
• Previous Weekly High / Low
• Previous Monthly High / Low
🎯 Technical Details:
• Accurate calculation based on closed periods
• Dynamically extended lines (past and future projection)
• Labels aligned with the right-hand extension of each line
🎨 Customization:
• Each level has configurable color, line style, and thickness
• Labels use rectangle style with transparent background
⸻
⚙ Global Script Settings:
• Toggle display of labels (✔/❌)
• Configurable left extension (1–499) and right extension (1–100)
• Settings panel organized into groups for clarity and ease of use
⸻
💡 Usefulness:
This script provides traders with a precise map of price reaction zones, combining fixed institutional zones (Dealer levels) with dynamic historical levels (D/W/M). It’s ideal for intraday strategies on indices (e.g., Nasdaq), crypto, or forex markets.
ZY Return ZonesThe ZY Return Zones indicator automatically draws the potential support/resistance levels of the parity and clearly displays them on the chart. Although the default settings are the last support/resistance levels, users can change the settings to show the last 6 support/resistance points in the indicator settings.
ZY Legend StrategyThe ZY Legend Strategy indicator is a trading indicator and clearly shows the buy/sell zones on the chart. In this indicator, which does not have an SL order, transaction entries should be made at the cash/8 rate for each signal, and when a transaction that hedges this transaction is opened while the main transaction is open and this hedge transaction becomes TP, the profit obtained from the hedge transaction should be deducted from the TP target of the main transaction.
5 MAsTitle: 5 MAs — Key Moving Averages + 2h Trend Filter
Description:
This indicator plots five essential moving averages used for identifying market structure, momentum shifts, and trend confirmation across multiple timeframes. It’s designed for traders who blend intraday price action with higher-timeframe context.
Included Averages:
200 SMA (red): Long-term trend direction and dynamic support/resistance.
50 SMA (blue): Medium-term trend guide, often used for pullbacks or structure shifts.
21 EMA (purple): Shorter-term momentum guide — commonly used in trending strategies.
10 EMA (green): Fast momentum line for scalping, intraday setups, or crossover signals.
2h 20 EMA (orange): Higher-timeframe trend filter pulled from the 2-hour chart — adds confluence when trading lower timeframes (e.g., 5m, 15m).
How to Use:
Use the alignment of these MAs to confirm market bias (e.g., all pointing up = strong bullish structure).
Watch for crossovers, price interaction, or dynamic support/resistance at key levels.
The 2h 20 EMA adds a higher timeframe filter to avoid counter-trend trades and spot reversals early.
Best Used For:
Scalping, intraday trading, swing entries, or trend-following systems.
Consecutive Candle Box with Horizontal LinesWhen one or more candles are formed in a row, a box is formed. And when the top or bottom of the box is passed and a reversal candle is formed, the box is erased. If you use this box to make long and short trades, you can enter and take profit with a very high probability. This box can be very useful in finding an pivot point at the bottom or the bottom. I hope it will be of great help to you in short-term trading.
Bullish/Bearish Close AlertThis will help you alert when a candle close bullish or bearish no matter what
PulseWave + DivergenceOverview
PulseWave + Divergence is a momentum oscillator designed to optimize the classic RSI. Unlike traditional RSI, which can produce delayed or noisy signals, PulseWave offers a smoother and faster oscillator line that better responds to changes in market dynamics. By using a formula based on the difference between RSI and its moving average, the indicator generates fewer false signals, making it a suitable tool for day traders and swing traders in stock, forex, and cryptocurrency markets.
How It Works
Generating the Oscillator Line
The PulseWave oscillator line is calculated as follows:
RSI is calculated based on the selected data source (default: close price) and RSI length (default: 20 periods).
RSI is smoothed using a simple moving average (MA) with a selected length (default: 20 periods).
The oscillator value is the difference between the current RSI and its moving average: oscillator = RSI - MA(RSI).
This approach ensures high responsiveness to short-term momentum changes while reducing market noise. Unlike other oscillators, such as standard RSI or MACD, which rely on direct price values or more complex formulas, PulseWave focuses on the dynamics of the difference between RSI and its moving average. This allows it to better capture short-term trend changes while minimizing the impact of random price fluctuations. The oscillator line fluctuates around zero, making it easy to identify bullish trends (positive values) and bearish trends (negative values).
Divergences
The indicator optionally detects bullish and bearish divergences by comparing price extremes (swing highs/lows) with oscillator extremes within a defined pivot window (default: 5 candles left and right). Divergences are marked with "Bull" (bullish) and "Bear" (bearish) labels on the oscillator chart.
Signals
Depending on the selected signal type, PulseWave generates buy and sell signals based on:
Crosses of the overbought and oversold levels.
Crosses of the oscillator’s zero line.
A combination of both (option "Both").
Signals are displayed as triangles above or below the oscillator, making them easy to identify.
Input Parameters
RSI Length: Length of the RSI used in calculations (default: 20).
RSI MA Length: Length of the RSI moving average (default: 20).
Overbought/Oversold Level: Oscillator overbought and oversold levels (default: 12.0 and -12.0).
Pivot Length: Number of candles used to detect extremes for divergences (default: 5).
Signal Type: Type of signals to display ("Overbought/Oversold", "Zero Line", "Both", or "None").
Colors and Gradients: Full customization of line, gradient, and label colors.
How to Use
Adjust Parameters:
Increase RSI Length (e.g., to 30) for high-volatility markets to reduce noise.
Decrease Pivot Length (e.g., to 3) for faster divergence detection on short timeframes.
Interpret Signals:
Buy Signal: The oscillator crosses above the oversold level or zero line, especially with a bullish divergence.
Sell Signal: The oscillator crosses below the overbought level or zero line, especially with a bearish divergence.
Combine with Other Tools:
Use PulseWave alongside moving averages or support/resistance levels to confirm signals.
Monitor Divergences:
"Bull" and "Bear" labels indicate potential trend reversals. Set up alerts to receive notifications for divergences.
Check OAS of EMAsThis script checks the Optimal Alignment and Slope of the EMA's and prints a label if it finds one.
🔍 1. Optimal Alignment
This refers to the order of EMAs on the chart, which should reflect the trend.
In an uptrend, the alignment might be:
10 EMA above 20 EMA above 50 EMA
In a downtrend:
10 EMA below 20 EMA below 50 EMA
This "stacked" alignment confirms trend strength and direction.
📈 2. Slope
The angle or slope of the EMAs shows momentum.
A steep upward slope = strong bullish momentum.
A steep downward slope = strong bearish momentum.
Flat or sideways slope = weak or no trend (ranging market).
Buy Signal Above 1/3 Candle1 hr candle buy on engulfing candle, basically sends buy signals if 1hr candle closes above 1/3 of its size
Gold Mini Strategy: EMA | RSI | MACD | VWAP | BB | PAGood Script to view all the important indicator into one
Gann Support and Resistance LevelsThis indicator plots dynamic Gann Degree Levels as potential support and resistance zones around the current market price. You can fully customize the Gann degree step (e.g., 45°, 30°, 90°), the number of levels above and below the price, and the price movement per degree to fine-tune the levels to your strategy.
Key Features:
✅ Dynamic levels update automatically with the live price
✅ Adjustable degree intervals (Gann steps)
✅ User control over how many levels to display above and below
✅ Fully customizable label size, label color, and text color for mobile-friendly visibility
✅ Clean visual design for easy chart analysis
How to Use:
Gann levels can act as potential support and resistance zones.
Watch for price reactions at major degrees like 0°, 90°, 180°, and 270°.
Can be combined with other technical tools like price action, trendlines, or Gann fans for deeper analysis.
📌 This tool is perfect for traders using Gann theory, grid-based strategies, or those looking to enhance their visual trading setups with structured levels.
Step Channel Momentum Trend [ChartPrime]OVERVIEW
Step Channel Momentum Trend is a momentum-based price filtering system that adapts to market structure using pivot levels and ATR volatility. It builds a dynamic channel around a stepwise midline derived from swing highs and lows. The system colors price candles based on whether price remains inside this channel (low momentum) or breaks out (strong directional flow). This allows traders to clearly distinguish ranging conditions from trending ones and take action accordingly.
⯁ STRUCTURAL MIDLNE (STEP CHANNEL CORE)
The midline acts as the backbone of the trend system and is based on structure rather than smoothing.
Calculated as the average of the most recent confirmed Pivot High and Pivot Low.
The result is a step-like horizontal line that only updates when new pivot points are confirmed.
This design avoids lag and makes the line "snap" to recent structural shifts.
It reflects the equilibrium level between recent bullish and bearish control.
This unique step logic creates clear regime shifts and prevents noise from distorting trend interpretation.
⯁ DYNAMIC VOLATILITY BANDS (ATR FILTERING)
To detect momentum strength, the script constructs upper and lower bands using the ATR (Average True Range):
The distance from the midline is determined by ATR × multiplier (default: 200-period ATR × 0.6).
These bands adjust dynamically to volatility, expanding in high-ATR environments and contracting in calm markets.
The area between upper and lower bands represents a neutral or ranging market state.
Breakouts outside the bands are treated as significant momentum shifts.
This filtering approach ensures that only meaningful breakouts are visually emphasized — not every candle fluctuation.
⯁ MOMENTUM-BASED CANDLE COLORING
The system visually transforms price candles into momentum indicators:
When price (hl2) is above the upper band, candles are green → bullish momentum.
When price is below the lower band, candles are red → bearish momentum.
When price is between the bands, candles are orange → low or no momentum (range).
The candle body, wick, and border are all colored uniformly for visual clarity.
This gives traders instant feedback on when momentum is expanding or fading — ideal for breakout, pullback, or trend-following strategies.
⯁ PIVOT-BASED SWING ANCHORS
Each confirmed pivot is plotted as a label ⬥ directly on the chart:
They also serve as potential manual entry zones, SL/TP anchors, or confirmation points.
⯁ MOMENTUM STATE LABEL
To reinforce the current market mode, a live label is displayed at the most recent candle:
Displays either:
“ Momentum Up ” when price breaks above the upper band.
“ Momentum Down ” when price breaks below the lower band.
“ Range ” when price remains between the bands.
Label color matches the candle color for quick identification.
Automatically updates on each bar close.
This helps discretionary traders filter trades based on market phase.
USAGE
Use the green/red zones to enter with momentum and ride trending moves.
Use the orange zone to stay out or fade ranges.
The step midline can act as a breakout base, pullback anchor, or bias reference.
Combine with other indicators (e.g., order blocks, divergences, or volume) to build high-confluence systems.
CONCLUSION
Step Channel Momentum Trend gives traders a clean, adaptive framework for identifying trend direction, volatility-based breakouts, and ranging environments — all from structural logic and ATR responsiveness. Its stepwise midline provides clarity, while its dynamic color-coded candles make momentum shifts impossible to miss. Whether you’re scalping intraday momentum or managing swing entries, this tool helps you trade with the market’s rhythm — not against it.
Z Score Overlay [BigBeluga]🔵 OVERVIEW
A clean and effective Z-score overlay that visually tracks how far price deviates from its moving average. By standardizing price movements, this tool helps traders understand when price is statistically extended or compressed—up to ±4 standard deviations. The built-in scale and real-time bin markers offer immediate context on where price stands in relation to its recent mean.
🔵 CONCEPTS
Z Score Calculation:
Z = (Close − SMA) ÷ Standard Deviation
This formula shows how many standard deviations the current price is from its mean.
Statistical Extremes:
• Z > +2 or Z < −2 suggests statistically significant deviation.
• Z near 0 implies price is close to its average.
Standardization of Price Behavior: Makes it easier to compare volatility and overextension across timeframes and assets.
🔵 FEATURES
Colored Z Line: Gradient coloring based on how far price deviates—
• Red = oversold (−4),
• Green = overbought (+4),
• Yellow = neutral (~0).
Deviation Scale Bar: A vertical scale from −4 to +4 standard deviations plotted to the right of price.
Active Z Score Bin: Highlights the current Z-score bin with a “◀” arrow
Context Labels: Clear numeric labels for each Z-level from −4 to +4 along the side.
Live Value Display: Shows exact Z-score on the active level.
Non-intrusive Overlay: Can be applied directly to price chart without changing scaling behavior.
🔵 HOW TO USE
Identify overbought/oversold areas based on +2 / −2 thresholds.
Spot potential mean reversion trades when Z returns from extreme levels.
Confirm strong trends when price remains consistently outside ±2.
Use in multi-timeframe setups to compare strength across contexts.
🔵 CONCLUSION
Z Score Overlay transforms raw price action into a normalized statistical view, allowing traders to easily assess deviation strength and mean-reversion potential. The intuitive scale and color-coded display make it ideal for traders seeking objective, volatility-aware entries and exits.
Color█ OVERVIEW
This library is a Pine Script® programming tool for advanced color processing. It provides a comprehensive set of functions for specifying and analyzing colors in various color spaces, mixing and manipulating colors, calculating custom gradients and schemes, detecting contrast, and converting colors to or from hexadecimal strings.
█ CONCEPTS
Color
Color refers to how we interpret light of different wavelengths in the visible spectrum . The colors we see from an object represent the light wavelengths that it reflects, emits, or transmits toward our eyes. Some colors, such as blue and red, correspond directly to parts of the spectrum. Others, such as magenta, arise from a combination of wavelengths to which our minds assign a single color.
The human interpretation of color lends itself to many uses in our world. In the context of financial data analysis, the effective use of color helps transform raw data into insights that users can understand at a glance. For example, colors can categorize series, signal market conditions and sessions, and emphasize patterns or relationships in data.
Color models and spaces
A color model is a general mathematical framework that describes colors using sets of numbers. A color space is an implementation of a specific color model that defines an exact range (gamut) of reproducible colors based on a set of primary colors , a reference white point , and sometimes additional parameters such as viewing conditions.
There are numerous different color spaces — each describing the characteristics of color in unique ways. Different spaces carry different advantages, depending on the application. Below, we provide a brief overview of the concepts underlying the color spaces supported by this library.
RGB
RGB is one of the most well-known color models. It represents color as an additive mixture of three primary colors — red, green, and blue lights — with various intensities. Each cone cell in the human eye responds more strongly to one of the three primaries, and the average person interprets the combination of these lights as a distinct color (e.g., pure red + pure green = yellow).
The sRGB color space is the most common RGB implementation. Developed by HP and Microsoft in the 1990s, sRGB provided a standardized baseline for representing color across CRT monitors of the era, which produced brightness levels that did not increase linearly with the input signal. To match displays and optimize brightness encoding for human sensitivity, sRGB applied a nonlinear transformation to linear RGB signals, often referred to as gamma correction . The result produced more visually pleasing outputs while maintaining a simple encoding. As such, sRGB quickly became a standard for digital color representation across devices and the web. To this day, it remains the default color space for most web-based content.
TradingView charts and Pine Script `color.*` built-ins process color data in sRGB. The red, green, and blue channels range from 0 to 255, where 0 represents no intensity, and 255 represents maximum intensity. Each combination of red, green, and blue values represents a distinct color, resulting in a total of 16,777,216 displayable colors.
CIE XYZ and xyY
The XYZ color space, developed by the International Commission on Illumination (CIE) in 1931, aims to describe all color sensations that a typical human can perceive. It is a cornerstone of color science, forming the basis for many color spaces used today. XYZ, and the derived xyY space, provide a universal representation of color that is not tethered to a particular display. Many widely used color spaces, including sRGB, are defined relative to XYZ or derived from it.
The CIE built the color space based on a series of experiments in which people matched colors they perceived from mixtures of lights. From these experiments, the CIE developed color-matching functions to calculate three components — X, Y, and Z — which together aim to describe a standard observer's response to visible light. X represents a weighted response to light across the color spectrum, with the highest contribution from long wavelengths (e.g., red). Y represents a weighted response to medium wavelengths (e.g., green), and it corresponds to a color's relative luminance (i.e., brightness). Z represents a weighted response to short wavelengths (e.g., blue).
From the XYZ space, the CIE developed the xyY chromaticity space, which separates a color's chromaticity (hue and colorfulness) from luminance. The CIE used this space to define the CIE 1931 chromaticity diagram , which represents the full range of visible colors at a given luminance. In color science and lighting design, xyY is a common means for specifying colors and visualizing the supported ranges of other color spaces.
CIELAB and Oklab
The CIELAB (L*a*b*) color space, derived from XYZ by the CIE in 1976, expresses colors based on opponent process theory. The L* component represents perceived lightness, and the a* and b* components represent the balance between opposing unique colors. The a* value specifies the balance between green and red , and the b* value specifies the balance between blue and yellow .
The primary intention of CIELAB was to provide a perceptually uniform color space, where fixed-size steps through the space correspond to uniform perceived changes in color. Although relatively uniform, the color space has been found to exhibit some non-uniformities, particularly in the blue part of the color spectrum. Regardless, modern applications often use CIELAB to estimate perceived color differences and calculate smooth color gradients.
In 2020, a new LAB-oriented color space, Oklab , was introduced by Björn Ottosson as an attempt to rectify the non-uniformities of other perceptual color spaces. Similar to CIELAB, the L value in Oklab represents perceived lightness, and the a and b values represent the balance between opposing unique colors. Oklab has gained widespread adoption as a perceptual space for color processing, with support in the latest CSS Color specifications and many software applications.
Cylindrical models
A cylindrical-coordinate model transforms an underlying color model, such as RGB or LAB, into an alternative expression of color information that is often more intuitive for the average person to use and understand.
Instead of a mixture of primary colors or opponent pairs, these models represent color as a hue angle on a color wheel , with additional parameters that describe other qualities such as lightness and colorfulness (a general term for concepts like chroma and saturation). In cylindrical-coordinate spaces, users can select a color and modify its lightness or other qualities without altering the hue.
The three most common RGB-based models are HSL (Hue, Saturation, Lightness), HSV (Hue, Saturation, Value), and HWB (Hue, Whiteness, Blackness). All three define hue angles in the same way, but they define colorfulness and lightness differently. Although they are not perceptually uniform, HSL and HSV are commonplace in color pickers and gradients.
For CIELAB and Oklab, the cylindrical-coordinate versions are CIELCh and Oklch , which express color in terms of perceived lightness, chroma, and hue. They offer perceptually uniform alternatives to RGB-based models. These spaces create unique color wheels, and they have more strict definitions of lightness and colorfulness. Oklch is particularly well-suited for generating smooth, perceptual color gradients.
Alpha and transparency
Many color encoding schemes include an alpha channel, representing opacity . Alpha does not help define a color in a color space; it determines how a color interacts with other colors in the display. Opaque colors appear with full intensity on the screen, whereas translucent (semi-opaque) colors blend into the background. Colors with zero opacity are invisible.
In Pine Script, there are two ways to specify a color's alpha:
• Using the `transp` parameter of the built-in `color.*()` functions. The specified value represents transparency (the opposite of opacity), which the functions translate into an alpha value.
• Using eight-digit hexadecimal color codes. The last two digits in the code represent alpha directly.
A process called alpha compositing simulates translucent colors in a display. It creates a single displayed color by mixing the RGB channels of two colors (foreground and background) based on alpha values, giving the illusion of a semi-opaque color placed over another color. For example, a red color with 80% transparency on a black background produces a dark shade of red.
Hexadecimal color codes
A hexadecimal color code (hex code) is a compact representation of an RGB color. It encodes a color's red, green, and blue values into a sequence of hexadecimal ( base-16 ) digits. The digits are numerals ranging from `0` to `9` or letters from `a` (for 10) to `f` (for 15). Each set of two digits represents an RGB channel ranging from `00` (for 0) to `ff` (for 255).
Pine scripts can natively define colors using hex codes in the format `#rrggbbaa`. The first set of two digits represents red, the second represents green, and the third represents blue. The fourth set represents alpha . If unspecified, the value is `ff` (fully opaque). For example, `#ff8b00` and `#ff8b00ff` represent an opaque orange color. The code `#ff8b0033` represents the same color with 80% transparency.
Gradients
A color gradient maps colors to numbers over a given range. Most color gradients represent a continuous path in a specific color space, where each number corresponds to a mix between a starting color and a stopping color. In Pine, coders often use gradients to visualize value intensities in plots and heatmaps, or to add visual depth to fills.
The behavior of a color gradient depends on the mixing method and the chosen color space. Gradients in sRGB usually mix along a straight line between the red, green, and blue coordinates of two colors. In cylindrical spaces such as HSL, a gradient often rotates the hue angle through the color wheel, resulting in more pronounced color transitions.
Color schemes
A color scheme refers to a set of colors for use in aesthetic or functional design. A color scheme usually consists of just a few distinct colors. However, depending on the purpose, a scheme can include many colors.
A user might choose palettes for a color scheme arbitrarily, or generate them algorithmically. There are many techniques for calculating color schemes. A few simple, practical methods are:
• Sampling a set of distinct colors from a color gradient.
• Generating monochromatic variants of a color (i.e., tints, tones, or shades with matching hues).
• Computing color harmonies — such as complements, analogous colors, triads, and tetrads — from a base color.
This library includes functions for all three of these techniques. See below for details.
█ CALCULATIONS AND USE
Hex string conversion
The `getHexString()` function returns a string containing the eight-digit hexadecimal code corresponding to a "color" value or set of sRGB and transparency values. For example, `getHexString(255, 0, 0)` returns the string `"#ff0000ff"`, and `getHexString(color.new(color.red, 80))` returns `"#f2364533"`.
The `hexStringToColor()` function returns the "color" value represented by a string containing a six- or eight-digit hex code. The `hexStringToRGB()` function returns a tuple containing the sRGB and transparency values. For example, `hexStringToColor("#f23645")` returns the same value as color.red .
Programmers can use these functions to parse colors from "string" inputs, perform string-based color calculations, and inspect color data in text outputs such as Pine Logs and tables.
Color space conversion
All other `get*()` functions convert a "color" value or set of sRGB channels into coordinates in a specific color space, with transparency information included. For example, the tuple returned by `getHSL()` includes the color's hue, saturation, lightness, and transparency values.
To convert data from a color space back to colors or sRGB and transparency values, use the corresponding `*toColor()` or `*toRGB()` functions for that space (e.g., `hslToColor()` and `hslToRGB()`).
Programmers can use these conversion functions to process inputs that define colors in different ways, perform advanced color manipulation, design custom gradients, and more.
The color spaces this library supports are:
• sRGB
• Linear RGB (RGB without gamma correction)
• HSL, HSV, and HWB
• CIE XYZ and xyY
• CIELAB and CIELCh
• Oklab and Oklch
Contrast-based calculations
Contrast refers to the difference in luminance or color that makes one color visible against another. This library features two functions for calculating luminance-based contrast and detecting themes.
The `contrastRatio()` function calculates the contrast between two "color" values based on their relative luminance (the Y value from CIE XYZ) using the formula from version 2 of the Web Content Accessibility Guidelines (WCAG) . This function is useful for identifying colors that provide a sufficient brightness difference for legibility.
The `isLightTheme()` function determines whether a specified background color represents a light theme based on its contrast with black and white. Programmers can use this function to define conditional logic that responds differently to light and dark themes.
Color manipulation and harmonies
The `negative()` function calculates the negative (i.e., inverse) of a color by reversing the color's coordinates in either the sRGB or linear RGB color space. This function is useful for calculating high-contrast colors.
The `grayscale()` function calculates a grayscale form of a specified color with the same relative luminance.
The functions `complement()`, `splitComplements()`, `analogousColors()`, `triadicColors()`, `tetradicColors()`, `pentadicColors()`, and `hexadicColors()` calculate color harmonies from a specified source color within a given color space (HSL, CIELCh, or Oklch). The returned harmonious colors represent specific hue rotations around a color wheel formed by the chosen space, with the same defined lightness, saturation or chroma, and transparency.
Color mixing and gradient creation
The `add()` function simulates combining lights of two different colors by additively mixing their linear red, green, and blue components, ignoring transparency by default. Users can calculate a transparency-weighted mixture by setting the `transpWeight` argument to `true`.
The `overlay()` function estimates the color displayed on a TradingView chart when a specific foreground color is over a background color. This function aids in simulating stacked colors and analyzing the effects of transparency.
The `fromGradient()` and `fromMultiStepGradient()` functions calculate colors from gradients in any of the supported color spaces, providing flexible alternatives to the RGB-based color.from_gradient() function. The `fromGradient()` function calculates a color from a single gradient. The `fromMultiStepGradient()` function calculates a color from a piecewise gradient with multiple defined steps. Gradients are useful for heatmaps and for coloring plots or drawings based on value intensities.
Scheme creation
Three functions in this library calculate palettes for custom color schemes. Scripts can use these functions to create responsive color schemes that adjust to calculated values and user inputs.
The `gradientPalette()` function creates an array of colors by sampling a specified number of colors along a gradient from a base color to a target color, in fixed-size steps.
The `monoPalette()` function creates an array containing monochromatic variants (tints, tones, or shades) of a specified base color. Whether the function mixes the color toward white (for tints), a form of gray (for tones), or black (for shades) depends on the `grayLuminance` value. If unspecified, the function automatically chooses the mix behavior with the highest contrast.
The `harmonyPalette()` function creates a matrix of colors. The first column contains the base color and specified harmonies, e.g., triadic colors. The columns that follow contain tints, tones, or shades of the harmonic colors for additional color choices, similar to `monoPalette()`.
█ EXAMPLE CODE
The example code at the end of the script generates and visualizes color schemes by processing user inputs. The code builds the scheme's palette based on the "Base color" input and the additional inputs in the "Settings/Inputs" tab:
• "Palette type" specifies whether the palette uses a custom gradient, monochromatic base color variants, or color harmonies with monochromatic variants.
• "Target color" sets the top color for the "Gradient" palette type.
• The "Gray luminance" inputs determine variation behavior for "Monochromatic" and "Harmony" palette types. If "Auto" is selected, the palette mixes the base color toward white or black based on its brightness. Otherwise, it mixes the color toward the grayscale color with the specified relative luminance (from 0 to 1).
• "Harmony type" specifies the color harmony used in the palette. Each row in the palette corresponds to one of the harmonious colors, starting with the base color.
The code creates a table on the first bar to display the collection of calculated colors. Each cell in the table shows the color's `getHexString()` value in a tooltip for simple inspection.
Look first. Then leap.
█ EXPORTED FUNCTIONS
Below is a complete list of the functions and overloads exported by this library.
getRGB(source)
Retrieves the sRGB red, green, blue, and transparency components of a "color" value.
getHexString(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channel values to a string representing the corresponding color's hexadecimal form.
getHexString(source)
(Overload 2 of 2) Converts a "color" value to a string representing the sRGB color's hexadecimal form.
hexStringToRGB(source)
Converts a string representing an sRGB color's hexadecimal form to a set of decimal channel values.
hexStringToColor(source)
Converts a string representing an sRGB color's hexadecimal form to a "color" value.
getLRGB(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channel values to a set of linear RGB values with specified transparency information.
getLRGB(source)
(Overload 2 of 2) Retrieves linear RGB channel values and transparency information from a "color" value.
lrgbToRGB(lr, lg, lb, t)
Converts a set of linear RGB channel values to a set of sRGB values with specified transparency information.
lrgbToColor(lr, lg, lb, t)
Converts a set of linear RGB channel values and transparency information to a "color" value.
getHSL(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of HSL values with specified transparency information.
getHSL(source)
(Overload 2 of 2) Retrieves HSL channel values and transparency information from a "color" value.
hslToRGB(h, s, l, t)
Converts a set of HSL channel values to a set of sRGB values with specified transparency information.
hslToColor(h, s, l, t)
Converts a set of HSL channel values and transparency information to a "color" value.
getHSV(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of HSV values with specified transparency information.
getHSV(source)
(Overload 2 of 2) Retrieves HSV channel values and transparency information from a "color" value.
hsvToRGB(h, s, v, t)
Converts a set of HSV channel values to a set of sRGB values with specified transparency information.
hsvToColor(h, s, v, t)
Converts a set of HSV channel values and transparency information to a "color" value.
getHWB(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of HWB values with specified transparency information.
getHWB(source)
(Overload 2 of 2) Retrieves HWB channel values and transparency information from a "color" value.
hwbToRGB(h, w, b, t)
Converts a set of HWB channel values to a set of sRGB values with specified transparency information.
hwbToColor(h, w, b, t)
Converts a set of HWB channel values and transparency information to a "color" value.
getXYZ(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of XYZ values with specified transparency information.
getXYZ(source)
(Overload 2 of 2) Retrieves XYZ channel values and transparency information from a "color" value.
xyzToRGB(x, y, z, t)
Converts a set of XYZ channel values to a set of sRGB values with specified transparency information
xyzToColor(x, y, z, t)
Converts a set of XYZ channel values and transparency information to a "color" value.
getXYY(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of xyY values with specified transparency information.
getXYY(source)
(Overload 2 of 2) Retrieves xyY channel values and transparency information from a "color" value.
xyyToRGB(xc, yc, y, t)
Converts a set of xyY channel values to a set of sRGB values with specified transparency information.
xyyToColor(xc, yc, y, t)
Converts a set of xyY channel values and transparency information to a "color" value.
getLAB(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of CIELAB values with specified transparency information.
getLAB(source)
(Overload 2 of 2) Retrieves CIELAB channel values and transparency information from a "color" value.
labToRGB(l, a, b, t)
Converts a set of CIELAB channel values to a set of sRGB values with specified transparency information.
labToColor(l, a, b, t)
Converts a set of CIELAB channel values and transparency information to a "color" value.
getOKLAB(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of Oklab values with specified transparency information.
getOKLAB(source)
(Overload 2 of 2) Retrieves Oklab channel values and transparency information from a "color" value.
oklabToRGB(l, a, b, t)
Converts a set of Oklab channel values to a set of sRGB values with specified transparency information.
oklabToColor(l, a, b, t)
Converts a set of Oklab channel values and transparency information to a "color" value.
getLCH(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of CIELCh values with specified transparency information.
getLCH(source)
(Overload 2 of 2) Retrieves CIELCh channel values and transparency information from a "color" value.
lchToRGB(l, c, h, t)
Converts a set of CIELCh channel values to a set of sRGB values with specified transparency information.
lchToColor(l, c, h, t)
Converts a set of CIELCh channel values and transparency information to a "color" value.
getOKLCH(r, g, b, t)
(Overload 1 of 2) Converts a set of sRGB channels to a set of Oklch values with specified transparency information.
getOKLCH(source)
(Overload 2 of 2) Retrieves Oklch channel values and transparency information from a "color" value.
oklchToRGB(l, c, h, t)
Converts a set of Oklch channel values to a set of sRGB values with specified transparency information.
oklchToColor(l, c, h, t)
Converts a set of Oklch channel values and transparency information to a "color" value.
contrastRatio(value1, value2)
Calculates the contrast ratio between two colors values based on the formula from version 2 of the Web Content Accessibility Guidelines (WCAG).
isLightTheme(source)
Detects whether a background color represents a light theme or dark theme, based on the amount of contrast between the color and the white and black points.
grayscale(source)
Calculates the grayscale version of a color with the same relative luminance (i.e., brightness).
negative(source, colorSpace)
Calculates the negative (i.e., inverted) form of a specified color.
complement(source, colorSpace)
Calculates the complementary color for a `source` color using a cylindrical color space.
analogousColors(source, colorSpace)
Calculates the analogous colors for a `source` color using a cylindrical color space.
splitComplements(source, colorSpace)
Calculates the split-complementary colors for a `source` color using a cylindrical color space.
triadicColors(source, colorSpace)
Calculates the two triadic colors for a `source` color using a cylindrical color space.
tetradicColors(source, colorSpace, square)
Calculates the three square or rectangular tetradic colors for a `source` color using a cylindrical color space.
pentadicColors(source, colorSpace)
Calculates the four pentadic colors for a `source` color using a cylindrical color space.
hexadicColors(source, colorSpace)
Calculates the five hexadic colors for a `source` color using a cylindrical color space.
add(value1, value2, transpWeight)
Additively mixes two "color" values, with optional transparency weighting.
overlay(fg, bg)
Estimates the resulting color that appears on the chart when placing one color over another.
fromGradient(value, bottomValue, topValue, bottomColor, topColor, colorSpace)
Calculates the gradient color that corresponds to a specific value based on a defined value range and color space.
fromMultiStepGradient(value, steps, colors, colorSpace)
Calculates a multi-step gradient color that corresponds to a specific value based on an array of step points, an array of corresponding colors, and a color space.
gradientPalette(baseColor, stopColor, steps, strength, model)
Generates a palette from a gradient between two base colors.
monoPalette(baseColor, grayLuminance, variations, strength, colorSpace)
Generates a monochromatic palette from a specified base color.
harmonyPalette(baseColor, harmonyType, grayLuminance, variations, strength, colorSpace)
Generates a palette consisting of harmonious base colors and their monochromatic variants.
Strategi Ichimoku UniversalWe use Ichimoku as the only trend and signal filter, with a bit of "price action" logic from the candles.
📌 BUY rule:
1.Close above the cloud (Kumo) → uptrend
2.Bullish candle (close > open)
3.Tenkan > Kijun → strong upward momentum
📌 SELL rule:
1.Close below Kumo → downtrend
2.Bearish candle (close < open)
3.Tenkan < Kijun
ORB Screener-Multiple IndicatorsThis custom screener is designed to identify high-probability intraday breakout opportunities across the top 40 NSE stocks by market capitalization. It is built on the proven Opening Range Breakout (ORB) concept and enhanced with a powerful combination of momentum and trend filters.
✅ Key Features:
Opening Range (09:15–09:20) detection with automatic status: Abv High, Blw Low, BTW
Real-time scanning of 40 pre-loaded NSE stocks (configurable)
Composite scoring system (0–100) based on:
RSI > 55
Price above VWAP
Volume Surge (vs 20-period SMA)
ADX > 20
MACD Histogram (positive and rising)
ORB Breakout Direction
Color-coded screener table to highlight top-scoring stocks
Buy/Sell suggestions shown alongside score
Manual sorting toggle for ranked display
Fully customizable watchlist with checkboxes
🛠️ Best Use:
Ideal for intraday traders looking for momentum trades.
Focus on stocks with score ≥ 75 and green highlight for long trades.
Designed to be lightweight despite scanning 40 instruments.
⚠️ Notes:
This script does not plot on the chart; it only renders a dynamic screener table.
No alerts are configured—manual review required.
You can edit the top 40 symbols as needed.
Momentum Intradía Total✅ What does this script include?
✅ Central VWAP
✅ EMA 9 and EMA 21
✅ RSI with its moving average
✅ Visual signal via triangle when:
✅ Price is above VWAP and EMA 9
✅ EMA 9 is above EMA 21
✅ RSI > 50 and RSI is above its moving average
✅ Change from open > +3%
✅ Total score indicator (from 0 to 5)
RSI OS/OB Background StripesA simple indicator to provide the user with background stripes on the candle chart showing RSI Oversold and Overbought Levels.