Key Levels// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © kenmorley
// Key Levels Indicator
// This indicator plots key levels on the chart:
// Current session high (High of Day) and low (Low of Day)
// Previous day high (Prev Day High), low (Prev Day Low), and close (Prev Day Close)
// Overnight high (ONH) and low (ONL) based on a defined overnight window
// At the start of a new session (Day), the indicator resets its values and creates a new set of labels.
// These labels are positioned in a fixed horizontal column (offset from the current bar) and are updated each bar
// so that they remain vertically aligned with their corresponding level (with a small vertical offset).
//
// Inputs you can modify:
// - Futures Mode and session times for equities and futures.
// - Horizontal label offset (in bars) and vertical offset (price units) for label positioning.
// - Colors, line widths, and styles for each level (day high, day low, overnight high/low, previous day levels).
// Adjust these inputs to match your market hours and desired appearance.
//@version=6
indicator("Key Levels", overlay=true, shorttitle="Key Levels", max_lines_count=500)
// ============================================================================
// Input: Futures Mode and Session Settings
// ============================================================================
futuresMode = input.bool(false, "Futures Mode", tooltip="Enable if running on futures contracts")
regularSessionEquity = input.session("0930-1600", title="Equity Regular Session")
regularSessionFut = input.session("0900-1600", title="Futures Regular Session")
regularSession = futuresMode ? regularSessionFut : regularSessionEquity
// ============================================================================
// Label Offset Inputs
// ============================================================================
labelOffset = input.int(50, "Horizontal Label Offset (bars)", minval=1)
labelVOffset = input.float(0.1, "Label Vertical Offset", step=0.1, tooltip="Distance above (for highs) or below (for lows) the corresponding line")
// ============================================================================
// Determine Session Membership and Overnight Window
// ============================================================================
inRegular = not na(time(timeframe.period, regularSession))
// For equities, define overnight as 04:00–09:29 (inclusive of 04:00)
// For futures, define overnight as from after session close (16:00) until session open (09:00)
overnightManual = futuresMode ? (hour >= 16 or hour < 9) : (hour >= 4 and (hour < 9 or (hour == 9 and minute <= 29)))
// ============================================================================
// New Day / Regular Session Start Detection
// ============================================================================
eqSessionStart = (not futuresMode) and (hour == 9 and minute == 30)
futSessionStart = futuresMode and (hour == 9 and minute == 0)
sessionStart = futuresMode ? futSessionStart : eqSessionStart
// Compute current day-of-year (as an integer)
currentDayOfYear = int((time - timestamp(year(time), 1, 1, 0, 0)) / 86400000) + 1
// Persistent variable to store the day-of-year of the current session.
var int sessionDay = na
// ============================================================================
// Style Inputs (group "Style")
// ============================================================================
regHighColor = input.color(color.green, "Day High Color", group="Style")
regHighWidth = input.int(2, "Day High Width", minval=1, group="Style")
regHighStyleStr = input.string("solid", "Day High Style", options= , group="Style")
regLowColor = input.color(color.red, "Day Low Color", group="Style")
regLowWidth = input.int(2, "Day Low Width", minval=1, group="Style")
regLowStyleStr = input.string("solid", "Day Low Style", options= , group="Style")
overnightHighColor = input.color(color.blue, "Overnight High Color", group="Style")
overnightHighWidth = input.int(2, "Overnight High Width", minval=1, group="Style")
overnightHighStyleStr = input.string("dotted", "Overnight High Style", options= , group="Style")
overnightLowColor = input.color(color.blue, "Overnight Low Color", group="Style")
overnightLowWidth = input.int(2, "Overnight Low Width", minval=1, group="Style")
overnightLowStyleStr = input.string("dotted", "Overnight Low Style", options= , group="Style")
prevCloseColor = input.color(color.yellow, "Previous Day Close Color", group="Style")
prevCloseWidth = input.int(2, "Previous Day Close Width", minval=1, group="Style")
prevCloseStyleStr = input.string("solid", "Previous Day Close Style", options= , group="Style")
prevHighColor = input.color(color.lime, "Previous Day High Color", group="Style")
prevHighWidth = input.int(2, "Previous Day High Width", minval=1, group="Style")
prevHighStyleStr = input.string("solid", "Previous Day High Style", options= , group="Style")
prevLowColor = input.color(color.red, "Previous Day Low Color", group="Style")
prevLowWidth = input.int(2, "Previous Day Low Width", minval=1, group="Style")
prevLowStyleStr = input.string("solid", "Previous Day Low Style", options= , group="Style")
// Helper function to convert style string to a line style constant.
f_line_style(str) =>
str == "solid" ? line.style_solid : str == "dotted" ? line.style_dotted : line.style_dashed
// ============================================================================
// Persistent Variables for Daily Values and Their Bar Indexes
// ============================================================================
// Current day regular session values.
var float curRegHigh = na
var float curRegLow = na
var int curRegHighBar = na
var int curRegLowBar = na
// Current day overnight values.
var float curOverHigh = na
var float curOverLow = na
var int curOverHighBar = na
var int curOverLowBar = na
// Previous day regular session values.
var float prevRegHigh = na
var float prevRegLow = na
var float prevRegClose = na
var int prevRegHighBar = na
var int prevRegLowBar = na
var int prevRegCloseBar = na
// Previous overnight values (from the previous session)
var float prevOverHigh = na
var float prevOverLow = na
var int prevOverHighBar = na
var int prevOverLowBar = na
// ============================================================================
// Persistent Label Variables (One set per day)
// ============================================================================
var label hodLabel = na
var label lodLabel = na
var label pdhLabel = na
var label pdlLabel = na
var label pdcLabel = na
var label onhLabel = na
var label onlLabel = na
// ============================================================================
// Persistent Variable for storing last regular session close
// ============================================================================
var float lastRegularClose = na
var int lastRegularCloseBar = na
// ============================================================================
// Reset on New Day / Session Start (Only Once Per Day)
// ============================================================================
if sessionStart and (na(sessionDay) or sessionDay != currentDayOfYear)
// Delete any existing labels from the previous day.
if not na(hodLabel)
label.delete(hodLabel)
if not na(lodLabel)
label.delete(lodLabel)
if not na(pdhLabel)
label.delete(pdhLabel)
if not na(pdlLabel)
label.delete(pdlLabel)
if not na(pdcLabel)
label.delete(pdcLabel)
if not na(onhLabel)
label.delete(onhLabel)
if not na(onlLabel)
label.delete(onlLabel)
// Store previous day's regular session values if available.
if not na(curRegHigh)
prevRegHigh := curRegHigh
prevRegHighBar := curRegHighBar
if not na(curRegLow)
prevRegLow := curRegLow
prevRegLowBar := curRegLowBar
if not na(lastRegularClose)
prevRegClose := lastRegularClose
prevRegCloseBar := lastRegularCloseBar
// Store previous overnight values.
if not na(curOverHigh)
prevOverHigh := curOverHigh
prevOverHighBar := curOverHighBar
if not na(curOverLow)
prevOverLow := curOverLow
prevOverLowBar := curOverLowBar
// Reset current day values.
curRegHigh := na
curRegLow := na
curRegHighBar := na
curRegLowBar := na
curOverHigh := na
curOverLow := na
curOverHighBar := na
curOverLowBar := na
// Create one set of labels only once per day.
hodLabel := label.new(bar_index+labelOffset, na, "HOD", color=color.new(color.white, 100), textcolor=regHighColor, size=size.small, style=label.style_label_right)
pdhLabel := label.new(bar_index+labelOffset, na, "PDH", color=color.new(color.white, 100), textcolor=prevHighColor, size=size.small, style=label.style_label_right)
onhLabel := label.new(bar_index+labelOffset, na, "ONH", color=color.new(color.white, 100), textcolor=overnightHighColor, size=size.small, style=label.style_label_right)
pdcLabel := label.new(bar_index+labelOffset, na, "PDC", color=color.new(color.white, 100), textcolor=prevCloseColor, size=size.small, style=label.style_label_right)
pdlLabel := label.new(bar_index+labelOffset, na, "PDL", color=color.new(color.white, 100), textcolor=prevLowColor, size=size.small, style=label.style_label_right)
onlLabel := label.new(bar_index+labelOffset, na, "ONL", color=color.new(color.white, 100), textcolor=overnightLowColor, size=size.small, style=label.style_label_right)
lodLabel := label.new(bar_index+labelOffset, na, "LOD", color=color.new(color.white, 100), textcolor=regLowColor, size=size.small, style=label.style_label_right)
sessionDay := currentDayOfYear
// ============================================================================
// Update Current Day Values
// ============================================================================
// During regular session, update HOD and LOD.
if inRegular
if na(curRegHigh) or high > curRegHigh
curRegHigh := high
curRegHighBar := bar_index
if na(curRegLow) or low < curRegLow
curRegLow := low
curRegLowBar := bar_index
// Continuously update last regular session close.
lastRegularClose := close
lastRegularCloseBar := bar_index
// Update overnight values during overnight period.
if overnightManual
if na(curOverHigh) or high > curOverHigh
curOverHigh := high
curOverHighBar := bar_index
if na(curOverLow) or low < curOverLow
curOverLow := low
curOverLowBar := bar_index
// ============================================================================
// Define Levels
// ============================================================================
// For overnight, if previous values exist, use them; otherwise use current ones.
onh_value = not na(prevOverHigh) ? prevOverHigh : curOverHigh
onh_bar = not na(prevOverHighBar) ? prevOverHighBar : curOverHighBar
onl_value = not na(prevOverLow) ? prevOverLow : curOverLow
onl_bar = not na(prevOverLowBar) ? prevOverLowBar : curOverLowBar
// ============================================================================
// Plot Horizontal Lines
// ============================================================================
var line regHighLine = na
var line regLowLine = na
var line onhLine = na
var line onlLine = na
var line prevCloseLine = na
var line prevHighLine = na
var line prevLowLine = na
if sessionStart and (sessionDay == currentDayOfYear)
if not na(regHighLine)
line.delete(regHighLine)
if not na(regLowLine)
line.delete(regLowLine)
if not na(onhLine)
line.delete(onhLine)
if not na(onlLine)
line.delete(onlLine)
if not na(prevCloseLine)
line.delete(prevCloseLine)
if not na(prevHighLine)
line.delete(prevHighLine)
if not na(prevLowLine)
line.delete(prevLowLine)
regHighLine := na
regLowLine := na
onhLine := na
onlLine := na
prevCloseLine := na
prevHighLine := na
prevLowLine := na
if not na(curRegHigh)
if na(regHighLine)
regHighLine := line.new(curRegHighBar, curRegHigh, bar_index+1, curRegHigh, extend=extend.right, color=regHighColor, style=f_line_style(regHighStyleStr), width=regHighWidth)
else
line.set_xy1(regHighLine, curRegHighBar, curRegHigh)
line.set_xy2(regHighLine, bar_index+1, curRegHigh)
if not na(curRegLow)
if na(regLowLine)
regLowLine := line.new(curRegLowBar, curRegLow, bar_index+1, curRegLow, extend=extend.right, color=regLowColor, style=f_line_style(regLowStyleStr), width=regLowWidth)
else
line.set_xy1(regLowLine, curRegLowBar, curRegLow)
line.set_xy2(regLowLine, bar_index+1, curRegLow)
if not na(onh_value)
if na(onhLine)
onhLine := line.new(onh_bar, onh_value, bar_index+1, onh_value, extend=extend.right, color=overnightHighColor, style=f_line_style(overnightHighStyleStr), width=overnightHighWidth)
else
line.set_xy1(onhLine, onh_bar, onh_value)
line.set_xy2(onhLine, bar_index+1, onh_value)
if not na(onl_value)
if na(onlLine)
onlLine := line.new(onl_bar, onl_value, bar_index+1, onl_value, extend=extend.right, color=overnightLowColor, style=f_line_style(overnightLowStyleStr), width=overnightLowWidth)
else
line.set_xy1(onlLine, onl_bar, onl_value)
line.set_xy2(onlLine, bar_index+1, onl_value)
if not na(prevRegClose)
if na(prevCloseLine)
prevCloseLine := line.new(prevRegCloseBar, prevRegClose, bar_index+1, prevRegClose, extend=extend.right, color=prevCloseColor, style=f_line_style(prevCloseStyleStr), width=prevCloseWidth)
else
line.set_xy1(prevCloseLine, prevRegCloseBar, prevRegClose)
line.set_xy2(prevCloseLine, bar_index+1, prevRegClose)
if not na(prevRegHigh)
if na(prevHighLine)
prevHighLine := line.new(prevRegHighBar, prevRegHigh, bar_index+1, prevRegHigh, extend=extend.right, color=prevHighColor, style=f_line_style(prevHighStyleStr), width=prevHighWidth)
else
line.set_xy1(prevHighLine, prevRegHighBar, prevRegHigh)
line.set_xy2(prevHighLine, bar_index+1, prevRegHigh)
if not na(prevRegLow)
if na(prevLowLine)
prevLowLine := line.new(prevRegLowBar, prevRegLow, bar_index+1, prevRegLow, extend=extend.right, color=prevLowColor, style=f_line_style(prevLowStyleStr), width=prevLowWidth)
else
line.set_xy1(prevLowLine, prevRegLowBar, prevRegLow)
line.set_xy2(prevLowLine, bar_index+1, prevRegLow)
// ============================================================================
// Update Label Positions Relative to Their Corresponding Levels
// ============================================================================
x_pos = bar_index + labelOffset
if not na(hodLabel) and not na(curRegHigh)
label.set_xy(hodLabel, x_pos, curRegHigh - labelVOffset)
if not na(lodLabel) and not na(curRegLow)
label.set_xy(lodLabel, x_pos, curRegLow + labelVOffset)
if not na(pdhLabel) and not na(prevRegHigh)
label.set_xy(pdhLabel, x_pos, prevRegHigh - labelVOffset)
if not na(pdlLabel) and not na(prevRegLow)
label.set_xy(pdlLabel, x_pos, prevRegLow + labelVOffset)
if not na(pdcLabel) and not na(prevRegClose)
label.set_xy(pdcLabel, x_pos, prevRegClose)
if not na(onhLabel) and not na(onh_value)
label.set_xy(onhLabel, x_pos, onh_value - labelVOffset)
if not na(onlLabel) and not na(onl_value)
label.set_xy(onlLabel, x_pos, onl_value + labelVOffset)
インジケーターとストラテジー
Macro Flow Assistant — Full Clean Levels public versionpublic easy macro flow tracker.
important levels only marked.
trend bias.
Highlight Selected PeriodEdit and put what month or week you want and it will highlight all january's or all second weeks of the month to try and see if there are any patterns.
Institucional Force IndexThe indicator shows the true strength of the movements, thus allowing one to assess whether price increases or decreases are genuine or false.
Fibonacci 3H Personalizada - NYIndicador desenvolvido para tracar fibos a cada 3 horas. utilizar para confluencia
Trend Zone BreakoutsThe HD Trend Zone Breakouts indicator identifies when the market is trending strongly on both your chart timeframe and a higher timeframe, then tracks moments where price becomes stretched inside that trend. When this stretch occurs, the indicator builds a dynamic zone capturing the full high–low range during that extension. Once the stretch ends, the zone is frozen, and the script waits to see how price reacts to it. Breakouts above or below these zones signal whether the trend is likely to continue or fail. This creates a powerful structure-based way to time entries, exits, and reversals without relying on noisy overbought/oversold signals.
How It Works
Confirms trend direction on both lower and higher timeframes using an EMA-based regime.
Detects stretched conditions using RSI only when both timeframes are aligned.
Draws a price zone around candles formed during these extreme trend pushes.
Freezes the zone once the stretch ends, creating a reference area.
Monitors for breakouts above/below the zone to confirm trend continuation or trend failure.
Breakout Logic
Bull continuation → price breaks above the top of a bullish zone.
Bull failure → price breaks below the bottom of a bullish zone.
Bear continuation → price breaks below the bottom of a bearish zone.
Bear failure → price breaks above the top of a bearish zone.
Why It’s Useful
Distinguishes meaningful extensions from ordinary RSI signals.
Provides clear structural levels for timing trades.
Identifies trend continuation early and flags potential reversals.
Works extremely well alongside EMAC Forecast, Trend Exhaustion Lite, and Volatility Squeeze.
5m FVGs Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Emac ML Adaptive CrossoverThe HDAlgos EMAC ML Adaptive Crossover is an adaptive trend reading and crossover system that uses a lightweight machine learning style scoring engine to detect regime shifts in the market. It blends multiple normalised technical features and automatically adjusts EMA lengths based on the detected market regime.
How it works
Feature Engine
The script computes several normalised indicators including RSI, ATR percentage, and Rate of Change. Each feature is converted into a z score so that the values behave consistently across different markets and timeframes. These feature values are then averaged to form a composite regime score.
Regime Detection
The composite score is compared to a dynamic upper and lower threshold. If the score rises above the upper boundary the regime becomes bullish. If the score falls below the lower boundary it becomes bearish. If it stays between the two boundaries the market is classified as neutral.
Adaptive EMAs
The fast and slow EMA lengths are automatically adjusted depending on the detected regime.
• In bullish regimes the fast and slow EMAs shorten.
• In bearish regimes they lengthen.
• In neutral regimes they revert to their base lengths.
This creates an EMA crossover system that responds to market volatility and directional strength rather than using fixed lookback values.
Crossovers
When the adaptive fast EMA crosses above the adaptive slow EMA, a bullish signal appears. When it crosses below, a bearish signal appears.
Visual Aids
• The fast EMA changes color to reflect the current regime.
• Candles can be optionally painted in regime colors.
• A label on the last bar shows the detected regime, score, and active EMA lengths.
• A compact table can be shown in the corner summarizing regime state and metrics.
Alerts
Alerts trigger when the regime changes, when a bullish adaptive crossover occurs, and when a bearish adaptive crossover occurs.
What it is designed for
This indicator is built for traders who want a crossover system that adapts to real market conditions instead of reacting to fixed length EMAs. It provides:
Smoother identification of trend phases
Dynamic sensitivity during strong conditions
Dampened reactions during noise and low conviction periods
Clear and simple signals that remain easy to interpret
ICT SMT A+ LONG & SELL ChecklistTrade Checklist. Once all items checked color changes from yellow to green.
Boring MACD Trading Strategy - Dedicated to 'The Secret Mindset'This indicator displays the MACD status across three selectable timeframes, regardless of the chart timeframe you are currently viewing.
For each timeframe, it shows whether the MACD line is above or below the zero line, indicating bullish or bearish momentum.
It also shows whether the MACD line is above or below the signal line, revealing the current trend condition as bullish, bearish, or neutral.
Boring MACD Trading Strategy - Dedicated to 'The Secret Mindset'This indicator displays the MACD status across three selectable timeframes, regardless of the chart timeframe you are currently viewing.
For each timeframe, it shows whether the MACD line is above or below the zero line, indicating bullish or bearish momentum.
It also shows whether the MACD line is above or below the signal line, revealing the current trend condition as bullish, bearish, or neutral.
YCGH ATH DrawdownHow the Indicator Measures Drawdown from ATH
The indicator continuously tracks and calculates the percentage decline from the all-time high (ATH) using a systematic approach.
ATH Tracking Mechanism
Dynamic ATH Calculation: The script maintains a persistent variable that stores the highest price ever reached. On each bar, it compares the current high with the stored ATH using ath := math.max(ath, high), updating the ATH whenever a new peak is reached.
Periodic Volume Time Velocity ProfileThis is the Periodic Volume Time Velocity Profile (PVTVP). It is an advanced professional profiling tool that goes beyond standard volume analysis by introducing Time and Velocity (Flow Rate) as profile dimensions.
By analyzing high-resolution intra-bar data, it builds
precise profiles for any custom period (Session, Day, Week, etc.),
helping you understand not just *where* the market traded,
but *how* it traded there.
## The 3 Dimensions of the Market
Unlike standard tools that only show Volume, PVTVP allows you
to switch between three critical metrics:
1. **VOLUME Profile (The "Where"):**
* Shows standard acceptance. High volume nodes (HVN)
are magnets for price.
2. **TIME Profile (The "How Long"):**
* Similar to TPO, it measures how long price spent at each
level.
* **High Time:** True acceptance and fair value.
* **Low Time:** Rejection or rapid movement.
3. **VELOCITY Profile (The "How Fast"):**
* Measures the **speed of trading** (Contracts per Second).
This reveals the hidden intent of market participants.
* **High Velocity (Fast Flow):** Aggression. Initiative
buyers/sellers are hitting market orders rapidly. Often
seen at breakouts or in liquidity vacuums.
* **Low Velocity (Slow Flow):** Absorption. Massive passive
limit orders are slowing price down despite high volume.
Often seen at major reversals ("hitting a brick wall").
## Key Features
1. **Statistical Volume Profile Engine:** For each bar in the selected
period, the indicator builds a complete volume profile on a lower
'Intra-Bar Timeframe'. Instead of simple tick counting, it uses
**statistical models ('PDF' allocation)** to distribute volume
across price levels and **advanced classifiers ('Dynamic' split)**
to determine the buy/sell pressure within that profile.
2. **Flexible Profile Display:** The **finalized profile** (plotted at
the end of each period) can be visualized in three distinct
ways: 'Up/Down' (buy vs. sell), 'Total' (combined volume),
and 'Delta' (net difference).
3. **Developing Key Levels:** The indicator also plots the developing
Point of Control (POC), Value Area (VA), VWAP, and Standard
Deviation bands in real-time as the period unfolds, providing
live insights into the emerging market structure.
4. **Dynamic Row Sizing:** Includes an option ('Rows per Percent')
to automatically adjust the number of profile rows (buckets)
based on the profile's price range, maintaining a consistent
visual density.
5. **Integrated Alerts:** Includes 12 alerts that trigger when the
main price crosses over or under the key developing levels:
POC, VWAP, Value Area High/Low, and the +/- Standard
Deviation bands.
**Caution: Real-Time Data Behavior (Intra-Bar Repainting)**
This indicator uses high-resolution intra-bar data. As a result, the
values on the **current, unclosed bar** (the real-time bar) will
update dynamically as new intra-bar data arrives. This behavior is
normal and necessary for this type of analysis. Signals should only
be considered final **after the main chart bar has closed.**
---
**DISCLAIMER**
1. **For Informational/Educational Use Only:** This indicator is
provided for informational and educational purposes only. It does
not constitute financial, investment, or trading advice, nor is
it a recommendation to buy or sell any asset.
2. **Use at Your Own Risk:** All trading decisions you make based on
the information or signals generated by this indicator are made
solely at your own risk.
3. **No Guarantee of Performance:** Past performance is not an
indicator of future results. The author makes no guarantee
regarding the accuracy of the signals or future profitability.
4. **No Liability:** The author shall not be held liable for any
financial losses or damages incurred directly or indirectly from
the use of this indicator.
5. **Signals Are Not Recommendations:** The alerts and visual signals
(e.g., crossovers) generated by this tool are not direct
recommendations to buy or sell. They are technical observations
for your own analysis and consideration.
BTCUSD / (inverted)DXY RatioShows relation between INVERTED DXY and BITCOIN ( blue line ) . With EMA-smoothing ( red line ).
LibVeloLibrary "LibVelo"
This library provides a sophisticated framework for **Velocity
Profile (Flow Rate)** analysis. It measures the physical
speed of trading at specific price levels by relating volume
to the time spent at those levels.
## Core Concept: Market Velocity
Unlike Volume Profiles, which only answer "how much" traded,
Velocity Profiles answer "how fast" it traded.
It is calculated as:
`Velocity = Volume / Duration`
This metric (contracts per second) reveals hidden market
dynamics invisible to pure Volume or TPO profiles:
1. **High Velocity (Fast Flow):**
* **Aggression:** Initiative buyers/sellers hitting market
orders rapidly.
* **Liquidity Vacuum:** Price slips through a level because
order book depth is thin (low resistance).
2. **Low Velocity (Slow Flow):**
* **Absorption:** High volume but very slow price movement.
Indicates massive passive limit orders ("Icebergs").
* **Apathy:** Little volume over a long time. Lack of
interest from major participants.
## Architecture: Triple-Engine Composition
To ensure maximum performance while offering full statistical
depth for all metrics, this library utilises **object
composition** with a lazy evaluation strategy:
#### Engine A: The Master (`vpVol`)
* **Role:** Standard Volume Profile.
* **Purpose:** Maintains the "ground truth" of volume distribution,
price buckets, and ranges.
#### Engine B: The Time Container (`vpTime`)
* **Role:** specialized container for time duration (in ms).
* **Hack:** It repurposes standard volume arrays (specifically
`aBuy`) to accumulate time duration for each bucket.
#### Engine C: The Calculator (`vpVelo`)
* **Role:** Temporary scratchpad for derived metrics.
* **Purpose:** When complex statistics (like Value Area or Skewness)
are requested for **Velocity**, this engine is assembled
on-demand to leverage the full statistical power of `LibVPrf`
without rewriting complex algorithms.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
create(buckets, rangeUp, rangeLo, dynamic, valueArea, allot, estimator, cdfSteps, split, trendLen)
Construct a new `Velo` controller, initializing its engines.
Parameters:
buckets (int) : series int Number of price buckets ≥ 1.
rangeUp (float) : series float Upper price bound (absolute).
rangeLo (float) : series float Lower price bound (absolute).
dynamic (bool) : series bool Flag for dynamic adaption of profile ranges.
valueArea (int) : series int Percentage for Value Area (1..100).
allot (series AllotMode) : series AllotMode Allocation mode `Classic` or `PDF` (default `PDF`).
estimator (series PriceEst enum from AustrianTradingMachine/LibBrSt/1) : series PriceEst PDF model for distribution attribution (default `Uniform`).
cdfSteps (int) : series int Resolution for PDF integration (default 20).
split (series SplitMode) : series SplitMode Buy/Sell split for the master volume engine (default `Classic`).
trendLen (int) : series int Look‑back for trend factor in dynamic split (default 3).
Returns: Velo Freshly initialised velocity profile.
method clone(self)
Create a deep copy of the composite profile.
Namespace types: Velo
Parameters:
self (Velo) : Velo Profile object to copy.
Returns: Velo A completely independent clone.
method clear(self)
Reset all engines and accumulators.
Namespace types: Velo
Parameters:
self (Velo) : Velo Profile object to clear.
Returns: Velo Cleared profile (chaining).
method merge(self, srcVolBuy, srcVolSell, srcTime, srcRangeUp, srcRangeLo, srcVolCvd, srcVolCvdHi, srcVolCvdLo)
Merges external data (Volume and Time) into the current profile.
Automatically handles resizing and re-bucketing if ranges differ.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
srcVolBuy (array) : array Source Buy Volume bucket array.
srcVolSell (array) : array Source Sell Volume bucket array.
srcTime (array) : array Source Time bucket array (ms).
srcRangeUp (float) : series float Upper price bound of the source data.
srcRangeLo (float) : series float Lower price bound of the source data.
srcVolCvd (float) : series float Source Volume CVD final value.
srcVolCvdHi (float) : series float Source Volume CVD High watermark.
srcVolCvdLo (float) : series float Source Volume CVD Low watermark.
Returns: Velo `self` (chaining).
method addBar(self, offset)
Main data ingestion. Distributes Volume and Time to buckets.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
offset (int) : series int Offset of the bar to add (default 0).
Returns: Velo `self` (chaining).
method setBuckets(self, buckets)
Sets the number of buckets for the profile.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
buckets (int) : series int New number of buckets.
Returns: Velo `self` (chaining).
method setRanges(self, rangeUp, rangeLo)
Sets the price range for the profile.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
rangeUp (float) : series float New upper price bound.
rangeLo (float) : series float New lower price bound.
Returns: Velo `self` (chaining).
method setValueArea(self, va)
Set the percentage of volume/time for the Value Area.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
va (int) : series int New Value Area percentage (0..100).
Returns: Velo `self` (chaining).
method getBuckets(self)
Returns the current number of buckets in the profile.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: series int The number of buckets.
method getRanges(self)
Returns the current price range of the profile.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns:
rangeUp series float The upper price bound of the profile.
rangeLo series float The lower price bound of the profile.
method getArrayBuyVol(self)
Returns the internal raw data array for **Buy Volume** directly.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: array The internal array for buy volume.
method getArraySellVol(self)
Returns the internal raw data array for **Sell Volume** directly.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: array The internal array for sell volume.
method getArrayTime(self)
Returns the internal raw data array for **Time** (in ms) directly.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: array The internal array for time duration.
method getArrayBuyVelo(self)
Returns the internal raw data array for **Buy Velocity** directly.
Automatically executes _assemble() if data is dirty.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: array The internal array for buy velocity.
method getArraySellVelo(self)
Returns the internal raw data array for **Sell Velocity** directly.
Automatically executes _assemble() if data is dirty.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
Returns: array The internal array for sell velocity.
method getBucketBuyVol(self, idx)
Returns the **Buy Volume** of a specific bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns: series float The buy volume.
method getBucketSellVol(self, idx)
Returns the **Sell Volume** of a specific bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns: series float The sell volume.
method getBucketTime(self, idx)
Returns the raw accumulated time (in ms) spent in a specific bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns: series float The time in milliseconds.
method getBucketBuyVelo(self, idx)
Returns the **Buy Velocity** (Aggressive Buy Flow) of a bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns: series float The buy velocity in .
method getBucketSellVelo(self, idx)
Returns the **Sell Velocity** (Aggressive Sell Flow) of a bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns: series float The sell velocity in .
method getBktBnds(self, idx)
Returns the price boundaries of a specific bucket.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
idx (int) : series int The index of the bucket.
Returns:
up series float The upper price bound of the bucket.
lo series float The lower price bound of the bucket.
method getPoc(self, target)
Returns Point of Control (POC) information for the specified target metric.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns:
pocIdx series int The index of the POC bucket.
pocPrice series float The mid-price of the POC bucket.
method getVA(self, target)
Returns Value Area (VA) information for the specified target metric.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns:
vaUpIdx series int The index of the upper VA bucket.
vaUpPrice series float The upper price bound of the VA.
vaLoIdx series int The index of the lower VA bucket.
vaLoPrice series float The lower price bound of the VA.
method getMedian(self, target)
Returns the Median price for the specified target metric distribution.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns:
medianIdx series int The index of the bucket containing the median.
medianPrice series float The median price.
method getAverage(self, target)
Returns the weighted average price (VWAP/TWAP) for the specified target.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns:
avgIdx series int The index of the bucket containing the average.
avgPrice series float The weighted average price.
method getStdDev(self, target)
Returns the standard deviation for the specified target distribution.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns: series float The standard deviation.
method getSkewness(self, target)
Returns the skewness for the specified target distribution.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns: series float The skewness.
method getKurtosis(self, target)
Returns the excess kurtosis for the specified target distribution.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns: series float The excess kurtosis.
method getSegments(self, target)
Returns the fundamental unimodal segments for the specified target metric.
Calculates on-demand if the target is 'Velocity' and data changed.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns: matrix A 2-column matrix where each row is an pair.
method getCvd(self, target)
Returns Cumulative Volume/Velo Delta (CVD) information for the target metric.
Namespace types: Velo
Parameters:
self (Velo) : Velo The profile object.
target (series Metric) : Metric The data aspect to analyse (Volume, Time, Velocity).
Returns:
cvd series float The final delta value.
cvdHi series float The historical high-water mark of the delta.
cvdLo series float The historical low-water mark of the delta.
Velo
Velo Composite Velocity Profile Controller.
Fields:
_vpVol (VPrf type from AustrianTradingMachine/LibVPrf/2) : LibVPrf.VPrf Engine A: Master Volume source.
_vpTime (VPrf type from AustrianTradingMachine/LibVPrf/2) : LibVPrf.VPrf Engine B: Time duration container (ms).
_vpVelo (VPrf type from AustrianTradingMachine/LibVPrf/2) : LibVPrf.VPrf Engine C: Scratchpad for velocity stats.
_aTime (array) : array Pointer alias to `vpTime.aBuy` (Time storage).
_valueArea (series float) : int Percentage of total volume to include in the Value Area (1..100)
_estimator (series PriceEst enum from AustrianTradingMachine/LibBrSt/1) : LibBrSt.PriceEst PDF model for distribution attribution.
_allot (series AllotMode) : AllotMode Attribution model (Classic or PDF).
_cdfSteps (series int) : int Integration resolution for PDF.
_isDirty (series bool) : bool Lazy evaluation flag for vpVelo.
BTC 1H Momentum + Near-Setup Alerts bigbeeukthis alert, sets up on 1h chart of BTC only. it alerts you to price action and when its close to a setup. it will then trigger again once the setup is ready
Projected 15min RVOLProjects RVOL every 15 minutes no matter what the timeframe you are using in the chart
Binary Ratio Table (30 tokens) - against 3 Benchmark TokensDescription:
This indicator compares the relative strength of 30 selected cryptocurrencies against three major benchmark assets — BTC, ETH, and SOL — using a ratio-based RSI system.
For each token, the script:
Calculates the ratio of the token’s price to each major (BTC, ETH, SOL).
Computes RSI(60) of the ratio, then compares its EMA(10) vs. Median(30).
Assigns a score of 1 (green) if EMA > Median (bullish) or 0 (red) if not (bearish).
Results are displayed in two color-coded tables showing all 30 tokens and their relative strength signals vs. BTC, ETH, and SOL.
A full JSON payload of all scores is also generated for webhook alerts or external automation.
Use Case:
Quickly assess which altcoins are outperforming or underperforming major crypto benchmarks. Ideal for relative strength rotation, momentum analysis, or automated portfolio filters.
Ratio Logic is adjustable in Pincescript
Gold-Silver Ratio (GSR) ComparatorUpdated to present silver as % of gold price. Otherwise identical function as previous version.
ATR (No Gap) - Advanced Volatility IndicatorA customizable Average True Range indicator that eliminates gap distortion between trading sessions, providing cleaner volatility measurements for intraday and swing traders.
Key Features:
Gap Filtering: Optional toggle to ignore overnight/weekend gaps that distort volatility readings
EMA Smoothing: Defaults to EMA for more responsive volatility tracking (also supports RMA and SMA)
Half ATR Display: Shows 50% ATR value for quick stop-loss and take-profit calculations
Clean Value Table: Real-time values displayed on chart with configurable decimal precision
Flexible Settings: Customize length, smoothing method, and display options
Ideal for:
Setting dynamic stop losses and take profits
Position sizing based on current volatility
Comparing gap vs. no-gap volatility measurements
Trading instruments with large overnight gaps (indices, forex, crypto)
Use this indicator to get a more accurate picture of intraday volatility without the noise from session gaps!
Live Higher TF Volume Ratio DashboardComparative intraday volume dashboard for 15 mins volume in any intraday timeframe
TrendDetectorLibLibrary "TrendDetector_Lib"
method formatTF(timeframe)
Namespace types: series string, simple string, input string, const string
Parameters:
timeframe (string) : (string) The timeframe to convert (e.g., "15", "60", "240").
Returns: (string) The formatted timeframe (e.g., "15M", "1H", "4H").
f_ma(type, src, len)
Computes a Moving Average value based on type and length.
Parameters:
type (simple string) : (string) One of: "SMA", "EMA", "RMA", "WMA", "VWMA".
src (float) : (series float) Source series for MA (e.g., close).
len (simple int) : (simple int) Length of the MA.
Returns: (float) The computed MA series.
render(tbl, trendDetectorSwitch, frameColor, frameWidth, borderColor, borderWidth, textColor, ma1ShowTrendData, ma1Timeframe, ma1Value, ma2ShowTrendData, ma2Timeframe, ma2Value, ma3ShowTrendData, ma3Timeframe, ma3Value)
Fills the provided table with Trend Detector contents.
@desc This renderer does NOT plot and does NOT create tables; call from indicator after your table exists.
Parameters:
tbl (table) : (table) Existing table to render into.
trendDetectorSwitch (bool) : (bool) Master toggle to draw the table content.
frameColor (color) : (color) Table frame color.
frameWidth (int) : (int) Table frame width (0–5).
borderColor (color) : (color) Table border color.
borderWidth (int) : (int) Table border width (0–5).
textColor (color) : (color) Table text color.
ma1ShowTrendData (bool) : (bool) Show MA #1 in table.
ma1Timeframe (simple string) : (string) MA #1 timeframe.
ma1Value (float)
ma2ShowTrendData (bool) : (bool) Show MA #2 in table.
ma2Timeframe (simple string) : (string) MA #2 timeframe.
ma2Value (float)
ma3ShowTrendData (bool) : (bool) Show MA #3 in table.
ma3Timeframe (simple string) : (string) MA #3 timeframe.
ma3Value (float)
square Level//@version=5
indicator("square Level", overlay=true)
for i = 2 to 30
squareLevel = i * i
line.new(bar_index,squareLevel,bar_index+1,squareLevel,extend = extend.both,color = color.green)






















