First-Move-Wrong Toolkit [CHE] First-Move-Wrong Toolkit — Session-bound sweep rejection with structure confirmation
Summary
This indicator marks potential “first move wrong” reversals during a defined trading session. It looks for a quick sweep beyond the prior day high or low, or the opening range high or low, followed by rejection and a basic structure confirmation. Optional rules require a retest and a VWAP reclaim in the direction of the trade idea. The script renders session levels as right-extended lines, signals as labels, optional SL/TP guide lines for visualization, and background tints during sweep events. Pivots are confirmed using swing width, which reduces repaint risk compared to live swings.
Motivation: Why this design?
Intraday reversals often start with a liquidity sweep around obvious highs or lows. Acting on the sweep alone can be noisy, while waiting for structure break and a retest can be slow. This tool balances both by checking a sweep and rejection at session-relevant levels, then requiring a simple structure cue and, optionally, a retest and a VWAP filter. The goal is a clear, rule-based signal layer that is easy to audit on chart without hidden state.
What’s different vs. standard approaches?
Baseline reference: Simple sweep detectors or basic CHOCH markers that ignore session context and liquidity anchors.
Architecture differences:
Session-aware opening range tracking that finalizes after the chosen minutes from session start.
Daily previous high and low pulled without lookahead, then extended forward as visual anchors.
Confirmed pivot highs and lows to avoid repaint from live, unconfirmed swings.
Optional retest rule using crossover or crossunder at the trigger level.
Optional VWAP filter to demand reclaim in the intended direction.
Global label cooldown to prevent clusters of signals.
Practical effect: Fewer one-off flips around noisy levels, clearer alignment with session structure, and compact visual feedback through lines, labels, and tints.
How it works (technical)
Levels: During the defined session, the script builds an opening range high and low until the configured minute mark after session start, then freezes those levels for the day. It also fetches the previous day high and low from the daily timeframe without lookahead and extends them forward.
Sweep and rejection: A sweep is defined as price moving beyond a target level and then rejecting back inside on the same bar. The script checks this condition separately for highs and lows against opening range and previous-day levels.
Structure validation: Confirmed pivot highs and lows are computed using a symmetric swing width. A bearish idea requires a prior sweep of a high plus a break through the last confirmed swing low. A bullish idea requires a prior sweep of a low plus a break through the last confirmed swing high.
Optional retest: If enabled, a bearish signal needs a cross under the bearish trigger level; a bullish signal needs a cross over the bullish trigger level.
VWAP filter (optional): The script requires a reclaim of VWAP in the intended direction when enabled.
State handling: Opening range values, previous-day lines, and the label cooldown timestamp are stored in persistent variables. Lines are created once and updated each bar to extend forward.
Repaint considerations: Pivots confirm only after the specified swing width, reducing repaint. The daily level request is performed without lookahead. Signals use closed-bar checks implied by crossover and crossunder logic.
Parameter Guide
Session (local) — Defines the active trading window. Default nine to seventeen. Narrower windows focus on the main session drive.
Opening Range (min) — Minutes from session start to finalize OR levels. Default fifteen. Shorter values react faster; longer values stabilize levels.
Use PrevDay H/L levels — Toggle previous-day anchors. On by default.
Use OR H/L levels — Toggle opening range anchors. On by default.
Equal H/L tolerance (ticks) — Intended tolerance for equal highs or lows. Default one. (Unknown/Optional) in current signals.
Swing width — Bars on both sides for confirmed pivots. Default two. Larger values reduce noise but confirm later.
Require CHOCH after sweep — Enforces structure break after a sweep. On by default.
Prefer retest entries — Requires crossover or crossunder of the trigger level. On by default.
VWAP filter — Demands a reclaim of VWAP in signal direction. Off by default.
TP in R (guide) — Multiplier for visual TP guides. Default one. Visualization only.
Show levels / Show signals / Show R-guides — Rendering toggles. R-guides are visual aids, not orders.
Label cooldown (bars) — Minimum bars between labels. Default five. Higher values reduce clusters.
Palette inputs — Colors and transparencies for levels, labels, VWAP, and tints.
Reading & Interpretation
Lines: Dotted lines represent opening range high and low after the OR window completes. Dashed lines represent previous-day high and low.
Signals: “Long” labels appear after a low-side sweep with rejection and structure confirmation, subject to optional retest and VWAP rules. “Short” labels mirror this on the high side.
Background tints: Red-tinted bars indicate a high-side sweep and rejection. Green-tinted bars indicate a low-side sweep and rejection.
R-guides: Circles display a visual stop level at the bar extreme and a target guide based on the selected multiple. They are informational only.
Practical Workflows & Combinations
Session reversal scans: During the first hour, watch for sweeps around previous-day or opening range levels, then wait for structure confirmation and optional retest.
Trend following with filters: Combine signals with higher-timeframe structure or a moving average regime check. Ignore signals against the dominant regime.
Exits and stops: Use the visual stop as a reference near the sweep extreme; adapt the target guide to volatility and market conditions.
Multi-asset / Multi-TF: Works on intraday timeframes for liquid futures, indices, forex, and large-cap equities. Start with default settings and adjust swing width and OR minutes to instrument volatility.
Behavior, Constraints & Performance
Repaint/confirmation: Pivots confirm after the swing window completes. Signals occur only when conditions are met on closed bars.
security()/HTF: Daily previous-day levels are requested without lookahead to reduce repaint.
Resources: Uses persistent variables and line updates per bar; no heavy loops or arrays.
Known limits: Signals can arrive later when swing width is large. Gaps around session boundaries may distort OR levels. VWAP behavior may vary with partial sessions or illiquid assets.
Sensible Defaults & Quick Tuning
Starting point: Session nine to seventeen, opening range fifteen minutes, swing width two, CHOCH required, retest on, VWAP off, cooldown five bars.
Too many flips: Increase swing width, enable VWAP filter, or raise label cooldown.
Too sluggish: Reduce swing width or shorten the opening range window.
Too many session-level hits: Disable either previous-day levels or opening range levels to simplify context.
What this indicator is—and isn’t
This is a session-aware visualization and signal layer focused on sweep-plus-structure behavior. It is not a complete trading system and does not manage orders, risk, or portfolio exposure. Use it with market structure, risk limits, and execution rules that fit your process.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
อินดิเคเตอร์และกลยุทธ์
Orderblocks & BreakersThis indicator identifies potential Orderblocks and Breakers based on recent swing highs/lows and on the definition of ICT. It highlights areas where price may encounter supply or demand and it includes features to reduce noise from too many blocks.
How It Works
The indicator uses pivot points to detect swing highs and lows marking bullish and bearish Orderblocks when market structure breaks occur.
For bullish Orderblocks: It identifies the last down candle before a swing high is breached and confirms the Orderblock with a market structure break.
For bearish Orderblocks: It identifies the last up candle before a swing low is breached and confirms the Orderblock with a market structure break.
When price breaks through an Orderblock, it converts the respective Orderblock into Breaker and switches color.
The optional Chop Control feature helps filter out Breakers that lose relevance due to repeated price crossings. This is especially helpful when price doesn't respect the level as it hides it from being displayed.
Additionally the indicator allows filtering to show only Orderblocks or Breakers AND allows filtering to show only recent Orderblocks/Breakers for a cleaner chart.
Traders can adjust the following in the settings
- Swing detection length (the lower the more aggressive the pivot detection, the higher the less pivots are detected)
- Number of recent Orderblocks/Breakers to display
- Visibility of Orderblocks/Breakers
- Colors and opacity for each type of Block
Alerts
Alerts can be triggered when price touches an Orderblock/Breaker.
Usage
This indicator is suitable for traders analyzing price action across various markets and timeframes. Traders can use it to quickly identify key support/resistance zones, areas of interest for potential trade setups or for quick asset scouting without having to chart it all. Traders also have the option to show/hide as much as they wish, no matter if that is 30 blocks or only the very last one.
Volume Zonas S/R por Contratos (v6)Volume-Weighted Support & Resistance (Pine v6)
What it does?
This indicator builds dynamic support and resistance zones by aggregating **contracts traded (volume) across price buckets. Instead of relying on swing points alone, it identifies the price areas where the most activity actually happened, which often act as magnets (targets), buffers (bounces), or pivots (breaks).
How it works?
* Scans a user-defined lookback window of recent bars.
* Groups price into bins (bucket width = ticksPerBin × syminfo.mintick).
* Sums the number of contracts traded within each bin.
* Selects the Top N high-volume bins and draws them as zones (boxes) and/or center lines.
* Optional “recalculate only on close” mode to keep levels stable during live bars.
Key features
* Pine Script® v6 implementation with efficient arrays.
* Adjustable precision: control bin width in ticks to widen/narrow zones.
* Customizable lookback to balance freshness vs. statistical strength.
* Top levels count to avoid clutter while highlighting the heaviest areas.
* Clean visualization: colored boxes (opacity control) and central lines.
* No-repaint behavior when “Recalculate on Close” is enabled.
Why it’s useful?
*Objective levels: derived from where participants actually traded, not just where price visited.
*Context across regimes**: adapts as participation shifts (trend, range, post-news).
*Actionable confluence: combine with structure, momentum, or session timing to validate entries/exits.
* Risk framing: zones help define stops beyond noise and locate realistic targets.
Inputs (essentials)
* Lookback Bars: analysis window size.
* Ticks per Bin: zone thickness (price granularity).
* Levels Count: number of top volume zones to display.
* Show Boxes / Show Lines: choose your preferred visualization.
* Box Opacity / Line Width: style controls.
* Recalculate Only on Close: stabilizes levels intrabar.
*Best practices & tips
* For highly liquid futures, the `volume` field typically represents contracts, which maps 1:1 to participation.
* Increase Ticks per Bin if your market has wide spreads or frequent gaps.
* Use fewer Levels during fast markets to keep the chart readable.
* Look for reaction patterns at zones (rejection, acceptance, consolidation) rather than treating them as exact lines.
**Notes**
* Levels are relative to the chosen window. Larger windows yield “stronger” but slower-adapting zones; shorter windows adapt faster.
* This tool is intended for decision support. Always combine with your plan, risk limits, and market context.
*License / Availability
Published as Open-Source for transparency and learning. Feel free to clone, tweak bin logic, or extend with session filters and intensity heatmaps. Happy trading!
3-Step Liquidity Sweep Strategy — v6Bias: Uses an HTF EMA and (optionally) requires the EMA slope to agree. If price is above the HTF EMA (and slope up), bias is long; below (and slope down), bias is short.
Liquidity sweep: Detects a swing high/low using pivots. A sweep occurs when current price wicks beyond the last swing and (optionally) closes back inside the level (classic SFP).
Entry: You can enter on the sweep bar’s close or wait one bar for continuation confirmation. Stops go beyond the sweeping extreme with an ATR buffer; targets use a fixed R:R.
Trend Aligned SFP - 1D RVWAP - HyruTrend Aligned SFP - Hyru
A powerful combination of Swing Failure Patterns (SFP) detection with a Daily Rolling VWAP filter for trend-aligned trading signals.
Key Features:
Smart Filtering: Only shows bullish SFPs above the Rolling VWAP and bearish SFPs below it, eliminating counter-trend noise
Rolling VWAP: 24-period rolling VWAP on 1-hour timeframe (customizable) with standard deviation bands
SFP Detection: Identifies swing failures with volume validation options for higher-quality setups
Visual Clarity: Clean interface with color-coded trend zones, swing lines, and confirmation markers
Complete Alerts: Get notified on SFP detection and confirmation for both bullish and bearish patterns
How It Works:
The indicator combines SFP logic with a dynamic Rolling VWAP filter. This ensures you're only taking long setups when price is above the VWAP (bullish trend) and short setups when price is below (bearish trend), significantly improving trade quality and win rates.
Perfect for swing traders and scalpers looking for high-probability reversal setups aligned with the current trend direction.
DynLenLibLibrary "DynLenLib"
sum_dyn(src, len)
Parameters:
src (float)
len (int)
lag_dyn(src, len)
Parameters:
src (float)
len (int)
highest_dyn(src, len)
Parameters:
src (float)
len (int)
lowest_dyn(src, len)
Parameters:
src (float)
len (int)
var_dyn(src, len)
Parameters:
src (float)
len (int)
stdev_dyn(src, len)
Parameters:
src (float)
len (int)
hl2()
hlc3()
ohlc4()
sma_dyn(src, len)
Parameters:
src (float)
len (int)
ema_dyn(src, len)
Parameters:
src (float)
len (int)
rma_dyn(src, len)
Parameters:
src (float)
len (int)
smma_dyn(src, len)
Parameters:
src (float)
len (int)
wma_dyn(src, len)
Parameters:
src (float)
len (int)
vwma_dyn(price, vol, len)
Parameters:
price (float)
vol (float)
len (int)
hma_dyn(src, len)
Parameters:
src (float)
len (int)
dema_dyn(src, len)
Parameters:
src (float)
len (int)
tema_dyn(src, len)
Parameters:
src (float)
len (int)
kama_dyn(src, erLen, fastLen, slowLen)
Parameters:
src (float)
erLen (int)
fastLen (int)
slowLen (int)
mcginley_dyn(src, len)
Parameters:
src (float)
len (int)
median_price()
true_range()
atr_dyn(len)
Parameters:
len (int)
bbands_dyn(src, len, mult)
Parameters:
src (float)
len (int)
mult (float)
bb_percent_b(src, len, mult)
Parameters:
src (float)
len (int)
mult (float)
bb_bandwidth(src, len, mult)
Parameters:
src (float)
len (int)
mult (float)
keltner_dyn(src, lenEMA, lenATR, multATR)
Parameters:
src (float)
lenEMA (int)
lenATR (int)
multATR (float)
donchian_dyn(len)
Parameters:
len (int)
choppiness_index(len)
Parameters:
len (int)
vol_stop(lenATR, mult)
Parameters:
lenATR (int)
mult (float)
roc_dyn(src, len)
Parameters:
src (float)
len (int)
rsi_dyn(src, len)
Parameters:
src (float)
len (int)
stoch_dyn(kLen, dLen, smoothK)
Parameters:
kLen (int)
dLen (int)
smoothK (int)
stoch_rsi_dyn(rsiLen, stochLen, kSmooth, dLen)
Parameters:
rsiLen (int)
stochLen (int)
kSmooth (int)
dLen (int)
cci_dyn(src, len)
Parameters:
src (float)
len (int)
cmo_dyn(src, len)
Parameters:
src (float)
len (int)
trix_dyn(len)
Parameters:
len (int)
tsi_dyn(shortLen, longLen)
Parameters:
shortLen (int)
longLen (int)
ultimate_osc(len1, len2, len3)
Parameters:
len1 (int)
len2 (int)
len3 (int)
dpo_dyn(src, len)
Parameters:
src (float)
len (int)
willr_dyn(len)
Parameters:
len (int)
macd_dyn(src, fastLen, slowLen, sigLen)
Parameters:
src (float)
fastLen (int)
slowLen (int)
sigLen (int)
ppo_dyn(src, fastLen, slowLen, sigLen)
Parameters:
src (float)
fastLen (int)
slowLen (int)
sigLen (int)
aroon_dyn(len)
Parameters:
len (int)
dmi_adx_dyn(diLen, adxLen)
Parameters:
diLen (int)
adxLen (int)
vortex_dyn(len)
Parameters:
len (int)
coppock_dyn(rocLen1, rocLen2, wmaLen)
Parameters:
rocLen1 (int)
rocLen2 (int)
wmaLen (int)
rvi_dyn(len)
Parameters:
len (int)
price_osc_dyn(src, fastLen, slowLen)
Parameters:
src (float)
fastLen (int)
slowLen (int)
rci_dyn(src, len)
Parameters:
src (float)
len (int)
obv()
pvt()
cmf_dyn(len)
Parameters:
len (int)
adl()
chaikin_osc_dyn(fastLen, slowLen)
Parameters:
fastLen (int)
slowLen (int)
mfi_dyn(len)
Parameters:
len (int)
volume_osc_dyn(fastLen, slowLen)
Parameters:
fastLen (int)
slowLen (int)
up_down_volume()
cvd()
supertrend_dyn(atrLen, mult)
Parameters:
atrLen (int)
mult (float)
envelopes_dyn(src, len, pct)
Parameters:
src (float)
len (int)
pct (float)
linreg_line_slope(src, len)
Parameters:
src (float)
len (int)
lsma_dyn(src, len)
Parameters:
src (float)
len (int)
corrcoef_dyn(a, b, len)
Parameters:
a (float)
b (float)
len (int)
psar(step, maxStep)
Parameters:
step (float)
maxStep (float)
pivots_standard()
williams_alligator(src, jawLen, teethLen, lipsLen)
Parameters:
src (float)
jawLen (int)
teethLen (int)
lipsLen (int)
twap_dyn(src, len)
Parameters:
src (float)
len (int)
vwap_anchored(price, volume, reset)
Parameters:
price (float)
volume (float)
reset (bool)
performance_pct(len)
Parameters:
len (int)
Golden Cross Screener [Pineify]Golden Cross Screener Pineify – Multi-Symbol Trend Detection Screener for TradingView
Discover the Golden Cross Screener Pineify for TradingView: a multi-symbol, multi-timeframe indicator for crypto and other assets. Customizable Golden Cross detection, robust algorithm, and intuitive screener design for smarter portfolio trend analysis.
Key Features
Multi-symbol screening across major cryptocurrencies or assets – BTCUSD, ETHUSD, XRPUSD, USDT, BNB, SOLUSD, DOGEUSD, TRXUSD (fully customizable).
Multi-timeframe analysis (e.g., 1m, 5m, 10m, 30m), enabling robust trend detection from scalp to swing.
Customizable Moving Average settings for both Fast and Slow MA (source and length).
Efficient screener table, highlighting Golden Cross events and current asset trends in one panel.
Visual cues for bullish, bearish, and cross states using intuitive color-coding and labels.
Flexible symbol and timeframe inputs to tailor the screener to any portfolio or watchlist.
How It Works
The Golden Cross Screener Pineify leverages the classic Golden Cross methodology—a bullish trend signal triggered when a shorter-term moving average crosses above a longer-term moving average. To improve robustness, you are empowered to configure both Fast MA and Slow MA periods and sources, making the detection logic applicable to any symbol, timeframe, or asset class.
Internally, the script runs dedicated calculations on each chosen symbol and timeframe, generating independent signals using exponential moving averages (EMA). Using the TradingView `request.security` function, it fetches and processes price data for up to eight portfolio assets on four timeframes, displaying the detected Golden Cross, Bullish, or Bearish states in a central screener table.
Trading Ideas and Insights
Spot emerging bullish or bearish trends across your favorite crypto pairs or trading assets in real time.
Capture prime opportunities when multiple assets align with Golden Cross signals—ideal for portfolio rebalancing or rotational strategies.
Analyze trend consistency by monitoring cross events at multiple timeframes for a given asset.
Swiftly identify when short-term and long-term momentum diverge—flagging potential reversals or trend initiations.
The Golden Cross Screener Pineify is not just a trend signal; it’s a holistic multi-asset scanner built for traders who know the power of combining technical breadth with agile timing.
How Multiple Indicators Work Together
This screener stands out with its modular approach: each asset/timeframe pair is monitored in isolation, yet displayed collectively for multidimensional market insight. Each symbol’s price action is processed through independently configured EMAs—Fast and Slow—whose crossovers are analyzed for directional bias. The implementation’s real innovation is in its screener table engine: it aggregates signals, synchronizes timeframes, and color-codes market states, allowing users to see confluences, divergences, and sector trends at a glance.
Combining Golden Cross detection with customizable moving averages and flexible multi-timeframe, multi-symbol scanning means users can fine-tune sensitivity, focus on specific signals, and adapt screener logic for scalping, swing trading, or investing.
Unique Aspects
True multi-symbol screener within the TradingView indicator framework.
Full customization of screener assets, timeframes, and moving averages.
Advanced, efficient use of TradingView table for clear, actionable visualization.
No dependency on standard, static MA settings—adjust everything to match your strategy.
Big-picture and granular trend detection in one tool, designed for both active traders and portfolio managers.
How to Use
Add the Golden Cross Screener Pineify to your TradingView chart.
Choose up to eight symbols—crypto, stock, forex, or custom assets.
Set four timeframes for screening, from lower to higher intervals.
Adjust moving average sources (price, close, etc.) and period lengths for both Fast and Slow MAs to suit your trading style.
Interpret table cells: clear labels and color indicate Golden Cross (trend shift), Bullish (uptrend), Bearish (downtrend) states for each symbol/timeframe.
React to signal alignments—deploy or rebalance positions, increase alert sensitivity, or backtest sequence confluences.
Customization
The indicator’s inputs panel gives full control:
Select which symbols to screen, making it perfect for any asset watchlist.
Pick the desired timeframes—mix daily, hourly, or minute-based intervals.
Adjust Fast and Slow MA settings: switch source type, change period length, and fine-tune detection logic as needed.
Style your screener table via TradingView settings (colors, font sizes, alignment).
Every element is customizable—adapt the Golden Cross Screener Pineify for your specific portfolio, trading timeframe, and strategy focus.
Conclusion
The Golden Cross Screener Pineify elevates multi-symbol trend detection to a new level on TradingView. By combining configurable Golden Cross logic with a powerful screener engine, it serves both precision and broad market insight—crucial for agile traders and strategic portfolio managers. Whether you’re tracking crypto pairs, stocks, forex, or a mix, this tool transforms static trend analysis into an active, multi-dimensional trading edge.
AlgebraGeometryLabLibrary "AlgebraGeometryLab"
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)
PORSCHE 2.0 OSCILLATOR PORSCHE 2.0 OSCILLATOR - Multi-Indicator Powerhouse for TradingView
The PORSCHE 2.0 OSCILLATOR is a sophisticated multi-indicator tool that combines the power of MACD and OBV-ADX analysis into one comprehensive oscillator. Designed for traders who want clean, actionable signals without visual clutter, this indicator provides deep market insights through momentum and volume-based analysis.
🎯 KEY FEATURES:
🔹 Dual Analysis System:
MACD Component: Classic MACD lines (blue MACD line & red Signal line) for trend momentum
OBV-ADX Component: Advanced volume-based directional movement analysis
🔹 Clean Visual Design:
Slim, elegant lines for better chart clarity
Prominent histogram for DI Difference visualization
No distracting arrows or unnecessary plot markers
Custom color scheme for optimal visibility
🔹 Flexible Display Options:
Toggle MACD display on/off
Switch between ADX line view and DI Difference histogram
Adjustable background highlights for strong signals
Customizable parameters for all components
📊 COMPONENTS EXPLAINED:
MACD Section:
Fast & slow EMA comparison for momentum shifts
Clean crossover signals without histogram clutter
Customizable periods and MA types
OBV-ADX Section:
On-Balance Volume (OBV) based Directional Indicators
ADX smoothing for trend strength measurement
DI Difference histogram showing momentum direction
"MyGreen/MyRed" background highlights for strong trend conditions
⚙️ CUSTOMIZABLE PARAMETERS:
MACD fast/slow lengths and smoothing
DI Length and ADX smoothing periods
Multiple MA type options (SMA/EMA)
Toggle individual components on/off
🎨 VISUAL ENHANCEMENTS:
Increased histogram size for better visibility
Optimized line thickness for clean appearance
Professional color coding
Zero-line reference for easy interpretation
Perfect for traders who want the combined power of momentum and volume indicators in one clean, professional package. The PORSCHE 2.0 OSCILLATOR helps identify trend strength, momentum shifts, and potential entry/exit points with exceptional clarity.
▶️ Add to your TradingView chart today and elevate your technical analysis!
Koncorde Crossing Screener (UP/DOWN) AlertThis indicators works on Koncorde Crossing Pattern, generating alerts when Cross is Up (buy) and Down (sell).
EMA 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50 ema 8/20/50
Premarket Gapper Swing Filter (Long) – v6here’s a plug-and-play Pine Script v5 “screener” you can drop on any chart to flag pre-market gainers that also meet swing-friendly trend/liquidity filters. It works as a chart-level scanner (since Pine can’t screen the whole market by itself): add it to a watchlist; symbols that qualify will light up and you can set alerts to ping you right at the opening bell.
T3 ATR [DCAUT]█ T3 ATR
📊 ORIGINALITY & INNOVATION
The T3 ATR indicator represents an important enhancement to the traditional Average True Range (ATR) indicator by incorporating the T3 (Tilson Triple Exponential Moving Average) smoothing algorithm. While standard ATR uses fixed RMA (Running Moving Average) smoothing, T3 ATR introduces a configurable volume factor parameter that allows traders to adjust the smoothing characteristics from highly responsive to heavily smoothed output.
This innovation addresses a fundamental limitation of traditional ATR: the inability to adapt smoothing behavior without changing the calculation period. With T3 ATR, traders can maintain a consistent ATR period while adjusting the responsiveness through the volume factor, making the indicator adaptable to different trading styles, market conditions, and timeframes through a single unified implementation.
The T3 algorithm's triple exponential smoothing with volume factor control provides improved signal quality by reducing noise while maintaining better responsiveness compared to traditional smoothing methods. This makes T3 ATR particularly valuable for traders who need to adapt their volatility measurement approach to varying market conditions without switching between multiple indicator configurations.
📐 MATHEMATICAL FOUNDATION
The T3 ATR calculation process involves two distinct stages:
Stage 1: True Range Calculation
The True Range (TR) is calculated using the standard formula:
TR = max(high - low, |high - close |, |low - close |)
This captures the greatest of the current bar's range, the gap from the previous close to the current high, or the gap from the previous close to the current low, providing a comprehensive measure of price movement that accounts for gaps and limit moves.
Stage 2: T3 Smoothing Application
The True Range values are then smoothed using the T3 algorithm, which applies six exponential moving averages in succession:
First Layer: e1 = EMA(TR, period), e2 = EMA(e1, period)
Second Layer: e3 = EMA(e2, period), e4 = EMA(e3, period)
Third Layer: e5 = EMA(e4, period), e6 = EMA(e5, period)
Final Calculation: T3 = c1×e6 + c2×e5 + c3×e4 + c4×e3
The coefficients (c1, c2, c3, c4) are derived from the volume factor (VF) parameter:
a = VF / 2
c1 = -a³
c2 = 3a² + 3a³
c3 = -6a² - 3a - 3a³
c4 = 1 + 3a + a³ + 3a²
The volume factor parameter (0.0 to 1.0) controls the weighting of these coefficients, directly affecting the balance between responsiveness and smoothness:
Lower VF values (approaching 0.0): Coefficients favor recent data, resulting in faster response to volatility changes with minimal lag but potentially more noise
Higher VF values (approaching 1.0): Coefficients distribute weight more evenly across the smoothing layers, producing smoother output with reduced noise but slightly increased lag
📊 COMPREHENSIVE SIGNAL ANALYSIS
Volatility Level Interpretation:
High Absolute Values: Indicate strong price movements and elevated market activity, suggesting larger position risks and wider stop-loss requirements, often associated with trending markets or significant news events
Low Absolute Values: Indicate subdued price movements and quiet market conditions, suggesting smaller position risks and tighter stop-loss opportunities, often associated with consolidation phases or low-volume periods
Rapid Increases: Sharp spikes in T3 ATR often signal the beginning of significant price moves or market regime changes, providing early warning of increased trading risk
Sustained High Levels: Extended periods of elevated T3 ATR indicate sustained trending conditions with persistent volatility, suitable for trend-following strategies
Sustained Low Levels: Extended periods of low T3 ATR indicate range-bound conditions with suppressed volatility, suitable for mean-reversion strategies
Volume Factor Impact on Signals:
Low VF Settings (0.0-0.3): Produce responsive signals that quickly capture volatility changes, suitable for short-term trading but may generate more frequent color changes during minor fluctuations
Medium VF Settings (0.4-0.7): Provide balanced signal quality with moderate responsiveness, filtering out minor noise while capturing significant volatility changes, suitable for swing trading
High VF Settings (0.8-1.0): Generate smooth, stable signals that filter out most noise and focus on major volatility trends, suitable for position trading and long-term analysis
🎯 STRATEGIC APPLICATIONS
Position Sizing Strategy:
Determine your risk per trade (e.g., 1% of account capital - adjust based on your risk tolerance and experience)
Decide your stop-loss distance multiplier (e.g., 2.0x T3 ATR - this varies by market and strategy, test different values)
Calculate stop-loss distance: Stop Distance = Multiplier × Current T3 ATR
Calculate position size: Position Size = (Account × Risk %) / Stop Distance
Example: $10,000 account, 1% risk, T3 ATR = 50 points, 2x multiplier → Position Size = ($10,000 × 0.01) / (2 × 50) = $100 / 100 points = 1 unit per point
Important: The ATR multiplier (1.5x - 3.0x) should be determined through backtesting for your specific instrument and strategy - using inappropriate multipliers may result in stops that are too tight (frequent stop-outs) or too wide (excessive losses)
Adjust the volume factor to match your trading style: lower VF for responsive stop distances in short-term trading, higher VF for stable stop distances in position trading
Dynamic Stop-Loss Placement:
Determine your risk tolerance multiplier (typically 1.5x to 3.0x T3 ATR)
For long positions: Set stop-loss at entry price minus (multiplier × current T3 ATR value)
For short positions: Set stop-loss at entry price plus (multiplier × current T3 ATR value)
Trail stop-losses by recalculating based on current T3 ATR as the trade progresses
Adjust the volume factor based on desired stop-loss stability: higher VF for less frequent adjustments, lower VF for more adaptive stops
Market Regime Identification:
Calculate a reference volatility level using a longer-period moving average of T3 ATR (e.g., 50-period SMA)
High Volatility Regime: Current T3 ATR significantly above reference (e.g., 120%+) - favor trend-following strategies, breakout trades, and wider targets
Normal Volatility Regime: Current T3 ATR near reference (e.g., 80-120%) - employ standard trading strategies appropriate for prevailing market structure
Low Volatility Regime: Current T3 ATR significantly below reference (e.g., <80%) - favor mean-reversion strategies, range trading, and prepare for potential volatility expansion
Monitor T3 ATR trend direction and compare current values to recent history to identify regime transitions early
Risk Management Implementation:
Establish your maximum portfolio heat (total risk across all positions, typically 2-6% of capital)
For each position: Calculate position size using the formula Position Size = (Account × Individual Risk %) / (ATR Multiplier × Current T3 ATR)
When T3 ATR increases: Position sizes automatically decrease (same risk %, larger stop distance = smaller position)
When T3 ATR decreases: Position sizes automatically increase (same risk %, smaller stop distance = larger position)
This approach maintains constant dollar risk per trade regardless of market volatility changes
Use consistent volume factor settings across all positions to ensure uniform risk measurement
📋 DETAILED PARAMETER CONFIGURATION
ATR Length Parameter:
Default Setting: 14 periods
This is the standard ATR calculation period established by Welles Wilder, providing balanced volatility measurement that captures both short-term fluctuations and medium-term trends across most markets and timeframes
Selection Principles:
Shorter periods increase sensitivity to recent volatility changes and respond faster to market shifts, but may produce less stable readings
Longer periods emphasize sustained volatility trends and filter out short-term noise, but respond more slowly to genuine regime changes
The optimal period depends on your holding time, trading frequency, and the typical volatility cycle of your instrument
Consider the timeframe you trade: Intraday traders typically use shorter periods, swing traders use intermediate periods, position traders use longer periods
Practical Approach:
Start with the default 14 periods and observe how well it captures volatility patterns relevant to your trading decisions
If ATR seems too reactive to minor price movements: Increase the period until volatility readings better reflect meaningful market changes
If ATR lags behind obvious volatility shifts that affect your trades: Decrease the period for faster response
Match the period roughly to your typical holding time - if you hold positions for N bars, consider ATR periods in a similar range
Test different periods using historical data for your specific instrument and strategy before committing to live trading
T3 Volume Factor Parameter:
Default Setting: 0.7
This setting provides a reasonable balance between responsiveness and smoothness for most market conditions and trading styles
Understanding the Volume Factor:
Lower values (closer to 0.0) reduce smoothing, allowing T3 ATR to respond more quickly to volatility changes but with less noise filtering
Higher values (closer to 1.0) increase smoothing, producing more stable readings that focus on sustained volatility trends but respond more slowly
The trade-off is between immediacy and stability - there is no universally optimal setting
Selection Principles:
Match to your decision speed: If you need to react quickly to volatility changes for entries/exits, use lower VF; if you're making longer-term risk assessments, use higher VF
Match to market character: Noisier, choppier markets may benefit from higher VF for clearer signals; cleaner trending markets may work well with lower VF for faster response
Match to your preference: Some traders prefer responsive indicators even with occasional false signals, others prefer stable indicators even with some delay
Practical Adjustment Guidelines:
Start with default 0.7 and observe how T3 ATR behavior aligns with your trading needs over multiple sessions
If readings seem too unstable or noisy for your decisions: Try increasing VF toward 0.9-1.0 for heavier smoothing
If the indicator lags too much behind volatility changes you care about: Try decreasing VF toward 0.3-0.5 for faster response
Make meaningful adjustments (0.2-0.3 changes) rather than small increments - subtle differences are often imperceptible in practice
Test adjustments in simulation or paper trading before applying to live positions
📈 PERFORMANCE ANALYSIS & COMPETITIVE ADVANTAGES
Responsiveness Characteristics:
The T3 smoothing algorithm provides improved responsiveness compared to traditional RMA smoothing used in standard ATR. The triple exponential design with volume factor control allows the indicator to respond more quickly to genuine volatility changes while maintaining the ability to filter noise through appropriate VF settings. This results in earlier detection of volatility regime changes compared to standard ATR, particularly valuable for risk management and position sizing adjustments.
Signal Stability:
Unlike simple smoothing methods that may produce erratic signals during transitional periods, T3 ATR's multi-layer exponential smoothing provides more stable signal progression. The volume factor parameter allows traders to tune signal stability to their preference, with higher VF settings producing remarkably smooth volatility profiles that help avoid overreaction to temporary market fluctuations.
Comparison with Standard ATR:
Adaptability: T3 ATR allows adjustment of smoothing characteristics through the volume factor without changing the ATR period, whereas standard ATR requires changing the period length to alter responsiveness, potentially affecting the fundamental volatility measurement
Lag Reduction: At lower volume factor settings, T3 ATR responds more quickly to volatility changes than standard ATR with equivalent periods, providing earlier signals for risk management adjustments
Noise Filtering: At higher volume factor settings, T3 ATR provides superior noise filtering compared to standard ATR, producing cleaner signals for long-term analysis without sacrificing volatility measurement accuracy
Flexibility: A single T3 ATR configuration can serve multiple trading styles by adjusting only the volume factor, while standard ATR typically requires multiple instances with different periods for different trading applications
Suitable Use Cases:
T3 ATR is well-suited for the following scenarios:
Dynamic Risk Management: When position sizing and stop-loss placement need to adapt quickly to changing volatility conditions
Multi-Style Trading: When a single volatility indicator must serve different trading approaches (day trading, swing trading, position trading)
Volatile Markets: When standard ATR produces too many false volatility signals during choppy conditions
Systematic Trading: When algorithmic systems require a single, configurable volatility input that can be optimized for different instruments
Market Regime Analysis: When clear identification of volatility expansion and contraction phases is critical for strategy selection
Known Limitations:
Like all technical indicators, T3 ATR has limitations that users should understand:
Historical Nature: T3 ATR is calculated from historical price data and cannot predict future volatility with certainty
Smoothing Trade-offs: The volume factor setting involves a trade-off between responsiveness and smoothness - no single setting is optimal for all market conditions
Extreme Events: During unprecedented market events or gaps, T3 ATR may not immediately reflect the full scope of volatility until sufficient data is processed
Relative Measurement: T3 ATR values are most meaningful in relative context (compared to recent history) rather than as absolute thresholds
Market Context Required: T3 ATR measures volatility magnitude but does not indicate price direction or trend quality - it should be used in conjunction with directional analysis
Performance Expectations:
T3 ATR is designed to help traders measure and adapt to changing market volatility conditions. When properly configured and applied:
It can help reduce position risk during volatile periods through appropriate position sizing
It can help identify optimal times for more aggressive position sizing during stable periods
It can improve stop-loss placement by adapting to current market conditions
It can assist in strategy selection by identifying volatility regimes
However, volatility measurement alone does not guarantee profitable trading. T3 ATR should be integrated into a comprehensive trading approach that includes directional analysis, proper risk management, and sound trading psychology.
USAGE NOTES
This indicator is designed for technical analysis and educational purposes. T3 ATR provides adaptive volatility measurement but has limitations and should not be used as the sole basis for trading decisions. The indicator measures historical volatility patterns, and past volatility characteristics do not guarantee future volatility behavior. Market conditions can change rapidly, and extreme events may produce volatility readings that fall outside historical norms.
Traders should combine T3 ATR with directional analysis tools, support/resistance analysis, and other technical indicators to form a complete trading strategy. Proper backtesting and forward testing with appropriate risk management is essential before applying T3 ATR-based strategies to live trading. The volume factor parameter should be optimized for specific instruments and trading styles through careful testing rather than assuming default settings are optimal for all applications.
Period Separator + Future Lines (Exchange-Time Synced)Monthly, Weekly, Daily,4hr and hr dividers and future separators (custom as wish, how many lines it should show in future)
Future separators corrected
BATOOT//@version=5
indicator('BATOOT', overlay=true)
length = input.int(title='Length', minval=1, maxval=1000, defval=18)
upBound = ta.highest(high, length)
downBound = ta.lowest(low, length)
LONG = ta.cross(high, upBound)
SHORT = ta.cross(low, downBound)
switch_1 = 0
setA = 0
setB = 0
if LONG and switch_1 == 0
switch_1 := 1
setA := 1
setB := 0
setB
else
if SHORT and switch_1 == 1
switch_1 := 0
setA := 0
setB := 1
setB
else
switch_1 := nz(switch_1 , 0)
setA := 0
setB := 0
setB
plotshape(setA, title='LONG', style=shape.triangleup, text='BUY', color=color.new(color.green, 0), textcolor=color.new(color.green, 0), location=location.belowbar, size=size.small)
plotshape(setB, title='SHORT', style=shape.triangledown, text='SHORT', color=color.new(color.red, 0), textcolor=color.new(color.red, 0), location=location.abovebar, size=size.small)
alertcondition(setA, title='LONG', message='LONG!')
alertcondition(setB, title='SHORT', message='SHORT!')
//Support and Resistance
line_width = 3
sr_tf = input.timeframe('', title='S/R Timeframe')
//Legacy RSI calc
rsi_src = close
len = 9
up1 = ta.rma(math.max(ta.change(rsi_src), 0), len)
down1 = ta.rma(-math.min(ta.change(rsi_src), 0), len)
legacy_rsi = down1 == 0 ? 100 : up1 == 0 ? 0 : 100 - 100 / (1 + up1 / down1)
//CMO based on HMA
length1 = 1
src1 = ta.hma(open, 5) // legacy hma(5) calculation gives a resul with one candle shift, thus use hma()
src2 = ta.hma(close, 12)
momm1 = ta.change(src1)
momm2 = ta.change(src2)
f1(m, n) =>
m >= n ? m : 0.0
f2(m, n) =>
m >= n ? 0.0 : -m
m1 = f1(momm1, momm2)
m2 = f2(momm1, momm2)
sm1 = math.sum(m1, length1)
sm2 = math.sum(m2, length1)
percent(nom, div) =>
100 * nom / div
cmo_new = percent(sm1 - sm2, sm1 + sm2)
//Legacy Close Pivots calcs.
len5 = 2
h = ta.highest(len5)
h1 = ta.dev(h, len5) ? na : h
hpivot = fixnan(h1)
l = ta.lowest(len5)
l1 = ta.dev(l, len5) ? na : l
lpivot = fixnan(l1)
//Calc Values
rsi_new = ta.rsi(close, 9)
lpivot_new = lpivot
hpivot_new = hpivot
sup = rsi_new < 25 and cmo_new > 50 and lpivot_new
res = rsi_new > 75 and cmo_new < -50 and hpivot_new
calcXup() =>
var xup = 0.0
xup := sup ? low : xup
xup
calcXdown() =>
var xdown = 0.0
xdown := res ? high : xdown
xdown
//Lines drawing variables
tf1 = request.security(syminfo.tickerid, sr_tf, calcXup(), lookahead=barmerge.lookahead_on)
tf2 = request.security(syminfo.tickerid, sr_tf, calcXdown(), lookahead=barmerge.lookahead_on)
//SR Line plotting
var tf1_line = line.new(0, 0, 0, 0)
var tf1_bi_start = 0
var tf1_bi_end = 0
tf1_bi_start := ta.change(tf1) ? bar_index : tf1_bi_start
tf1_bi_end := ta.change(tf1) ? tf1_bi_start : bar_index
if ta.change(tf1)
tf1_line := line.new(tf1_bi_start, tf1, tf1_bi_end, tf1, color=color.green, width=line_width)
tf1_line
line.set_x2(tf1_line, tf1_bi_end)
var tf2_line = line.new(0, 0, 0, 0)
var tf2_bi_start = 0
var tf2_bi_end = 0
tf2_bi_start := ta.change(tf2) ? bar_index : tf2_bi_start
tf2_bi_end := ta.change(tf2) ? tf2_bi_start : bar_index
if ta.change(tf2)
tf2_line := line.new(tf2_bi_start, tf2, tf2_bi_end, tf2, color=color.orange, width=line_width)
tf2_line
line.set_x2(tf2_line, tf2_bi_end)
Quick Reversal Strategy - Bash Modrs//@version=5
indicator("Quick Reversal Strategy - Bash Modrs", overlay=true)
// === Moving Averages ===
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
// === RSI ===
rsi = ta.rsi(close, 14)
// === Bollinger Bands ===
basis = ta.sma(close, 20)
dev = ta.stdev(close, 20)
upper = basis + dev * 2
lower = basis - dev * 2
// === Volume ===
vol = volume
vol_avg = ta.sma(volume, 20)
vol_color = vol > vol_avg ? color.new(color.green, 0) : color.new(color.red, 0)
// === Plot Indicators ===
plot(ema9, color=color.yellow, linewidth=2, title="EMA 9")
plot(ema21, color=color.orange, linewidth=2, title="EMA 21")
plot(basis, color=color.blue, title="BB Basis")
plot(upper, color=color.new(color.blue, 50))
plot(lower, color=color.new(color.blue, 50))
plot(vol, color=vol_color, style=plot.style_columns, title="Volume")
// === Entry Conditions ===
longCond = ta.crossover(ema9, ema21) and rsi > 40 and rsi < 60
shortCond = ta.crossunder(ema9, ema21) and rsi > 40 and rsi < 60
// === Alerts ===
alertcondition(longCond, title="Buy Signal", message="🟢 Buy Signal - Quick Reversal Strategy")
alertcondition(shortCond, title="Sell Signal", message="🔴 Sell Signal - Quick Reversal Strategy")
// === Plot Signals on Chart ===
plotshape(longCond, title="Buy", location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.large)
plotshape(shortCond, title="Sell", location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.large)
ema 狀態機Library "ema_flow_lib"
ema_flow_state(e10, e20, e100, entanglePct, farPct, e10_prev, e20_prev)
Parameters:
e10 (float)
e20 (float)
e100 (float)
entanglePct (float)
farPct (float)
e10_prev (float)
e20_prev (float)
state_name(s)
Parameters:
s (int)
ICT Levels Breach Scanner (12M Timeframe)Detects and scans for breaches of key Inner Circle Trader (ICT) concepts on the yearly (12M) chart: Swing Lows (3-bar wick pivots), Rejection Blocks (3-bar body pivots), Fair Value Gaps (3-bar inefficiencies), and Volume Imbalances (bullish body gaps ≥0.15%, unmitigated).
Features:
Tracks active levels with arrays for real-time breach detection (price low below any level triggers alert).
Visuals: Blue solid lines (Swing Lows), orange dashed (Rejection Blocks), purple dotted (FVGs), green boxes (VIs)—all extending right.
Red triangle + bgcolor alert on breach bar; built-in alertcondition for notifications.
Optimized for Pine Screener: Filter stocks (e.g., US exchanges) showing symbols where price has traded below these levels on the latest 12M bar.
Usage: Apply to a 12M chart for viz, or add to Screener > Pine tab for multi-symbol scans. Customize gap % or add bearish variants via inputs. Ideal for spotting potential support in long-term trends.
ICT-inspired; test on liquid stocks like AAPL/TSLA. Not financial advice.
3DMA % Declining Issues (Diodato 2019)Description:
This script is a faithful implementation of the "3-DMA % Declining Issues" indicator from Chris Diodato's 2019 CMT paper, "Making The Most Of Panic." It is a simple but highly effective short-term panic meter based on market breadth.
What It Is
This indicator first calculates the percentage of total traded issues on the NYSE that were decliners for that day. It then plots a 3-day simple moving average of that percentage. The result is a 0-100 scale indicator that provides a clear visual of the intensity of recent, widespread selling pressure.
How to Interpret
Unlike a typical "oversold" oscillator where low is a signal, with this indicator, a high value indicates panic.
Panic Spikes: A sharp spike upward suggests that a very large portion of the market is selling off simultaneously. The paper found that when this indicator exceeded 65%, 70%, or 75%, it often marked a point of extreme short-term panic that presented a buying opportunity.
Panic Threshold: The script includes a customizable "Panic Threshold" line (defaulting to 65) to help you instantly spot these events.
Settings
Data Sources: Allows toggling the use of "Unchanged" issues data.
Thresholds: You can set the "Panic Threshold" line to your preferred level (e.g., 65, 70, 75).
Short-Term Capitulation Oscillator (STCO, Diodato 2019)Description:
This script is a faithful implementation of the Short-Term Capitulation Oscillator (STCO) from Chris Diodato's 2019 CMT paper, "Making The Most Of Panic". It's a tactical breadth and volume oscillator designed to "fish for market bottoms" by identifying short-term investor capitulation.
What It Is
The STCO combines the 10-day moving averages of NYSE up-volume and advancing issues. It measures the ratio of advancing momentum (in both volume and number of issues) relative to the total traded momentum. The result is a raw, un-normalized oscillator that typically ranges from 0 to 200.
How to Interpret
The STCO is a tactical tool for identifying near-term oversold conditions and potential bounces.
Low Readings: Indicate that sellers have likely exhausted themselves in the short term, creating a potential entry point for a bounce. The paper found that readings below 90, 85, and 80 were often followed by strong market performance over the next 5-20 days.
Overbought/Oversold Lines: Use the customizable overbought/oversold lines to define your own capitulation zones and potential entry areas.
Settings
Data Sources: Allows toggling the use of "Unchanged" issues/volume data.
Thresholds: You can set the overbought and oversold levels based on the paper's research or your own testing.
EMA50/200 — Nth Close After Break (Up/Down/Both)This indicator tracks EMA-based momentum confirmation using a customizable N-bar rule.
🧠 Logic:
- You can choose whether to track EMA 50 or EMA 200.
- When the price breaks above (or below) the selected EMA, the indicator starts counting.
- If the price stays on that side of the EMA for N consecutive closes, a single signal is triggered on the Nth bar.
- After signaling, the counter resets — the next signal appears only after a new EMA break.
⚙️ Parameters:
- Target EMA: Choose which EMA (50 or 200) the logic is based on.
- N: Number of consecutive bars required after a break.
- Direction: Up / Down / Both.
- Optional trend filters: Require EMA50 > EMA200 for Up signals, or EMA50 < EMA200 for Down signals.
- Blue ▲ = Bullish signal (Nth close after breaking above EMA)
- Red ▼ = Bearish signal (Nth close after breaking below EMA)
✅ Ideal for identifying strong trend confirmations and filtering out false EMA breakouts.
phx_liq_tlLibrary "phx_liq_tl"
new_state()
update(st, len, cup, cdn, space, proximity_pct, shs)
Parameters:
st (LTState)
len (int)
cup (color)
cdn (color)
space (float)
proximity_pct (float)
shs (bool)
LTState
Fields:
upln (array)
dnln (array)
upBroken (series bool)
dnBroken (series bool)
VNREAL-ExVG (ex VHM, VRE, IDC) — rebased=100 — no-arraysVNREAL-ExVG (ex VHM, VRE, IDC) — rebased=100 — no-arrays