Trend Telescope v4 Basic Configuration
pine
// Enable only the components you need
Order Flow: ON
Delta Volume: ON
Volume Profile: ON
Cumulative Delta: ON
Volatility Indicator: ON
Momentum Direction: ON
Volatility Compression: ON
📊 Component Breakdown
1. Order Flow Analysis
Purpose: Identifies buying vs selling pressure
Visual: Histogram (Green=Buying, Red=Selling)
Calculation: Volume weighted by price position
Usage: Spot institutional order blocks
2. Delta Volume Values
Purpose: Shows volume imbalance
Bull Volume (Green): Volume on up bars
Bear Volume (Red): Volume on down bars
Usage: Identify volume divergences
3. Anchored Volume Profile
Purpose: Finds high-volume price levels
POC (Point of Control): Price with highest volume
Profile Length: Adjustable (default: 50 bars)
Usage: Identify support/resistance zones
4. Cumulative Volume Delta
Purpose: Tracks net buying/selling pressure over time
Trend Analysis: Rising=Buying pressure, Falling=Selling pressure
Divergence Detection: Price vs Delta divergences
Usage: Confirm trend strength
5. Volatility Indicator
Purpose: Measures market volatility with cycle detection
Volatility Ratio: ATR as percentage of price
Volatility Cycle: SMA of volatility (identifies periods)
Histogram: Difference between current and average volatility
Usage: Adjust position sizing, identify breakout setups
6. Real-time Momentum Direction
Purpose: Multi-factor momentum assessment
Components: Price momentum (50%), RSI momentum (30%), Volume momentum (20%)
Visual: Line plot with color coding
Labels: Clear BULLISH/BEARISH/NEUTRAL signals
Usage: Trend confirmation, reversal detection
7. Volatility Compression Analysis
Purpose: Identifies low-volatility consolidation periods
Compression Detection: True Range below threshold
Strength Meter: How compressed the market is
Histogram: Red when compressed, Gray when normal
Usage: Predict explosive moves, prepare for breakouts
⚙️ Advanced Configuration
Optimal Settings for Different Timeframes
pine
// Scalping (1-15 min)
Profile Length: 20
ATR Period: 10
Momentum Length: 8
Compression Threshold: 0.3
// Day Trading (1H-4H)
Profile Length: 50
ATR Period: 14
Momentum Length: 14
Compression Threshold: 0.5
// Swing Trading (Daily)
Profile Length: 100
ATR Period: 20
Momentum Length: 21
Compression Threshold: 0.7
Alert Setup Guide
Enable "Enable Alerts" in settings
Choose alert types:
Momentum Alerts: When momentum changes direction
Compression Alerts: When volatility compression begins
Set alert frequency to "Once Per Bar"
Configure notification preferences
🎯 Trading Strategies
Strategy 1: Compression Breakout
pine
Entry Conditions:
1. Volatility Compression shows RED histogram
2. Cumulative Delta trending upward
3. Momentum turns BULLISH
4. Price breaks above POC level
Exit: When Momentum turns BEARISH or Compression ends
Strategy 2: Momentum Reversal
pine
Entry Conditions:
1. Strong Order Flow in opposite direction
2. Momentum divergence (price makes new high/low but momentum doesn't)
3. Volume confirms the reversal
Exit: When Order Flow returns to trend direction
Strategy 3: Institutional Accumulation
pine
Identification:
1. High Cumulative Delta but flat/sideways price
2. Consistent Order Flow in one direction
3. Volume Profile shows accumulation at specific levels
Trade: Enter in direction of Order Flow when price breaks level
📈 Interpretation Guide
Bullish Signals
✅ Order Flow consistently green
✅ Cumulative Delta making higher highs
✅ Momentum above zero and rising
✅ Bull Volume > Bear Volume
✅ Price above POC level
Bearish Signals
✅ Order Flow consistently red
✅ Cumulative Delta making lower lows
✅ Momentum below zero and falling
✅ Bear Volume > Bull Volume
✅ Price below POC level
Caution Signals
⚠️ Momentum divergence (price vs indicator)
⚠️ Volatility compression (potential big move coming)
⚠️ Mixed signals across components
🔧 Troubleshooting
Common Issues & Solutions
Problem: Indicators not showing
Solution: Check "Show on Chart" is enabled
Problem: Alerts not triggering
Solution: Verify alert is enabled in both script and TradingView alert panel
Problem: Performance issues
Solution: Reduce number of enabled components or increase timeframe
Problem: Volume Profile not updating
Solution: Adjust Profile Length setting, ensure sufficient historical data
Performance Optimization
Disable unused components
Increase chart timeframe
Reduce historical bar count
Use on lower timeframes with fewer indicators enabled
💡 Pro Tips
Risk Management
Use Volatility Indicator for position sizing
Monitor Cumulative Delta for trend confirmation
Use POC levels for stop-loss placement
Multi-Timeframe Analysis
Use higher timeframe for trend direction
Use current timeframe for entry timing
Correlate signals across timeframes
Market Condition Adaptation
Trending Markets: Focus on Momentum + Order Flow
Ranging Markets: Focus on Volume Profile + Compression
High Volatility: Use smaller position sizes
Low Volatility: Prepare for compression breakouts
📚 Educational Resources
Key Concepts to Master
Volume-price relationships
Market microstructure
Institutional order flow
Volatility regimes
Momentum vs mean reversion
Recommended Learning Path
Start with Order Flow + Momentum only
Add Volume Profile once comfortable
Incorporate Volatility analysis
Master multi-component correlation
🆘 Support
Getting Help
Check component toggles are enabled
Verify sufficient historical data is loaded
Test on major pairs/indices first
Adjust settings for your trading style
Continuous Improvement
Backtest strategies thoroughly
Keep a trading journal
Adjust parameters based on market conditions
Combine with price action analysis
Remember: No indicator is perfect. Use this tool as part of a comprehensive trading plan with proper risk management. Always test strategies in demo accounts before live trading.
Happy Trading! 📈
지표 및 전략
Advanced MTF Dashboard with RSIThis is essentially an entire trading analysis workstation condensed into one indicator that gives you institutional-grade multi-timeframe analysis in a clean, actionable format
OTS Confirmation (RSI + Thrust)# OTS Confirmation Panel – Operator Guide
This guide covers `apps/tradingview/pine/panel_ots_confirmation.pine`, the companion
panel for the OTS Trend Suite. It explains how to deploy the script, decode every visual
layer, tune the inputs for different markets, and wire alerts for automated workflows.
Use this doc when onboarding new analysts, preparing TradingView alerts, or logging QA
runs in `docs/qa/`.
---
## 1. Add the Panel to a Chart
1. In TradingView open **Pine Editor**, paste the contents of
`apps/tradingview/pine/panel_ots_confirmation.pine`, and click **Add to chart**.
2. The script renders as a non-overlay panel. Keep the default settings for a full
session to let the auto-calibration warm up.
3. Pair it with `overlay_ots_trend.pine` on the main chart. The panel acts as a momentum
confirmation layer for OTS structure calls.
4. Save your TradingView template so inputs reload automatically.
---
## 2. What the Panel Shows
| Layer | Engine | Interpretation | Typical Use |
| --- | --- | --- | --- |
| **RSI stack** (gray/orange/blue) | RSI(21/14/7) | Gray = slow regime, orange = baseline, blue = fast | Gauge momentum alignment; look for spreads between lines. |
| **RSI crosses** (“RSI↑” / “RSI↓”) | `ta.crossover` / `ta.crossunder` of RSI(14) against fast/slow envelopes | Momentum shifts inside larger structure | Pair with thrust color to time entries/exits. |
| **Divergence dots** (“Div↑” / “Div↓”) | Price vs RSI(14) over `look=20` bars | Early warning for exhaustion | Treat as heads-up; wait for thrust/RSI confirmation. |
| **Thrust columns** | Robust z-score of ATR-normalized price change × volume factor | Colored buckets flag institutional-like pressure | Immediate confirmation of impulsive moves. |
---
## 3. Input Reference
### 3.1 Momentum Stack
- `Source` – price series feeding the RSI trio (default `close`).
- `RSI Fast/Normal/Slow` – lookbacks for the fast (7), baseline (14), and slow (21)
curves. Keep the 3:2:1 ratio unless you have a strong reason to change it.
- `Show simple divergences` – toggles the divergence markers.
### 3.2 Thrust Engine
- `Thrust lookback (z-score)` – rolling window for the robust median/MAD statistics.
Smaller values react faster but can flicker in noisy tape.
- `Price ROC length` – horizon for price change (1 = bar-to-bar impulse).
- `Volume SMA for norm` – smooths volume before computing the relative weight.
### 3.3 Session Gating
- `Use RTH only (09:30–16:00 ET)` – restrict thrust calculations to the defined session.
- `RTH Session (exchange time)` – session string; defaults to U.S. equity hours.
- Under the hood the script uses `time()` to check whether the current bar belongs to the
session. Outside the session the thrust column paints blue and quantile buffers pause.
### 3.4 Auto Buckets
- `Auto thrust buckets (quantiles)` – enables rolling quantile calibration.
- `Auto bucket window` – sample length for quantiles (default 180 bars).
- `Green quantile (auto)` / `Orange quantile (auto)` – percentile thresholds that define
“meaningful” vs “extreme” thrust. Lower green or higher orange to tighten filters.
---
## 4. Thrust Computation Cheat Sheet
1. Compute ATR-normalized price move: `move = change(close, rocLen) / atr(14)`.
2. Scale by the square root of relative volume: `volNorm = volume / sma(volume, volSmaL)`.
3. Multiply: `raw = move * sqrt(volNorm)` to emphasize high-volume impulses.
4. Stabilize with robust statistics: subtract the rolling median and divide by MAD
(scaled by 1.4826 to map to σ).
5. Gate by session. If `Use RTH` is true, values outside the session revert to zero so
alerts do not spam during illiquid after-hours prints.
6. Quantile buckets update only during valid session bars, which prevents thin-tail
expansion on micro-cap tapes.
Color mapping:
- **Orange Up** – `z` exceeds the orange quantile → extreme bullish thrust.
- **Green** – `z` between green and orange thresholds → constructive buying pressure.
- **Blue** – outside session or neutral thrust.
- **Red** – `z` below `-green` → constructive selling pressure.
- **Orange Down** – `z` below `-orange` → extreme bearish thrust.
---
## 5. Playbooks
### 5.1 Trend Continuation (with Overlay)
1. Confirm OTS overlay track is lime (bullish) or red (bearish).
2. Wait for a matching RSI cross (`RSI↑` in longs, `RSI↓` in shorts).
3. Require the thrust column to print Green or Orange in the trade direction.
4. Scale out when thrust fades back to Blue or opposing RSI cross fires.
### 5.2 Reversal Scouts
1. Spot a divergence dot against the prevailing move.
2. Wait for thrust to flip from Orange/Red to Blue/Green plus an RSI cross confirmation.
3. Use tighter stops; reversals are lower probability unless the overlay also signals a
pivot (e.g., `B✓`/`T✓`).
### 5.3 Session-Aware Scalps
1. Keep `Use RTH` enabled on equities. The panel flags off-session bars as Blue so you
can ignore outliers.
2. For 24/7 assets (crypto, some FX), disable the gate or edit the session string to
match your synthetic “prime hours”.
3. If thrust never leaves Blue during valid hours, reduce `Auto bucket window` or lower
the quantile thresholds slightly.
---
## 6. Alerts
The script pre-registers four alerts so TradingView never drops them:
- **Thrust ORANGE Up** – extreme bullish thrust.
- **Thrust ORANGE Down** – extreme bearish thrust.
- **RSI Bullish Momentum** – `RSI(14)` crosses above both fast and slow anchors.
- **RSI Bearish Momentum** – `RSI(14)` crosses under both anchors.
To deploy: right-click the chart → **Add alert…** → choose this indicator and the alert
name → set message/routing. The panel exposes `Use RTH` as a guard, so alerts only fire
within session when the toggle is on.
---
## 7. Tuning & Troubleshooting
| Symptom | Likely Cause | Remedy |
| --- | --- | --- |
| Thrust columns stay blue all day | Session window excludes the instrument or auto buckets are too strict | Adjust session string or lower `Green/Orange quantile`. |
| Orange prints constantly | `Auto bucket window` too small or the asset is very volatile | Increase window or raise quantiles. |
| Divergence markers feel noisy | 20-bar lookback too tight | Increase the `look` constant in code or disable the toggle for automation. |
| Alerts firing after the bell | `Use RTH` disabled | Enable the toggle or update session hours. |
---
## 8. QA Checklist Before Publishing
1. **Warm-up pass** – load at least 200–250 bars so auto buckets stabilize.
2. **Session sanity** – confirm blue columns outside the chosen session, green/orange
inside when impulsive moves occur.
3. **Overlay sync** – run alongside the OTS overlay and capture screenshots where thrust
confirms `AVWM` entries or `T/B` confirms.
4. **Alert audit** – manually trigger each alert in replay mode and ensure they remain in
TradingView’s alert dropdown.
5. **QA notes** – log findings, symbol/timeframe coverage, and screenshots in
`docs/qa/-ots-confirmation.md`.
---
Keep this panel as a confirmation filter rather than a standalone signal generator.
Primary decisions should respect structure from the overlay; use thrust and RSI timing to
validate momentum before committing risk.
Levels[cz]Description
Levels is a proportional price grid indicator that draws adaptive horizontal levels based on higher timeframe (HTF) closes.
Instead of relying on swing highs/lows or pivots, it builds structured support and resistance zones using fixed percentage increments from a Daily, Weekly, or Monthly reference close.
This creates a consistent geometric framework that helps traders visualize price zones where reactions or consolidations often occur.
How It Works
The script retrieves the last HTF close (Daily/Weekly/Monthly).
It then calculates percentage-based increments (e.g., 0.5%, 1%, 2%, 4%) above and below that reference.
Each percentage forms a distinct “level group,” creating layered grids of potential reaction zones.
Levels are automatically filtered to avoid overlap between different groups, keeping the chart clean.
Visibility is dynamically controlled by timeframe:
Level 1 → up to 15m
Level 2 → up to 1h
Level 3 → up to 4h
Level 4 → up to 1D
This ensures the right amount of structural detail at every zoom level.
How to Use
Identify confluence zones where multiple levels cluster — often areas of strong liquidity or reversals.
Use the grid as a support/resistance map for entries, targets, and stop placement.
Combine with trend or momentum indicators to validate reactions at key price bands.
Adjust the percentage increments and reference timeframe to match the volatility of your instrument (e.g., smaller steps for crypto, larger for indices).
Concept
The indicator is based on the idea that markets move in proportional price steps, not random fluctuations.
By anchoring levels to a higher-timeframe close and expanding outward geometrically, Levels highlights recurring equilibrium and expansion zones — areas where traders can anticipate probable turning points or consolidations.
Features
4 customizable percentage-based level sets
Dynamic visibility by timeframe
Non-overlapping level hierarchy
Lightweight on performance
Fully customizable colors, styles, and widths
Supersonic Volatility & Momentum IndicatorChange/update the setting as per your trading requirements!
Puell Multiple Variants [OperationHeadLessChicken]Overview
This script contains three different, but related indicators to visualise Bitcoin miner revenue.
The classical Puell Multiple : historically, it has been good at signaling Bitcoin cycle tops and bottoms, but due to the diminishing rewards miners get after each halving, it is not clear how you determine overvalued and undervalued territories on it. Here is how the other two modified versions come into play:
Halving-Corrected Puell Multiple : The idea is to multiply the miner revenue after each halving with a correction factor, so overvalued levels are made comparable by a horizontal line across cycles. After experimentation, this correction factor turned out to be around 1.63. This brings cycle tops close to each other, but we lose the ability to see undervalued territories as a horizontal region. The third variant aims to fix this:
Miner Revenue Relative Strength Index (Miner Revenue RSI) : It uses RSI to map miner revenue into the 0-100 range, making it easy to visualise over/undervalued territories. With correct parameter settings, it eliminates the diminishing nature of the original Puell Multiple, and shows both over- and undervalued revenues correctly.
Example usage
The goal is to determine cycle tops and bottoms. I recommend using it on high timeframes, like monthly or weekly . Lower than that, you will see a lot of noise, but it could still be used. Here I use monthly as the example.
The classical Puell Multiple is included for reference. It is calculated as Miner Revenue divided by the 365-day Moving Average of the Miner Revenue . As you can see in the picture below, it has been good at signaling tops at 1,3,5,7.
The problems:
- I have to switch the Puell Multiple to a logarithmic scale
- Still, I cannot use a horizontal oversold territory
- 5 didn't touch the trendline, despite being a cycle top
- 9 touched the trendline despite not being a cycle top
Halving-Corrected Puell Multiple (yellow): Multiplies the Puell Multiple by 1.63 (a number determined via experimentation) after each halving. In the picture below, you can see how the Classical (white) and Corrected (yellow) Puell Multiples compare:
Advantages:
- Now you can set a constant overvalued level (12.49 in my case)
- 1,3,7 are signaled correctly as cycle tops
- 9 is correctly not signaled as a cycle top
Caveats:
- Now you don't have bottom signals anymore
- 5 is still not signaled as cycle top
Let's see if we can further improve this:
Miner Revenue RSI (blue):
On the monthly, you can see that an RSI period of 6, an overvalued threshold of 90, and an undervalued threshold of 35 have given historically pretty good signals.
Advantages:
- Uses two simple and clear horizontal levels for undervalued and overvalued levels
- Signaling 1,3,5,7 correctly as cycle tops
- Correctly does not signal 9 as a cycle top
- Signaling 4,6,8 correctly as cycle bottoms
Caveats:
- Misses two as a cycle bottom, although it was a long time ago when the Bitcoin market was much less mature
- In the past, gave some early overvalued signals
Usage
Using the example above, you can apply these indicators to any timeframe you like and tweak their parameters to obtain signals for overvalued/undervalued BTC prices
You can show or hide any of the three indicators individually
Set overvalued/undervalued thresholds for each => the background will highlight in green (undervalued) or red (overvalued)
Set special parameters for the given indicators: correction factor for the Corrected Puell and RSI period for Revenue RSI
Show or hide halving events on the indicator panel
All parameters and colours are adjustable
Combined MTF Dashboard with RSICombined MTF Dashboard with RSI which gives you time frames signal ang rsi indicator summary
Open Interest FaraGroup Editionopen interest for a closed group :)
An open interest chart is used, as well as additional functionality.
The ability to specify any data as a source, not just public interest.
AlgebraGeoLibraryLibrary "AlgebraGeoLibrary"
Algebra & 2D geometry utilities absent from Pine built-ins.
Rigorous, no-repaint, export-ready: vectors, robust roots, linear solvers, 2x2/3x3 det/inverse,
symmetric 2x2 eigensystem, orthogonal regression (TLS), affine transforms, intersections,
distances, projections, polygon metrics, point-in-polygon, convex hull (monotone chain),
Bezier/Catmull-Rom/Barycentric tools.
clamp(x, lo, hi)
clamp to
Parameters:
x (float)
lo (float)
hi (float)
near(a, b, atol, rtol)
approximately equal with relative+absolute tolerance
Parameters:
a (float)
b (float)
atol (float)
rtol (float)
sgn(x)
sign as {-1,0,1}
Parameters:
x (float)
hypot(x, y)
stable hypot (sqrt(x^2+y^2))
Parameters:
x (float)
y (float)
method length(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method length2(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method normalized(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method add(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method sub(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method muls(v, s)
Namespace types: Vec2
Parameters:
v (Vec2)
s (float)
method dot(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method crossz(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method rotate(v, ang)
Namespace types: Vec2
Parameters:
v (Vec2)
ang (float)
method apply(v, T)
Namespace types: Vec2
Parameters:
v (Vec2)
T (Affine2)
affine_identity()
identity transform
affine_translate(tx, ty)
translation
Parameters:
tx (float)
ty (float)
affine_rotate(ang)
rotation about origin
Parameters:
ang (float)
affine_scale(sx, sy)
scaling about origin
Parameters:
sx (float)
sy (float)
affine_rotate_about(ang, px, py)
rotation about pivot (px,py)
Parameters:
ang (float)
px (float)
py (float)
affine_compose(T2, T1)
compose T2∘T1 (apply T1 then T2)
Parameters:
T2 (Affine2)
T1 (Affine2)
quadratic_roots(a, b, c)
Real roots of ax^2 + bx + c = 0 (numerically stable)
Parameters:
a (float)
b (float)
c (float)
Returns: with n∈{0,1,2}; r1<=r2 when n=2.
cubic_roots(a, b, c, d)
Real roots of ax^3+bx^2+cx+d=0 (Cardano; returns up to 3 real roots)
Parameters:
a (float)
b (float)
c (float)
d (float)
Returns: (valid r2/r3 only if n>=2/n>=3)
det2(a, b, c, d)
det2 of
Parameters:
a (float)
b (float)
c (float)
d (float)
inv2(a, b, c, d)
inverse of 2x2; returns
Parameters:
a (float)
b (float)
c (float)
d (float)
solve2(a, b, c, d, e, f)
solve 2x2 * = via Cramer
Parameters:
a (float)
b (float)
c (float)
d (float)
e (float)
f (float)
det3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
det3 of 3x3
Parameters:
a11 (float)
a12 (float)
a13 (float)
a21 (float)
a22 (float)
a23 (float)
a31 (float)
a32 (float)
a33 (float)
inv3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
inverse 3x3; returns
Parameters:
a11 (float)
a12 (float)
a13 (float)
a21 (float)
a22 (float)
a23 (float)
a31 (float)
a32 (float)
a33 (float)
eig2_symmetric(a, b, d)
symmetric 2x2 eigensystem: [ , ]
Parameters:
a (float)
b (float)
d (float)
Returns: with unit eigenvectors
tls_line(xs, ys)
Orthogonal (total least squares) regression line through point cloud
Input arrays must be same length N>=2. Returns line in normal form n•x + c = 0
Parameters:
xs (array)
ys (array)
Returns: where (nx,ny) unit normal; (cx,cy) centroid.
orient(a, b, c)
orientation (signed area*2): >0 CCW, <0 CW, 0 collinear
Parameters:
a (Vec2)
b (Vec2)
c (Vec2)
project_point_line(p, a, d)
project point p onto infinite line through a with direction d
Parameters:
p (Vec2)
a (Vec2)
d (Vec2)
Returns: where proj = a + t*d
closest_point_segment(p, a, b)
closest point on segment to p
Parameters:
p (Vec2)
a (Vec2)
b (Vec2)
Returns: where t∈ on segment
dist_point_line(p, a, d)
distance from point to line (infinite)
Parameters:
p (Vec2)
a (Vec2)
d (Vec2)
dist_point_segment(p, a, b)
distance from point to segment
Parameters:
p (Vec2)
a (Vec2)
b (Vec2)
intersect_lines(p1, d1, p2, d2)
line-line intersection: L1: p1+d1*t, L2: p2+d2*u
Parameters:
p1 (Vec2)
d1 (Vec2)
p2 (Vec2)
d2 (Vec2)
Returns:
intersect_segments(s1, s2)
segment-segment intersection (closed segments)
Parameters:
s1 (Segment2)
s2 (Segment2)
Returns: where kind: 0=no, 1=proper point, 2=overlap (ix/iy=na)
circumcircle(a, b, c)
circle through 3 non-collinear points
Parameters:
a (Vec2)
b (Vec2)
c (Vec2)
intersect_circle_line(C, p, d)
intersections of circle and line (param p + d t)
Parameters:
C (Circle2)
p (Vec2)
d (Vec2)
Returns: with n∈{0,1,2}
intersect_circles(A, B)
circle-circle intersection
Parameters:
A (Circle2)
B (Circle2)
Returns: with n∈{0,1,2}
polygon_area(xs, ys)
signed area (shoelace). Positive if CCW.
Parameters:
xs (array)
ys (array)
polygon_centroid(xs, ys)
polygon centroid (for non-self-intersecting). Fallback to vertex mean if area≈0.
Parameters:
xs (array)
ys (array)
point_in_polygon(px, py, xs, ys)
point-in-polygon test (ray casting). Returns true if inside; boundary counts as inside.
Parameters:
px (float)
py (float)
xs (array)
ys (array)
convex_hull(xs, ys)
convex hull (monotone chain). Returns array of hull vertex indices in CCW order.
Uses array.sort_indices(xs) (ascending by x). Ties on x are handled; result is deterministic.
Parameters:
xs (array)
ys (array)
lerp(a, b, t)
linear interpolate between a and b
Parameters:
a (float)
b (float)
t (float)
bezier2(p0, p1, p2, t)
quadratic Bezier B(t) for points p0,p1,p2
Parameters:
p0 (Vec2)
p1 (Vec2)
p2 (Vec2)
t (float)
bezier3(p0, p1, p2, p3, t)
cubic Bezier B(t) for p0,p1,p2,p3
Parameters:
p0 (Vec2)
p1 (Vec2)
p2 (Vec2)
p3 (Vec2)
t (float)
catmull_rom(p0, p1, p2, p3, t, alpha)
Catmull-Rom interpolation (centripetal form when alpha=0.5)
t∈ , returns point between p1 and p2
Parameters:
p0 (Vec2)
p1 (Vec2)
p2 (Vec2)
p3 (Vec2)
t (float)
alpha (float)
barycentric(A, B, C, P)
barycentric coordinates of P wrt triangle ABC
Parameters:
A (Vec2)
B (Vec2)
C (Vec2)
P (Vec2)
Returns:
point_in_triangle(A, B, C, P)
point-in-triangle using barycentric (boundary included)
Parameters:
A (Vec2)
B (Vec2)
C (Vec2)
P (Vec2)
Vec2
Fields:
x (series float)
y (series float)
Line2
Fields:
p (Vec2)
d (Vec2)
Segment2
Fields:
a (Vec2)
b (Vec2)
Circle2
Fields:
c (Vec2)
r (series float)
Affine2
Fields:
a (series float)
b (series float)
c (series float)
d (series float)
tx (series float)
ty (series float)
OscLibraryLibrary "OscLibrary"
Non‑native oscillators & math for Pine v6: Ehlers Super Smoother & Roofing, Hilbert/homodyne period,
DSP biquads (LP/HP/BP/Notch), Goertzel power, Haar detail (wavelet‑style), robust z/Fisher, FRAMA,
Laguerre filter + Laguerre RSI, Autocorrelation Periodogram dominant period, DPO, WaveTrend‑style.
clamp(x, lo, hi)
Clamp to
Parameters:
x (float)
lo (float)
hi (float)
tanh(x)
Parameters:
x (float)
f_atan2_custom(y, x)
Parameters:
y (float)
x (float)
wrap_pi(ang)
Wrap angle to (-pi, pi]
Parameters:
ang (float)
scale_minmax(x, len)
Window min‑max scale to
Parameters:
x (float)
len (simple int)
zscore_robust(x, len)
Robust z‑score using rolling median & MAD
z = (x - median) / (1.4826 * MAD)
Parameters:
x (float)
len (simple int)
fisher_rank(x, len)
Fisher transform of rolling percent‑rank (no simplifications)
Parameters:
x (float)
len (simple int)
ift_rsi(x, rsiLen, smoothLen)
Classic IFT of RSI
Parameters:
x (float)
rsiLen (simple int)
smoothLen (simple int)
biquad_lp(x, f0_cpb, Q)
2‑pole low‑pass
Parameters:
x (float)
f0_cpb (float)
Q (float)
biquad_hp(x, f0_cpb, Q)
2‑pole high‑pass
Parameters:
x (float)
f0_cpb (float)
Q (float)
biquad_bp(x, f0_cpb, Q)
2‑pole band‑pass (constant skirt gain)
Parameters:
x (float)
f0_cpb (float)
Q (float)
biquad_notch(x, f0_cpb, Q)
2‑pole notch
Parameters:
x (float)
f0_cpb (float)
Q (float)
ssf(x, period)
Ehlers Super Smoother (2‑pole low‑lag LP)
Parameters:
x (float)
period (simple int)
highpass_ehlers(x, cutoffPeriod)
Ehlers high‑pass (first stage of Roofing)
Parameters:
x (float)
cutoffPeriod (simple int)
roofing(x, hpCutoff, lpPeriod)
Roofing filter: HP (long‑cycle reject) → Super Smoother
Parameters:
x (float)
hpCutoff (simple int)
lpPeriod (simple int)
hilbert_quadrature(src)
Short Hilbert quadrature on a smoothed series
Parameters:
src (float)
homodyne_period(src, floorP, ceilP)
Homodyne instantaneous period (bars) with smoothing
Parameters:
src (float)
floorP (simple int)
ceilP (simple int)
sine_leadsine(src)
Sine & lead‑sine oscillator from HT phase
Parameters:
src (float)
goertzel_power(x, f0_cpb, r)
Goertzel single‑bin spectral power (forgetting r∈(0,1))
Parameters:
x (float)
f0_cpb (float)
r (float)
frama_alpha(x, length, fast, slow)
FRAMA alpha via fractal dimension (Ehlers)
Parameters:
x (float)
length (simple int)
fast (simple int)
slow (simple int)
frama(x, length, fast, slow)
FRAMA smoother (EMA with alpha from FD)
Parameters:
x (float)
length (simple int)
fast (simple int)
slow (simple int)
laguerre(x, gamma)
4‑element Laguerre filter (gamma in [0,1))
Parameters:
x (float)
gamma (float)
laguerre_rsi(x, gamma)
Laguerre RSI (bounded 0..1)
Parameters:
x (float)
gamma (float)
acf_dominant_period(x, minP, maxP, corrLen)
Dominant period from normalized autocorrelation peaks
Uses Pearson correlation as normalized ACF proxy over 'corrLen' bars.
minP/maxP bound the search range. corrLen should be >= maxP*2.
Parameters:
x (float)
minP (simple int)
maxP (simple int)
corrLen (simple int)
dpo(x, length)
Detrended Price Oscillator (centered SMA lag)
Parameters:
x (float)
length (simple int)
wavetrend(h, l, c, chLen, avgLen)
WaveTrend‑style oscillator (inputs explicit)
Parameters:
h (float)
l (float)
c (float)
chLen (simple int)
avgLen (simple int)
rescale(x, fromLo, fromHi, toLo, toHi, clip)
Rescale x from to . Handles reversed domains; optional clipping.
Parameters:
x (float)
fromLo (float)
fromHi (float)
toLo (float)
toHi (float)
clip (simple bool)
zscore_std(x, len)
Classic rolling z-score using SMA/STD (sample stdev). Guard zero-variance.
Parameters:
x (float)
len (simple int)
ema_alpha(x, alpha)
EMA with dynamic alpha ∈ . No simplifications; stable init.
Parameters:
x (float)
alpha (float)
zlema(x, length)
Zero-Lag EMA (ZLEMA). Uses lag = round((L-1)/2) and exact 2*x - x prefilter.
Parameters:
x (float)
length (simple int)
hullma(x, length)
Hull Moving Average (HMA) with round() for half and sqrt windows per standard definition.
Parameters:
x (float)
length (simple int)
pct_change(x, len)
Relative change over len bars. Uses exact previous value (sign-preserving); guards zero.
Parameters:
x (float)
len (simple int)
normalize_by_atr(delta, atrLen)
Normalize a delta by ATR(len) → "ATR units" (volatility-normalized). Guards zero ATR.
Parameters:
delta (float)
atrLen (simple int)
smoothstep(x, edge0, edge1)
Smoothstep gate: x∈ → with C1 continuity; robust to equal edges.
Parameters:
x (float)
edge0 (float)
edge1 (float)
biquad_lp_period(x, period_bars, Q)
Parameters:
x (float)
period_bars (float)
Q (float)
biquad_hp_period(x, period_bars, Q)
Parameters:
x (float)
period_bars (float)
Q (float)
biquad_bp_period(x, centerPeriod_bars, Q)
Parameters:
x (float)
centerPeriod_bars (float)
Q (float)
biquad_notch_period(x, centerPeriod_bars, Q)
Parameters:
x (float)
centerPeriod_bars (float)
Q (float)
biquad_bp_between(x, periodLow_bars, periodHigh_bars)
Band-pass by specifying low/high periods (pass between 1/pHigh and 1/pLow).
Computes center f0 = sqrt(fLo*fHi) and Q = f0 / BW (constant-skirt RBJ form).
Parameters:
x (float)
periodLow_bars (float)
periodHigh_bars (float)
angle_diff(a, b)
Parameters:
a (float)
b (float)
rad2deg(r)
Parameters:
r (float)
deg2rad(d)
Parameters:
d (float)
MathLibraryLibrary "MathLibrary"
Algebra & 2D geometry utilities absent from Pine built-ins.
Rigorous, no-repaint, export-ready: vectors, robust roots, linear solvers, 2x2/3x3 det/inverse,
symmetric 2x2 eigensystem, orthogonal regression (TLS), affine transforms, intersections,
distances, projections, polygon metrics, point-in-polygon, convex hull (monotone chain),
Bezier/Catmull-Rom/Barycentric tools.
clamp(x, lo, hi)
clamp to
Parameters:
x (float)
lo (float)
hi (float)
near(a, b, atol, rtol)
approximately equal with relative+absolute tolerance
Parameters:
a (float)
b (float)
atol (float)
rtol (float)
sgn(x)
sign as {-1,0,1}
Parameters:
x (float)
hypot(x, y)
stable hypot (sqrt(x^2+y^2))
Parameters:
x (float)
y (float)
method length(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method length2(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method normalized(v)
Namespace types: Vec2
Parameters:
v (Vec2)
method add(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method sub(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method muls(v, s)
Namespace types: Vec2
Parameters:
v (Vec2)
s (float)
method dot(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method crossz(a, b)
Namespace types: Vec2
Parameters:
a (Vec2)
b (Vec2)
method rotate(v, ang)
Namespace types: Vec2
Parameters:
v (Vec2)
ang (float)
method apply(v, T)
Namespace types: Vec2
Parameters:
v (Vec2)
T (Affine2)
affine_identity()
identity transform
affine_translate(tx, ty)
translation
Parameters:
tx (float)
ty (float)
affine_rotate(ang)
rotation about origin
Parameters:
ang (float)
affine_scale(sx, sy)
scaling about origin
Parameters:
sx (float)
sy (float)
affine_rotate_about(ang, px, py)
rotation about pivot (px,py)
Parameters:
ang (float)
px (float)
py (float)
affine_compose(T2, T1)
compose T2∘T1 (apply T1 then T2)
Parameters:
T2 (Affine2)
T1 (Affine2)
quadratic_roots(a, b, c)
Real roots of ax^2 + bx + c = 0 (numerically stable)
Parameters:
a (float)
b (float)
c (float)
Returns: with n∈{0,1,2}; r1<=r2 when n=2.
cubic_roots(a, b, c, d)
Real roots of ax^3+bx^2+cx+d=0 (Cardano; returns up to 3 real roots)
Parameters:
a (float)
b (float)
c (float)
d (float)
Returns: (valid r2/r3 only if n>=2/n>=3)
det2(a, b, c, d)
det2 of
Parameters:
a (float)
b (float)
c (float)
d (float)
inv2(a, b, c, d)
inverse of 2x2; returns
Parameters:
a (float)
b (float)
c (float)
d (float)
solve2(a, b, c, d, e, f)
solve 2x2 * = via Cramer
Parameters:
a (float)
b (float)
c (float)
d (float)
e (float)
f (float)
det3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
det3 of 3x3
Parameters:
a11 (float)
a12 (float)
a13 (float)
a21 (float)
a22 (float)
a23 (float)
a31 (float)
a32 (float)
a33 (float)
inv3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
inverse 3x3; returns
Parameters:
a11 (float)
a12 (float)
a13 (float)
a21 (float)
a22 (float)
a23 (float)
a31 (float)
a32 (float)
a33 (float)
eig2_symmetric(a, b, d)
symmetric 2x2 eigensystem: [ , ]
Parameters:
a (float)
b (float)
d (float)
Returns: with unit eigenvectors
tls_line(xs, ys)
Orthogonal (total least squares) regression line through point cloud
Input arrays must be same length N>=2. Returns line in normal form n•x + c = 0
Parameters:
xs (array)
ys (array)
Returns: where (nx,ny) unit normal; (cx,cy) centroid.
orient(a, b, c)
orientation (signed area*2): >0 CCW, <0 CW, 0 collinear
Parameters:
a (Vec2)
b (Vec2)
c (Vec2)
project_point_line(p, a, d)
project point p onto infinite line through a with direction d
Parameters:
p (Vec2)
a (Vec2)
d (Vec2)
Returns: where proj = a + t*d
closest_point_segment(p, a, b)
closest point on segment to p
Parameters:
p (Vec2)
a (Vec2)
b (Vec2)
Returns: where t∈ on segment
dist_point_line(p, a, d)
distance from point to line (infinite)
Parameters:
p (Vec2)
a (Vec2)
d (Vec2)
dist_point_segment(p, a, b)
distance from point to segment
Parameters:
p (Vec2)
a (Vec2)
b (Vec2)
intersect_lines(p1, d1, p2, d2)
line-line intersection: L1: p1+d1*t, L2: p2+d2*u
Parameters:
p1 (Vec2)
d1 (Vec2)
p2 (Vec2)
d2 (Vec2)
Returns:
intersect_segments(s1, s2)
segment-segment intersection (closed segments)
Parameters:
s1 (Segment2)
s2 (Segment2)
Returns: where kind: 0=no, 1=proper point, 2=overlap (ix/iy=na)
circumcircle(a, b, c)
circle through 3 non-collinear points
Parameters:
a (Vec2)
b (Vec2)
c (Vec2)
intersect_circle_line(C, p, d)
intersections of circle and line (param p + d t)
Parameters:
C (Circle2)
p (Vec2)
d (Vec2)
Returns: with n∈{0,1,2}
intersect_circles(A, B)
circle-circle intersection
Parameters:
A (Circle2)
B (Circle2)
Returns: with n∈{0,1,2}
polygon_area(xs, ys)
signed area (shoelace). Positive if CCW.
Parameters:
xs (array)
ys (array)
polygon_centroid(xs, ys)
polygon centroid (for non-self-intersecting). Fallback to vertex mean if area≈0.
Parameters:
xs (array)
ys (array)
Vec2
Fields:
x (series float)
y (series float)
Line2
Fields:
p (Vec2)
d (Vec2)
Segment2
Fields:
a (Vec2)
b (Vec2)
Circle2
Fields:
c (Vec2)
r (series float)
Affine2
Fields:
a (series float)
b (series float)
c (series float)
d (series float)
tx (series float)
ty (series float)
MALibraryLibrary "MALibrary"
sma(src, len)
sma
Parameters:
src (float)
len (int)
ema(src, len)
ema
Parameters:
src (float)
len (simple int)
wma(src, len)
wma
Parameters:
src (float)
len (int)
rma(src, len)
rma
Parameters:
src (float)
len (simple int)
vwma(src, len)
vwma
Parameters:
src (float)
len (int)
hma(src, len)
hma
Parameters:
src (float)
len (simple int)
alma(src, len, offset, sigma)
alma
Parameters:
src (float)
len (int)
offset (simple float)
sigma (simple float)
lsma(src, len)
lsma
Parameters:
src (float)
len (int)
rolling_median(src, len)
rolling_median
Parameters:
src (float)
len (int)
fibma(src, len)
fibma
/ Guessed implementation for 'FIB' ribbons (WMA to differ from GMMA).
Parameters:
src (float)
len (int)
dema(src, len)
dema
Parameters:
src (float)
len (simple int)
tema(src, len)
tema
Parameters:
src (float)
len (simple int)
t3(src, len, vFactor)
t3
Parameters:
src (float)
len (simple int)
vFactor (float)
ehma(src, len)
ehma
Parameters:
src (float)
len (simple int)
zlema(src, len)
zlema
Parameters:
src (float)
len (simple int)
zlhma(src, len)
zlhma
Parameters:
src (float)
len (simple int)
dwma(src, len)
dwma
Parameters:
src (float)
len (int)
dswma(src, len)
dswma
Parameters:
src (float)
len (simple int)
emm(src, len1, len2)
emm
Parameters:
src (float)
len1 (int)
len2 (simple int)
swma_sine(src, len)
swma_sine
Parameters:
src (float)
len (int)
pwma_parabolic(src, len)
pwma_parabolic
Parameters:
src (float)
len (int)
gaussma(src, len, sigmaF)
gaussma
Parameters:
src (float)
len (int)
sigmaF (float)
nlwma(src, len, power)
nlwma
Parameters:
src (float)
len (int)
power (float)
sincma(src, len, cutoff)
sincma
Parameters:
src (float)
len (int)
cutoff (float)
spma_15(src)
spma_15
Parameters:
src (float)
cgma(src, len)
cgma
Parameters:
src (float)
len (int)
fsma(src, len, harmonics)
fsma
Parameters:
src (float)
len (int)
harmonics (int)
sema_centered(src, len, useRepaint)
sema_centered
Parameters:
src (float)
len (simple int)
useRepaint (bool)
zpdf(src, len, cutoff, useRepaint)
zpdf
/ Zero-lag (windowed-sinc) filter. When useRepaint=true, returns the centered value via historical shift (no future indexing).
Parameters:
src (float)
len (int)
cutoff (float)
useRepaint (bool)
swma_centered(src, len, useRepaint)
swma_centered
Parameters:
src (float)
len (int)
useRepaint (bool)
mcginley(src, len)
mcginley
Parameters:
src (float)
len (int)
vidya(src, len, len_vol)
vidya
Parameters:
src (float)
len (int)
len_vol (int)
kama(src, len, fast, slow)
kama
Parameters:
src (float)
len (int)
fast (int)
slow (int)
gma_geo(src, len)
gma_geo
Parameters:
src (float)
len (simple int)
super_smoother(src, len)
super_smoother
Parameters:
src (float)
len (int)
laguerre(src, gamma)
laguerre
Parameters:
src (float)
gamma (float)
laguerre_adaptive(src, len)
laguerre_adaptive
Parameters:
src (float)
len (int)
itl(src)
itl
Parameters:
src (float)
decycler(src, len)
decycler
Parameters:
src (float)
len (int)
dcfma(src, len)
dcfma
Parameters:
src (float)
len (int)
frama(src, len)
frama
Parameters:
src (float)
len (int)
arma_adaptive(src, len)
arma_adaptive
Parameters:
src (float)
len (int)
ass(src, len)
ass (Adaptive Super Smoother)
Parameters:
src (float)
len (int)
azlema(src, len)
azlema
Parameters:
src (float)
len (int)
kfma(src, q, r)
kfma
Parameters:
src (float)
q (float)
r (float)
albma(src, min_len, max_len, atr_len)
albma (NEW)
/ Adaptive Lookback MA using ATR; higher ATR → shorter lookback.
Parameters:
src (float)
min_len (int)
max_len (int)
atr_len (simple int)
fdima(src, len)
fdima
Parameters:
src (float)
len (int)
nma(src_ma, len)
nma
Parameters:
src_ma (float)
len (int)
cma_corrected(src_ma, g)
cma_corrected
Parameters:
src_ma (float)
g (float)
rfma(src, len)
rfma
Parameters:
src (float)
len (simple int)
rsdma(src, len)
rsdma
Parameters:
src (float)
len (int)
sdama(src, len)
sdama
Parameters:
src (float)
len (int)
corma(src, ext_src, len)
corma
Parameters:
src (float)
ext_src (float)
len (int)
evma(src, len)
evma
Parameters:
src (float)
len (simple int)
vama(src, len)
vama (NEW)
/ Volume-Adjusted Moving Average (VIDYA-style using relative volume).
Parameters:
src (float)
len (int)
ivwma(src, len)
ivwma
Parameters:
src (float)
len (int)
vrocma(src, len1, len2)
vrocma
Parameters:
src (float)
len1 (int)
len2 (int)
vtwap(len)
vtwap
Parameters:
len (int)
gvwma(src, len)
gvwma
Parameters:
src (float)
len (int)
pvdma(src, len)
pvdma
Parameters:
src (float)
len (int)
hampel_mean(src, len, thr, k, ma_type)
hampel_mean
Parameters:
src (float)
len (simple int)
thr (float)
k (float)
ma_type (string)
hlma(len)
hlma
Parameters:
len (simple int)
hlmma(len)
hlmma
Parameters:
len (simple int)
mpma(len)
mpma
Parameters:
len (int)
hvma(len)
hvma
Parameters:
len (int)
ema_slope(src, len)
ema_slope
Parameters:
src (float)
len (simple int)
Wick Bias - by TenAMTraderWick Bias - by TenAMTrader
Wick Bias helps traders quickly visualize market pressure by analyzing candle wicks and bodies over a user-defined number of bars. By comparing top and bottom wicks, the indicator identifies whether buying or selling pressure has been dominant, providing a clear Indicator Bias signal (Bullish, Bearish, or Neutral).
Key Features:
Shows Top Wicks %, Bottom Wicks %, and optional Body % for recent candles.
Highlights Indicator Bias to indicate short-term market trends.
Fully customizable colors for table rows and bias labels.
Option to show or hide body percentage.
Alerts trigger on bias flips, with optional on-chart labels.
Table can be placed in any chart corner.
Updates in real-time with each new bar.
Recommended Use:
Ideal for intraday and swing traders looking for a quick visual cue of short-term market momentum.
Can be combined with other technical analysis tools to confirm trade setups or potential reversals.
Disclaimer / Legal Notice:
This indicator is for educational and informational purposes only. It is not financial advice and should not be used as the sole basis for trading decisions. Past performance does not guarantee future results. Users are responsible for their own trades. The developer is not liable for any losses or damages resulting from the use of this indicator.
Historical Vertical Lines 17:00-20:30Historical Vertical Lines 17:00-20:30. These lines show this specific time. You can edit the times via pine script. Easy.
Daily 200EMA on Intraday ChartsThis indicator shows the 200 EMA from the Daily Chart onto an intraday chart of your choice
Flexible MA Crossrotemtuyunmhv kebh unfhrv ak nbhu, ftar vo jumu, t, vnnumg bg fkph ngkv uaucru, gkph nyv
EMA 10/20This serves to include the EMA 10 and EMA 20 in one indicator rather than use 2 separate indicators for convenience purpose.
testLibLibrary "testLib"
TODO: add library description here
mySMA(x)
TODO: add function description here
Parameters:
x (int) : TODO: add parameter x description here
Returns: TODO: add what function returns
livremySMATestLibLibrary "livremySMATestLib"
TODO: add library description here
mySMA(x)
TODO: add function description here
Parameters:
x (int) : TODO: add parameter x description here
Returns: TODO: add what function returns
ADX MA Filter for Choppy MarketsA clear way to see expanding markets and identify contracting markets or chop