Option Premium + VWAP Dashboard1. What this indicator does
This tool creates a live option chain style dashboard on your chart for index options on NSE.
For a selected expiry and a band of strikes around a reference strike, it shows:
Strike price
CE LTP (Last Traded Price)
PE LTP
CE + PE total premium
Combined VWAP of CE + PE
Individual VWAP of CE
Individual VWAP of PE
Inference column describing who is stronger
(buyers or sellers, CE side or PE side, or mixed)
Rows are color coded based on which side is dominating around VWAP, so you get a quick visual sense of:
At which strikes buyers are aggressive
At which strikes sellers are aggressive
Where premiums are trading near VWAP and stay neutral
You can place this dashboard anywhere on the chart and adjust font size and colors as per your preference.
2. Supported indices
You can use this indicator on the following indices:
NIFTY
BANKNIFTY
FINNIFTY
MIDCAP
SENSEX
Input:
Spot Symbol = choose from BANKNIFTY, NIFTY, FINNIFTY, MIDCAP, SENSEX
Internally, the script maps this choice to the corresponding TradingView symbol:
NIFTY → NSE:NIFTY
BANKNIFTY → NSE:BANKNIFTY
FINNIFTY → NSE:CNXFINANCE
MIDCAP → NSE:CNXMIDCAP
SENSEX → BSE:SENSEX
For options, it uses an option prefix derived from this selection:
For all NSE index options → BANKNIFTY, NIFTY, FINNIFTY, MIDCAP
For SENSEX options → BSX (as per your earlier convention)
Options are then constructed in this format:
PREFIX + YYMMDD + C/P + Strike
Example: NIFTY251120C20000
So the expiry date must be set correctly, otherwise TradingView will not find the options.
3. How the logic works internally
For each strike in the selected range, the script:
Builds the CE and PE symbols using:
Underlying prefix (opt_prefix)
Expiry date in YYMMDD format
C or P
Strike price
Fetches from request.security() on your current chart timeframe:
ce_close, pe_close
ce_vwap, pe_vwap
Calculates:
combined_prem = CE LTP + PE LTP
combined_vwap = CE VWAP + PE VWAP
Compares premiums and VWAPs and creates a detailed inference string, for example:
"Optn buyers stronger | Both buyers strong"
"Optn sellers stronger | CE sellers, PE buyers"
"Near VWAP | Mixed"
Chooses row background color based on which side is stronger:
CE buyers strong → BG CE Buyers Strong
PE buyers strong → BG PE Buyers Strong
CE sellers strong → BG CE Sellers Strong
PE sellers strong → BG PE Sellers Strong
If none of the above is clearly dominant, the row is kept neutral.
This gives you an immediate view of:
Where option buyers are aggressively lifting offers
Where option sellers are dominating
Where the market is balanced near VWAP
4. Expiry settings
How to change expiry to get the correct option chain
The indicator uses a manual expiry input:
Group: Expiry Settings
Input: Expiry (manual)
Internally, it extracts:
year(expiry_manual)
month(expiry_manual)
dayofmonth(expiry_manual)
Then it converts this to YYMMDD and builds option symbols.
How to set this correctly:
Open the indicator settings.
Go to “Expiry Settings”.
In Expiry (manual) select the correct date and time of the option expiry.
For NSE weekly or monthly index options, you can simply select the calendar date of the expiry.
Time is not critical for symbol naming, it is used only to obtain year, month, day, but keeping it at market open time (for example, 09:15) is a good habit.
After changing the expiry:
The title row will update to show the new expiry as DD-MM-YY.
The script will start requesting data for symbols with that YYMMDD in their names.
If you see na in most rows, it usually means:
The expiry date does not match the actual symbol format on TradingView.
The strike prices are too far away from existing contracts.
You are using an expiry where this index does not have options.
In that case, double check the expiry date and strike range.
5. Strike settings
The script gives you a flexible way to control which strikes are shown.
Group: Strike Settings
5.1 Automatic strike interval
By default, the indicator uses index specific strike steps:
BANKNIFTY or SENSEX → 100 point interval
NIFTY or FINNIFTY → 50 point interval
MIDCAP also defaults to 50 points
This is controlled internally by:
use_manual_interval = false
and auto_interval is chosen based on the index.
Use case:
If you want a quick standard layout for a typical option chain view, simply leave “Use Manual Strike Interval” unchecked and let the script choose the appropriate interval automatically.
5.2 Manual strike interval
You can override the default step using:
Use Manual Strike Interval (bool)
Manual Strike Interval (int, default 50)
When Use Manual Strike Interval is true, the script will:
Ignore the automatic index based step.
Use your chosen step size for all strikes.
When to use manual interval:
When the exchange has changed strike spacing for a particular series.
When you want a denser view (for example, 25 point steps in NIFTY) around ATM.
When you want a wider spacing for a broad overview, for example, 200 or 500 point steps.
5.3 Reference strike and range
Two important inputs:
Reference Strike (manual)
Default: 26000
This is the center of the table. The script builds strikes above and below this level.
Strikes Above / Below Reference
Default: 5
The script calculates:
start_strike = ref_strike - half_range * strike_interval
Total number of strikes = 2 * half_range + 1
So with:
Reference Strike = 26000
Strike Interval = 100
Strikes Above / Below = 5
You will get strikes from 25500 to 26500 in steps of 100.
How to choose the reference strike in practice:
Set it close to the current spot price or the ATM strike.
For intraday trading, most of your focus is usually on:
ATM
2 or 3 strikes ITM and OTM on each side
If NIFTY is around 22,250, set Reference Strike to 22200 or 22250 based on available strikes.
If BANKNIFTY is around 49,800, set it to 49800 or 50000.
This keeps the dashboard concentrated around active and liquid strikes that you actually trade.
6. Dashboard layout and appearance
Group: Dashboard Layout
Dashboard Location
Choose where the table appears on your chart.
Options: top left, top center, top right, middle left, middle center, middle right, bottom left, bottom center, bottom right.
Font Size
Choose from Tiny, Small, Normal, Large, Huge depending on your screen size and personal preference.
Group: Colors
You can customize:
Header Background
Title Background
Header Text color
Row backgrounds based on strength:
BG CE Buyers Strong
BG PE Sellers Strong
BG CE Sellers Strong
BG PE Buyers Strong
Row BG neutral for mixed or unclear situations
Suggestion:
Keep buyers related backgrounds in green shades.
Keep sellers related backgrounds in red shades.
Keep neutral in grey.
This matches the logic in the Inference column and makes interpretation much easier.
7. How to read the “Inference” column
The inference logic checks:
Is total premium above or below total VWAP?
Is CE above its VWAP?
Is PE above its VWAP?
Then it combines this into messages like:
“Optn buyers stronger | Both buyers strong”
Both CE and PE trade above their respective VWAPs, and combined premium is above combined VWAP.
Buyers are clearly dominant at that strike.
“Optn sellers stronger | Both sellers strong”
Both CE and PE trade below VWAPs, and combined premium is below combined VWAP.
Sellers are in control at that strike.
“Optn buyers stronger | CE buyers stronger”
Combined premium is above combined VWAP, CE trades above its VWAP, PE is not as strong.
CE side buyers are leading.
“Optn buyers stronger | PE buyers stronger”
Similar, but PE side buyers are leading.
“Optn sellers stronger | CE sellers, PE buyers” or “PE sellers, CE buyers”
Mixed conditions, one side is selling aggressively while the other side has some buyer support.
“Near VWAP | Mixed”
Both premiums are hovering near their VWAP, market is balanced at that strike.
Use this to quickly decide:
Where to avoid trading due to mixed and choppy behaviour.
Where buyers or sellers are clearly dominating and trend can be extended or exhausted.
8. Practical usage tips
Use on intraday timeframes
The script uses timeframe.period for VWAP and LTP calculation. Use it on 1 minute, 3 minute, 5 minute, 15 minute charts for intraday decision making.
Align with index trend
Combine this dashboard with your main price action and trend tools.
For example, if the index trend is strongly up and the ATM and slightly OTM calls show “buyers stronger” with green backgrounds, it can support continuation trades.
Watch shifts in dominance
If you see a cluster of strikes shifting from “buyers stronger” to “sellers stronger”, that can signal distribution or trend exhaustion.
Change expiry when series rolls
For weekly options, you must change Expiry (manual) every week to get the correct option chain.
For monthly and quarterly contracts, update it whenever you roll over to a new series.
Adjust manual interval and reference strike
Before the session starts, quickly adjust:
Reference Strike near current spot
Strikes Above / Below based on how wide a range you want to watch
Optional Manual Strike Interval if you prefer finer or wider spacing
This ensures the dashboard shows the most relevant and liquid strikes instead of cluttering your screen with far OTM data.
9. Limitations and notes
This script depends on correct symbol naming on TradingView for NSE index options.
If the broker or data feed uses a different format, some rows may show na.
Expiry detection is manual by design.
Pine Script cannot reliably auto detect NSE weekly expiry series for every situation, so you are given full manual control to avoid wrong symbol requests.
If you change expiry or strike settings and see an error or many na values, try:
Checking the expiry date.
Bringing reference strike closer to spot.
Refreshing the chart if TradingView needs to load new option symbols.
지표 및 전략
SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)//@version=5
indicator("SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)", overlay=true, max_labels_count=500)
// ---------------- INPUTS ----------------
emaFastLen = input.int(9, "EMA Fast")
emaSlowLen = input.int(21, "EMA Slow")
atrLen = input.int(14, "ATR Length")
atrMultSL = input.float(1.2, "SL = ATR *")
tp1mult = input.float(1.0, "TP1 = ATR *")
tp2mult = input.float(1.5, "TP2 = ATR *")
tp3mult = input.float(2.0, "TP3 = ATR *")
minBars = input.int(3, "Min bars between signals")
showDashboard = input.bool(true, "Show Dashboard")
// ---------------- INDICATORS ----------------
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
atr = ta.atr(atrLen)
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow
crossUp = ta.crossover(emaFast, emaSlow) and bullTrend
crossDown = ta.crossunder(emaFast, emaSlow) and bearTrend
var int lastSignal = na
okSignal = na(lastSignal) or (bar_index - lastSignal > minBars)
buySignal = crossUp and okSignal
sellSignal = crossDown and okSignal
if buySignal or sellSignal
lastSignal := bar_index
// ---------------- TP & SL ----------------
var float sl = na
var float tp1 = na
var float tp2 = na
var float tp3 = na
if buySignal
sl := close - atr * atrMultSL
tp1 := close + atr * tp1mult
tp2 := close + atr * tp2mult
tp3 := close + atr * tp3mult
if sellSignal
sl := close + atr * atrMultSL
tp1 := close - atr * tp1mult
tp2 := close - atr * tp2mult
tp3 := close - atr * tp3mult
// ---------------- ALERTS ----------------
alertcondition(buySignal, title="BUY", message="BUY Signal")
alertcondition(sellSignal, title="SELL", message="SELL Signal")
alertcondition(ta.cross(close, tp1), title="TP1", message="TP1 Hit")
alertcondition(ta.cross(close, tp2), title="TP2", message="TP2 Hit")
alertcondition(ta.cross(close, tp3), title="TP3", message="TP3 Hit")
alertcondition(ta.cross(close, sl), title="SL", message="Stop Loss Hit")
// ---------------- DASHBOARD ----------------
if showDashboard
var table dash = table.new(position.top_right, 1, 5)
if barstate.islast
table.cell(dash, 0, 0, "SCALPING PRO V2", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 0, 1, "Trend: " + (bullTrend ? "Bull" : bearTrend ? "Bear" : "Neutral"))
table.cell(dash, 0, 2, "ATR: " + str.tostring(atr, format.mintick))
table.cell(dash, 0, 3, "Last Signal: " + (buySignal ? "BUY" : sellSignal ? "SELL" : "NONE"))
table.cell(dash, 0, 4, "EMA Fast/Slow OK")
MA200 Deviation Percentile200-Day MA Deviation with Dynamic Thresholds
OVERVIEW
This indicator measures price deviation from the 200-day moving average as a percentage, with dynamically calculated overbought/oversold thresholds based on historical percentiles.
Best suited for broad market indices (SPY, QQQ, IWM, etc.) where the 200-day MA serves as a reliable long-term trend indicator. Individual stocks may exhibit more erratic behavior around this level.
CALCULATION
Deviation (%) = (Close - 200MA) / 200MA x 100
Dynamic thresholds are derived from actual historical distribution rather than assuming normal distribution:
- Overbought threshold = 97.5th percentile of historical deviations
- Oversold threshold = 2.5th percentile of historical deviations
SETTINGS
MA Length (default: 200)
Moving average period.
Lookback Period (default: 1260)
Historical window for threshold calculation. 1260 bars approximates 5 years of daily data.
Threshold Percentile (default: 5%)
Two-tailed threshold. 5% places overbought/oversold boundaries at the 97.5th and 2.5th percentiles respectively.
INTERPRETATION
Deviation Value
- Positive: Price trading above 200MA
- Negative: Price trading below 200MA
- Magnitude indicates extent of deviation
Percentile Ranking (0-100%)
- Shows where current deviation ranks historically
- Above 90%: Historically elevated
- Below 10%: Historically depressed
Dynamic Threshold Lines
- Red line: Upper boundary based on historical distribution
- Green line: Lower boundary based on historical distribution
- These adapt automatically to each asset's volatility characteristics
APPLICATION
Mean Reversion
Extreme deviations tend to normalize over time. When deviation exceeds dynamic thresholds, probability of mean reversion increases.
Trend Assessment
Sustained positive/negative deviation confirms trend direction. Zero-line crossovers may signal trend changes.
NOTES
- Optimized for daily timeframe on market indices
- Requires sufficient historical data (minimum equal to lookback period)
- Extreme readings do not guarantee immediate reversals
- Use in conjunction with other analysis methods
Single AHR DCA (HM) — AHR Pane (customized quantile)Customized note
The log-regression window LR length controls how long a long-term fair value path is estimated from historical data.
The AHR window AHR window length controls over which historical regime you measure whether the coin is “cheap / expensive”.
When you choose a log-regression window of length L (years) and an AHR window of length A (years), you can intuitively read the indicator as:
“Within the last A years of this regime, relative to the long-term trend estimated over the same A years, the current price is cheap / neutral / expensive.”
Guidelines:
In general, set the AHR window equal to or slightly longer than the LR window:
If the AHR window is much longer than LR, you mix different baselines (different LR regimes) into one distribution.
If the AHR window is much shorter than LR, quantiles mostly reflect a very local slice of history.
For BTC / ETH and other BTC-like assets, you can use relatively long horizons (e.g. LR ≈ 3–5 years, AHR window ≈ 3–8 years).
For major altcoins (BNB / SOL / XRP and similar high-beta assets), it is recommended to use equal or slightly shorter horizons, e.g. LR ≈ 2–3 years, AHR window ≈ 2–3 years.
1. Price series & windows
Working timeframe: daily (1D).
Let the daily close of the current symbol on day t be P_t .
Main length parameters:
HM window: L_HM = maLen (default 200 days)
Log-regression window: L_LR = lrLen (default 1095 days ≈ 3 years)
AHR window (regime window): W = windowLen (default 1095 days ≈ 3 years)
2. Harmonic moving average (HM)
On a window of length L_HM, define the harmonic mean:
HM_t = ^(-1)
Here eps = 1e-10 is used to avoid division by zero.
Intuition: HM is more sensitive to low prices – an extremely low price inside the window will drag HM down significantly.
3. Log-regression baseline (LR)
On a window of length L_LR, perform a linear regression on log price:
Over the last L_LR bars, build the series
x_k = log( max(P_k, eps) ), for k = t-L_LR+1 ... t, and fit
x_k ≈ a + b * k.
The fitted value at the current index t is
log_P_hat_t = a + b * t.
Exponentiate to get the log-regression baseline:
LR_t = exp( log_P_hat_t ).
Interpretation: LR_t is the long-term trend / fair value path of the current regime over the past L_LR days.
4. HM-based AHR (valuation ratio)
At each time t, build an HM-based AHR (valuation multiple):
AHR_t = ( P_t / HM_t ) * ( P_t / LR_t )
Interpretation:
P_t / HM_t : deviation of price from the mid-term HM (e.g. 200-day harmonic mean).
P_t / LR_t : deviation of price from the long-term log-regression trend.
Multiplying them means:
if price is above both HM and LR, “expensiveness” is amplified;
if price is below both, “cheapness” is amplified.
Typical reading:
AHR_t < 1 : price is below both mid-term mean and long-term trend → statistically cheaper.
AHR_t > 1 : price is above both mid-term mean and long-term trend → statistically more expensive.
5. Empirical quantile thresholds (Opp / Risk)
On each new day, whenever AHR_t is valid, add it into a rolling array:
A_t_window = { AHR_{t-W+1}, ..., AHR_t } (at most W = windowLen elements)
On this empirical distribution, define two quantiles:
Opportunity quantile: q_opp (default 15%)
Risk quantile: q_risk (default 65%)
Using standard percentile computation (order statistics + linear interpolation), we get:
Opp threshold:
theta_opp = Percentile( A_t_window, q_opp )
Risk threshold:
theta_risk = Percentile( A_t_window, q_risk )
We also compute the percentile rank of the current AHR inside the same history:
q_now = PercentileRank( A_t_window, AHR_t ) ∈
This yields three valuation zones:
Opportunity zone: AHR_t <= theta_opp
(corresponds to roughly the cheapest ~q_opp% of historical states in the last W days.)
Neutral zone: theta_opp < AHR_t < theta_risk
Risk zone: AHR_t >= theta_risk
(corresponds to roughly the most expensive ~(100 - q_risk)% of historical states in the last W days.)
All quantiles are purely empirical and symbol-specific: they are computed only from the current asset’s own history, without reusing BTC thresholds or assuming cross-asset similarity.
6. DCA simulation (lightweight, rolling window)
Given:
a daily budget B (input: budgetPerDay), and
a DCA simulation window H (input: dcaWindowLen, default 900 days ≈ 2.5 years),
The script applies the following rule on each new day t:
If thresholds are unavailable or AHR_t > theta_risk
→ classify as Risk zone → buy = 0
If AHR_t <= theta_opp
→ classify as Opportunity zone → buy = 2B (double size)
Otherwise (Neutral zone)
→ buy = B (normal DCA)
Daily invested cash:
C_t ∈ {0, B, 2B}
Daily bought quantity:
DeltaQ_t = C_t / P_t
The script keeps rolling sums over the last H days:
Cumulative position:
Q_H = sum_{k=t-H+1..t} DeltaQ_k
Cumulative invested cash:
C_H = sum_{k=t-H+1..t} C_k
Current portfolio value:
PortVal_t = Q_H * P_t
Cumulative P&L:
PnL_t = PortVal_t - C_H
Active days:
number of days in the last H with C_k > 0.
These results are only used to visualize how this AHR-quantile-driven DCA rule would have behaved over the recent regime, and do not constitute financial advice.
顺势为王Disclaimer!!!
This script and indicators do not constitute any financial advice. Traders are fully responsible for their own trading decisions, and the script developer is not liable for any losses or gains resulting from the use of this script. Please use with caution and trade rationally. Fans of Chan Theory are welcome to learn and communicate together. QQ: 2508126812
All-in-One India v21. **Overview**: Multi-indicator strategy for NSE index options (NIFTY/BANKNIFTY) tracking CE/PE premiums as a synthetic asset (straddle or single-leg) on TradingView.
2. **Setup**: Input index, expiry (e.g., 21-08-24), strikes (e.g., 50800 CE/PE). Choose "Combined" for straddle premium or single option.
3. **Data**: Fetches OHLCV for options; plots premium as candlesticks (green up, red down).
4. **Indicators** (toggleable): EMA (7/12 cross), Supertrend (ATR7, factor2), VWAP (daily reset), RSI (7-period, 80/20 levels), SMA (7-period).
5. **Signals**: Buy/Sell on crosses/flips (e.g., EMA fast> slow for buy; one per day/direction). Multi-indicator: Sequential AND logic (best with 1 enabled).
6. **Buy Logic**: EMA cross up, Supertrend to up (-1), premium>VWAP/SMA, RSI>80 (momentum tweak).
7. **Sell Logic**: Opposite crosses/flips (e.g., EMA cross down, Supertrend to down +1, RSI<20).
8. **Trading**: Long premium on buy (volatility play); short on sell (decay). No exits—use opposite signal or targets.
9. **Visuals/Alerts**: Shapes for signals; lines for indicators; alerts on buy/sell.
10. **Tips**: Test intraday near expiry; ATM strikes; risk 1-2%; tweak RSI if needed.
DAILY - 3-Condition Arrows - Buy & SellVersion 1.
On the DAILY time frame, this indicator will add a green BUY arrow to a stock price when the following 3 conditions are ALL true:
BUY (all 3 conditions are true)
1. Stock price > 50 EMA
2. MACD line above moving average
3. Williams %R (Best_Solve version) is above moving average
Conversely, a red SELL arrow will point out when the following 3 conditions are ALL true:
SELL (all 3 conditions are true)
1. Stock price < 50 EMA
2. MACD line below moving average
3. Williams %R (Best_Solve version) is below the moving average
趋势阻力集空间Disclaimer!!!
This script and indicators do not constitute any financial advice. Traders are fully responsible for their own trading decisions, and the script developer is not liable for any losses or gains resulting from the use of this script. Please use with caution and trade rationally. Fans of Chan Theory are welcome to learn and communicate together. QQ: 2508126812
CMEGap° - Daily Gap Levels for Bitcoin by ClearViewLabsCME Gap - BTC Futures Gap Tracker by ClearViewLabs
Tracks unfilled CME Bitcoin Futures gaps and displays them as horizontal levels on your chart.
What it detects:
Close-to-open gaps, the difference between the previous session's close and the current session's open. These are not visual gaps (empty space between candles), but price inefficiencies that tend to get revisited.
What it does:
Detects gaps between previous close and current open (≥0.5% default)
Draws levels that extend until filled or expired
Dashboard shows active gaps with age and distance from current price
Statistical edge (2017-2025 CME BTC data, n=992 gaps):
95% of gaps fill within 30 days
75% fill within the same day
Gaps act as price "magnets", price tends to revisit these levels
Use it for:
Identifying potential support/resistance levels
Setting take-profit targets
Understanding where unfilled liquidity exists
Note: This indicator identifies valid technical levels, not trade signals. Your entry strategy determines your edge.
Features:
Works on any BTC chart (pulls CME data via settings)
Auto-removes filled gaps
Color-coded by direction (red = gap up, green = gap down)
Fades older gaps automatically
Settings:
Gap Threshold: Minimum gap size to detect (default 0.5%)
Max Age: Days before unfilled gaps expire (default 30)
CME Symbol: Change source if needed
new_youtube_strategy//@version=5
strategy("Dow + Homma 1m Scalper (15m filter)", overlay=true, margin_long=100, margin_short=100, initial_capital=10000)
//===== INPUTS =====
maLen = input.int(50, "Trend SMA Length", minval=5)
htf_tf = input.timeframe("15", "Higher TF")
priceTolPct = input.float(0.05, "SR tolerance %", step=0.01)
wickFactor = input.float(2.0, "Hammer/ShootingStar wick factor", step=0.1)
dojiThresh = input.float(0.1, "Doji body % of range", step=0.01)
risk_RR = input.float(2.0, "Reward:Risk", step=0.1)
capitalRiskPct = input.float(1.0, "Risk % of equity per trade", step=0.1)
//===== 1m TREND (SMA) =====
sma1 = ta.sma(close, maLen)
sma1Up = sma1 > sma1
sma1Down = sma1 < sma1
uptrend1 = close > sma1 and sma1Up
downtrend1 = close < sma1 and sma1Down
//===== 15m TREND VIA request.security =====
sma15 = request.security(syminfo.tickerid, htf_tf, ta.sma(close, maLen), lookahead=barmerge.lookahead_off)
sma15Up = sma15 > sma15
sma15Down = sma15 < sma15
uptrend15 = close > sma15 and sma15Up
downtrend15 = close < sma15 and sma15Down
//===== SWING HIGHS/LOWS (LOCAL EXTREMA) =====
var int left = 3
var int right = 3
swHigh = ta.pivothigh(high, left, right)
swLow = ta.pivotlow(low, left, right)
//===== SR FLIP LEVELS =====
var float srSupport = na
var float srResistance = na
// when a swing high is broken -> new support
if not na(swHigh)
if close > swHigh
srSupport := swHigh
// when a swing low is broken -> new resistance
if not na(swLow)
if close < swLow
srResistance := swLow
//===== CANDLE METRICS =====
body = math.abs(close - open)
cRange = high - low
upperW = high - math.max(open, close)
lowerW = math.min(open, close) - low
isBull() => close > open
isBear() => close < open
bullHammer() =>
cRange > 0 and
isBull() and
lowerW >= wickFactor * body and
upperW <= body
bearShootingStar() =>
cRange > 0 and
isBear() and
upperW >= wickFactor * body and
lowerW <= body
isDoji() =>
cRange > 0 and body <= dojiThresh * cRange
bullEngulfing() =>
isBear() and isBull() and
open <= close and close >= open
bearEngulfing() =>
isBull() and isBear() and
open >= close and close <= open
//===== SR PROXIMITY =====
tol = priceTolPct * 0.01 * close
nearSupport = not na(srSupport) and math.abs(close - srSupport) <= tol
nearResistance = not na(srResistance) and math.abs(close - srResistance) <= tol
//===== SIGNAL CONDITIONS =====
bullCandle = bullHammer() or isDoji() or bullEngulfing()
bearCandle = bearShootingStar() or isDoji() or bearEngulfing()
longTrendOK = uptrend1 and uptrend15
shortTrendOK = downtrend1 and downtrend15
longSignal = longTrendOK and nearSupport and bullCandle
shortSignal = shortTrendOK and nearResistance and bearCandle
//===== POSITION SIZING (IN RISK UNITS) =====
var float lastEquity = strategy.equity
riskCapital = strategy.equity * (capitalRiskPct * 0.01)
//===== ENTRY / EXIT PRICES =====
longStop = math.min(low, nz(srSupport, low))
longRisk = close - longStop
longTP = close + risk_RR * longRisk
shortStop = math.max(high, nz(srResistance, high))
shortRisk = shortStop - close
shortTP = close - risk_RR * shortRisk
// qty in contracts (approx; assumes price * qty ≈ capital used)
longQty = longRisk > 0 ? riskCapital / longRisk : 0.0
shortQty = shortRisk > 0 ? riskCapital / shortRisk : 0.0
//===== EXECUTION =====
if longSignal and longRisk > 0 and longQty > 0
strategy.entry("Long", strategy.long, qty=longQty)
strategy.exit("Long TP/SL", from_entry="Long", stop=longStop, limit=longTP)
if shortSignal and shortRisk > 0 and shortQty > 0
strategy.entry("Short", strategy.short, qty=shortQty)
strategy.exit("Short TP/SL", from_entry="Short", stop=shortStop, limit=shortTP)
//===== PLOTS =====
plot(sma1, color=color.orange, title="SMA 1m")
plot(sma15, color=color.blue, title="HTF SMA (15m)")
plot(srSupport, "SR Support", color=color.new(color.green, 50), style=plot.style_linebr)
plot(srResistance,"SR Resistance",color=color.new(color.red, 50), style=plot.style_linebr)
// Visual debug for signals
plotshape(longSignal, title="Long Signal", style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.tiny)
plotshape(shortSignal, title="Short Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)
SEE + RSI Signal with Dual Invalidationrsi mcd and see close signal. when a candle closes below rsi, see and macd the script prints a tiny circle
WEEKLY - 3-Condition Arrows - Buy & SellVersion 1.
On the WEEKLY time frame, this indicator will add a green BUY arrow to a stock price when the following 3 conditions are ALL true:
BUY (all 3 conditions are true)
1. Stock price > 50 EMA
2. MACD line above moving average
3. Williams %R (Best_Solve version) is above moving average
Conversely, a red SELL arrow will point out when the following 3 conditions are ALL true:
SELL (all 3 conditions are true)
1. Stock price < 50 EMA
2. MACD line below moving average
3. Williams %R (Best_Solve version) is below the moving average
Ghost Cipher [Bit2Billions]Ghost Cipher — Adaptive Market Flow Engine
*A structured, intelligence-driven framework that decodes market flow using smoothing, liquidity distribution, volatility behavior, and range-based logic.*
Ghost Cipher translates complex price action into a clean, intuitive visual environment. It combines multiple analytical modules—including adaptive smoothing, liquidity mapping, volatility profiling, and CRT range-theory detection—into a cohesive, rule-based system. Each component is designed to complement the others: smoothing reduces noise for clearer trend detection, liquidity mapping identifies imbalance zones for potential reversals, and range theory structures intra-day and multi-timeframe price dynamics.
This integration provides traders with a streamlined, actionable view of market flow from micro swings to macro transitions, supporting both decision-making and workflow efficiency.
Why This Script Is Original and Useful
* Ghost Cipher is not a simple mashup: each module is developed with proprietary logic and integrates dynamically with others.
* Classic elements like moving averages, volatility bands, and order blocks are adapted and enhanced, not copied from public scripts.
* Closed-source design ensures that traders see what the script does (trend, liquidity, range signals) without exposing full underlying code.
* All visual and analytical outputs are designed to add tangible value over existing indicators, reducing manual analysis and improving clarity.
Key Features & Components
1. Candles & Visualization
* Custom Heikin-Ashi–style candle coloring for a clean chart.
* Multi-timeframe overlays to highlight higher-timeframe influence.
2. Smoothed Trend Processin g
* Proprietary smoothing for noise-reduced trend detection.
* Zero-Lag Multi-Ribbon: layered momentum ribbon with gradient shading for lag-free directional assessment.
3. Liquidity & Institutional Mapping
* Real-time liquidity depth visualization.
* Detection of pockets, imbalance zones, and resting liquidity clusters.
* Smart Bullish & Bearish Order Blocks with mitigation-focused logic.
4. Dynamic Demand & Supply Engine
* Auto-detection of institutional demand/supply zones.
* Adaptive boundaries respond to volatility, displacement, and liquidity conditions.
5. Volatility & Channel Tools
* Adaptive Bollinger-style volatility bands.
* Macro trendlines, break structures, and volumetric channel mapping.
6. Intelligent Market Flow Tools
* Dynamic Magic Line: adapts to real-time volatility, range compression, and volume shifts.
* CRT Candle Range Theory: detects ranges, equilibrium zones, and breakout/reaction signals.
7. Market Sessions
* Highlights bull/bear sessions for directional bias and structural insight.
Dashboard Metrics
* Volume Delta Dashboard: aggregated BTC delta across major exchanges; multi-asset pairing for comparison.
* Market Overview Panel: current bias, trend regime, and structured analyst notes.
Chart Clarity & Design Standards
* Only essential real-time labels displayed; historical labels hidden.
* Organized visuals with consistent colors, line types, and modular design for quick interpretation.
How to Use / What Traders Gain
* Reduces manual charting and repetitive analysis.
* Speeds workflow using rule-based, automated visualization.
* Cuts through market noise for consistent, structured insights.
* Supports multi-timeframe and multi-market analysis.
Inputs & Settings
* Default settings pre-configured
* Simple Show/Hide toggles for modules
* Minimal exposed fields for ease of use
Recommended Timeframes & Markets
* Works best on 15M, 1H, 4H, Daily, and higher
* Suitable across forex, crypto, indices, and liquid equities
* Pivot-based modules may show noise on illiquid assets
Performance & Limitations
* May draw many objects → disable unused modules for speed
* Refresh the chart if historical buffer issues occur
* TradingView platform limitations handled internally
License & Legal
* Proprietary © 2025
* Redistribution, resale, or disclosure prohibited
* Independently developed with proprietary extensions
* Any resemblance to other tools may result from public-domain concepts
Respect & Transparency
* Built on widely recognized public trading concepts.
* Developed with respect for the TradingView community.
* Any overlaps or similarities can be addressed constructively.
Disclaimer
* Educational purposes only
* Not financial advice
* Trading carries risk — always use paper testing and proper risk management
FAQs
* Source code is not public
* Works best on 15m, 1H, 4H, Daily, Weekly charts
* Modules can be hidden/shown with toggles
* Alerts can be set up manually by users
* Supports multiple markets: forex, crypto, indices, and equities
About Ghost Trading Suite
Author: BIT2BILLIONS
Project: Ghost Trading Suite © 2025
Indicators: Ghost Matrix, Ghost Protocol, Ghost Cipher, Ghost Shadow
Strategies: Ghost Robo, Ghost Robo Plus
Pine Version: V6
The Ghost Trading Suite is designed to simplify and automate many aspects of chart analysis. It helps traders identify market structure, divergences, support and resistance levels, and momentum efficiently, reducing manual charting time.
The suite includes several integrated tools — such as Ghost Matrix, Ghost Protocol, Ghost Cipher, Ghost Shadow, Ghost Robo, and Ghost Robo Plus — each combining analytical modules for enhanced clarity in trend direction, volatility, pivot detection, and momentum tracking.
Together, these tools form a cohesive framework that assists in visualizing market behavior, measuring momentum, detecting pivots, and analyzing price structure effectively.
This project focuses on providing adaptable and professional-grade tools that turn complex market data into clear, actionable insights for technical analysis.
Crafted with 💖 by BIT2BILLIONS for Traders. That's All Folks!
Changelog
v1.0 Core Release
* Custom Heikin-Ashi Candles: Clean, visually intuitive candle designs for effortless chart reading.
* Smoothed Moving Averages: Advanced smoothing algorithms for precise trend tracking and confirmation.
* Liquidity Depth Visualization: Real-time insight into liquidity levels, depth pockets, and imbalance zones.
* Dynamic Demand & Supply Mapping: Automatic detection of institutional demand and supply zones with adaptive boundaries.
* High-Timeframe Candle Zones (HTF): Dual HTF candle overlays for macro-level trend context and control over candle count.
* Trend Lines & Channels: Macro and aggressive volumetric trendlines for structured market flow analysis.
* Zero-Lag Moving Average Ribbon: Layered ribbon with shaded gradients for smoother, lag-free momentum visualization.
* Volatility Bands: Adaptive Bollinger-style bands for dynamic range analysis.
* Dynamic Magic Line: Self-adjusting line responding to real-time volatility and volume shifts.
* CRT Candle Range Theory: Automatic detection and visualization of CRT candle ranges and range-based signals.
* Bull & Bear Sessions: Highlights key market sessions to identify directional bias and volatility shifts.
* Order Blocks: Smart detection of bullish and bearish institutional order blocks.
* Dashboard Module:
* Volume Delta Dashboard: Aggregated delta volume from all major exchanges for BTC, with the ability to pair up to 4 additional assets.
* Market Overview Panel: Displays current bias, trend insights, and actionable analyst notes.
RSI SFP + flexi TP/SL + WT JSON bot RSI SFP + Smart TP/SL + Auto-Trading JSON for WunderTrading
Precision reversal detection for fully automated long/short execution
RSI SFP is a next-generation reversal detection engine combining market structure (Swing Failure Pattern) with RSI divergence confirmation.
It is designed for professional users who require fast, non-repainting, and broker-integrated signals that can be used for automation.
This Invite-Only script offers:
🔷 Core Features
✔ Real-time SFP detection (no candle close required)
The algorithm triggers as soon as price touches previous swing high/low and RSI forms a confirmed divergence.
Ideal for users who want the earliest, most reactive entries.
✔ RSI Divergence Engine
Bullish RSI divergence at prior lows
Bearish RSI divergence at prior highs
Adjustable divergence threshold (RSI difference)
Ultra-low latency decision logic
✔ Smart TP/SL Automation
TP = ±1% fixed profit from entry (configurable)
SL based on swing structure or user-defined %
TP/SL displayed visually on the chart
No repainting once triggered
✔ Full Backtesting Module
Tracks wins/losses across last N trades
Displays monthly statistics (last 4 months)
Tracks estimated P&L using user leverage model
Built-in visual tags for every TP / SL hit
✔ Integrated Auto-Trading for WunderTrading
When enabled, the indicator automatically sends structured JSON signals through TradingView alerts.
Supported actions:
Enter Long
Enter Short
Exit All
Each entry includes:
Market order
Position size based on capital & leverage
Exchange-level TP & SL placement
Your bot on WunderTrading can mirror the exact chart signals in real time.
🔷 Use Cases
Full automation using TradingView → Webhook → WunderTrading
Intraday reversal trading
Swing trading
Multi-exchange automated bot execution
Reversal scalping with tight stops
🔷 Important Notes
This indicator does not repaint after signal confirmation.
Real-time signals may flash while the candle is forming (normal for non-close divergence detection).
Only Invite-Only users can access the script.
No source code is shared.
If you want access, please message me directly on TradingView.
A full setup guide, alerts template, and WT bot configuration are included for subscribers.
🇨🇳 中文版(专业销售版)
RSI SFP + 智能 TP/SL + WunderTrading 自动交易 JSON 引擎
专为自动化反转交易打造的实时 SFP + RSI 背离策略
RSI SFP 指标将 Swing Failure Pattern(SFP 假突破结构)与 RSI 背离进行整合,
用于捕捉极早期的反转机会。
本脚本专为需要 实时、无重绘、可自动化执行 的专业交易者设计。
这是一个 Invite-Only(仅邀请)脚本,专供订阅用户授权使用。
🔷 核心功能
✔ 实时信号(不需要 K 线收盘)
只要价格触及前高/前低 + RSI 背离确认,
立即给出 Long / Short 反转信号,属于极短延迟结构逻辑。
✔ 高级 RSI 背离系统
价格 vs RSI 顶背离
价格 vs RSI 底背离
最小 RSI 差值可调
精准且稳定,不重绘
✔ 智能 TP / SL 自动管理
固定 TP = ±1%(可调)
SL 支持 swing 结构或固定百分比
图表上自动绘制 TP/SL 虚线
信号一旦触发后不重绘
✔ 强大回测统计系统
可追踪最近 N 笔交易
最近 4 个月的月度统计
盈亏汇总表(含杠杆模型)
每次 TP/SL 都自动标注在图表上
✔ 内置 WunderTrading 自动化 JSON
启用后,指标会自动通过 TradingView Alerts → Webhook
向 WT 机器人发送标准化 JSON:
开多(Enter Long)
开空(Enter Short)
全部平仓(Exit All)
并自动包含:
市价下单
杠杆
手数
TP/SL 自动挂单
完全同步图表上的信号。
🔷 适用人群
想要全自动交易(TV → WT → 交易所)
反转交易 / SFP 策略
日内 / 轻量级高频反转
Swing 反转捕捉
需要稳定 TP/SL 的量化用户
🔷 注意事项
信号不会在收盘后重绘,但在 K 线形成中可能闪烁(实时逻辑正常现象)
脚本为 Invite-Only 私密指标,源码不会公开
订阅用户可随时获得使用授权
提供详细 WT 机器人设置教程
如需访问权限,请通过 TradingView 私信联系我。
订阅用户将获得完整的使用指南与设置模板。
VolClock° - Intraday Volatility Map by ClearViewLabsMaps volatility patterns across the 24-hour cycle. Builds a statistical profile from historical data and projects expected volatility forward, so you know when the market moves before it does.
Core concept:
Each bar's range is measured against a rolling baseline, then aggregated by hour. The result is a smooth volatility heatmap that reveals the market's daily rhythm.
Features:
Hourly volatility profile with gradient coloring
Real-time volatility overlay
Forward projection (30 bars)
Median or Mean calculation
Fully customizable colors
Use it to:
Spot high-activity windows
Avoid dead zones
Time entries around volatility cycles
Blockchain Fundamentals: PPT [CR]Blockchain Fundamentals: PPT
A proprietary market positioning indicator that analyzes price behavior using percentile-based statistical methods. The PPT (Percentile Position Transform) provides a normalized oscillator view of market conditions, helping traders identify potential trend exhaustion and reversal zones through multi-timeframe statistical analysis.
█ FEATURES
Dual Signal Lines
The indicator plots two distinct signals:
- White Line — Primary signal representing the normalized, smoothed market position. This is the main signal used for trading decisions.
- Red Line — Raw statistical measurement before final normalization. Useful for identifying divergences and signal development.
Background Coloring
Dynamic background colors provide at-a-glance market context:
- Green Background — Indicates bullish positioning when the primary signal exceeds the buffer threshold.
- Red Background — Indicates bearish positioning when the primary signal falls below the buffer threshold.
- Gray Background — Neutral zone where no clear directional bias is present.
Flip Buffer
An adjustable threshold system designed to reduce noise and false signals:
- Enable Flip Buffer — Toggle the buffer system on or off.
- Buffer Size — Adjustable threshold level (default -0.1) that determines when background colors change. Higher values reduce sensitivity; lower values increase responsiveness.
Reference Levels
Three horizontal reference lines provide context:
- Center line at 0 — Neutral market position.
- Upper dashed line at +1 — Extreme bullish positioning threshold.
- Lower dashed line at -1 — Extreme bearish positioning threshold.
█ HOW TO USE
Signal Interpretation
The indicator operates as a mean-reversion oscillator within a normalized range:
1 — Values approaching +1 suggest extended bullish conditions where price may be overextended relative to recent history.
2 — Values approaching -1 suggest extended bearish conditions where price may be oversold relative to recent history.
3 — Crosses of the center line (0) indicate shifts in the underlying statistical trend.
Trading Applications
While specific trading strategies will vary by individual approach and market conditions:
- Consider the extremes (+1 and -1 levels) as potential areas of interest for mean-reversion setups.
- Background color changes can help identify when market positioning shifts from one regime to another.
- Divergences between the white and red lines may provide early warning of potential trend changes.
- The buffer zone (gray background) represents areas where market positioning is relatively neutral.
█ LIMITATIONS
- The indicator requires sufficient historical data to function properly. In assets with limited price history, the statistical measurements may be less reliable during early data periods.
- As a percentile-based system, the indicator is relative to recent history. Changing market regimes may require interpretation adjustments.
- Not designed for high-frequency or scalping strategies due to its daily data dependency.
- Background colors are visual aids and should not be used as standalone trading signals without additional confirmation.
█ NOTES
This indicator is part of the Blockchain Fundamentals suite and represents proprietary research into statistical market positioning analysis.
Users should experiment with the buffer settings to match their risk tolerance and trading style. More conservative traders may prefer larger buffer values to reduce signal frequency, while active traders might benefit from smaller buffers that provide earlier warnings.
Super-AO Engine - Sentiment Ribbon - 11-29-25Super-AO Sentiment Ribbon by Signal Lynx
Overview:
The Super-AO Sentiment Ribbon is the visual companion to the Super-AO Strategy Suite.
While the main strategy handles the complex mathematics of entries and risk management, this tool provides a simple "Traffic Light" visual at the top of your chart to gauge the overall health of the market.
How It Works:
This indicator takes the core components of the Super-AO strategy (The SuperTrend and the Awesome Oscillator), calculates the spread between them and the current price, and generates a normalized "Sentiment Score."
Reading the Colors:
🟢 Lime / Green: Strong Upward Momentum. Ideally, you only want to take Longs here.
🟤 Olive / Yellow: Trend is weakening. Be careful with new entries, or consider taking profit.
⚪ Gray: The "Kill Zone." The market is chopping sideways. Automated strategies usually suffer here.
🟠 Orange / Red: Strong Downward Momentum. Ideally, you only want to take Shorts here.
Integration:
This script uses the same default inputs as our Super-AO Strategy Template and Alerts Template. Use them together to confirm your automated entries visually.
About Signal Lynx:
Free Scripts supporting Automation for the Night-Shift Nation 🌙
(www.signallynx.com)
RSI Divergence wpr Engine by MadScientistRSI Divergence Engine by MadScientist - Advanced Momentum Analysis
A powerful divergence detection system that automatically identifies and visualizes bullish and bearish divergences between price action and oscillator momentum.
🎯 Key Features:
4 Divergence Types: Regular & Hidden Bullish/Bearish divergences
Dual Oscillator Support: Toggle between RSI and Williams %R
Automatic Detection: Smart pivot-based algorithm finds divergences in real-time
Visual Clarity: Divergence lines drawn directly on oscillator with color-coded labels
Customizable Settings: Adjust pivot lookback, divergence strength, and visual preferences
Full Alert System: 7 alert conditions for all divergence combinations
📊 Divergence Types:
Regular Bullish 🐂: Price makes lower low, oscillator makes higher low (reversal signal)
Hidden Bullish 🐂: Price makes higher low, oscillator makes lower low (trend continuation)
Regular Bearish 🐻: Price makes higher high, oscillator makes lower high (reversal signal)
Hidden Bearish 🐻: Price makes lower high, oscillator makes higher high (trend continuation)
⚙️ Configurable Parameters:
Oscillator type (RSI or Williams %R)
RSI/WPR length and overbought/oversold levels
Pivot lookback period (1-50 bars)
Maximum lookback range (10-200 bars)
Minimum divergence strength filter
Individual show/hide toggles for each divergence type
Customizable colors and zones
Perfect for traders seeking:
Early reversal signals
Trend continuation confirmations
Momentum analysis
Multi-timeframe divergence screening
Usage Tips: Works best on higher timeframes (4H+) for swing trading, or lower timeframes (5M-15M) for day trading. Combine with support/resistance levels for highest probability setups.
Multi-TF Bias + Confidence + Advanced EntryMULTI-TIME FRAME BIAS / CONFIDENCE / ADVANCED ENTRY V4 :
⭐ 1. What is Confidence Level?
Confidence = how strongly all the factors agree with the trend.It is calculated from the bias score:
confidenceRaw = abs(score) / 10
confidencePct = confidenceRaw * 100
Meaning:
Score 10 → 100% confidence
Score 5 → 50% confidence
Score 2.5 → 25% confidence
⭐ 2. How it relates to actual execution
🔥 0%–49% = NO TRADE ZONE
Because: Bias is weak, Factors contradict, You are in chop, Expect fakeouts, ORB unclear,
VWAP magnet, FVG direction unreliable, Structure not aligned.
Execution rule: DO NOT OPEN A NEW POSITION.
This prevents: Overtrading, Tilting, Forcing setups, Trading noise, Trading inside consolidation
⭐ 3. 50%–69% = Light Trade Zone (Scalps Only)
When confidence ≥ 50%: Direction is becoming clear, Pullback entries work better, Continuation is more likely.
But still: Market can snap back, Liquidity sweeps are common, Trend is not mature yet
Execution Rules: Smaller position size (0.25–0.5 size)
Use tight stops, Take partial profits early (0.5 ATR first target)
Only trade WITH the bias direction (CALL or PUT)Great for: First pullback after CHOCH, First FVG retest, First VWAP bounce
Premium entry, quick scalp
⭐ 4. 70%–89% = Strong Confirmation Zone
This is where real money is made,
This level means: HTF alignment (4H / 1H / 30m agree)
LTF trend is clean (5/8/13 aligned)
VWAP agrees
Liquidity sweeps support trend
Volume spike confirms direction
ORB & PRE support trend
No major mixed signals
Execution Rules:
SPY Scalping Mobile Compact v3 - Ben PhamUse this Spy Scalping Mobile Compact toolkit as handrail to climb up or down the stair. It help you visualize market trend clearly on those SMA line 5/8/13. First rule of entry is wait for all 3 MA lines start to separate and above vwap line for call, below for put, confluence with RSI > 50 for call, <50 for put. Second rule of entry is NEVER chase on first breakout candle, ALWAYS wait for pull back into SMA 8 or 13 with wick touch the line but candle closed back to confirmed direction. Stop loss if candle closed other side of SMA 13 line. If position turn green, use SMA 5 (blue) or SMA 8 (yellow) to trail for max profit. Only exit after candle body show smaller / doji or when blue line curve into yellow line. Best to use this indicator with my other Multi Time Frame Bias indicator for confirming entry with level of confidence.
Default color code lines:
- Blue – SMA 5, Yellow SMA 8, Red SMA 13, Purple VWAP
- Horizontal lines: Green – Opening range high, Red – Opening range low
Teal – premarket high and low
Orange thick – previous day high and low
- Red dots line – equal high, green dots line – equal low
ICT订单块交易【实时不滞后】Used to identify "Order Blocks" (OB), based on Break of Structure (BOS) and Retest mechanisms. It detects candles in the opposite direction after swing highs/lows to form potential supply/demand zones, confirming and plotting valid OBs only upon price retest. The indicator emphasizes "real" OBs: requiring a strong impulse (> ATR * multiplier) and retest verification.
- **Core Functions**: Detect BOS (Break of Structure); find opposite candles after prior impulses; verify strength and retest; draw OB boxes and labels.
- **Applicable Scenarios**: Suitable for ICT strategies, supply-demand trading, or reversal identification. Helps filter false breakouts and shows only high-probability zones.
- **Display Mode**: Overlaid on the main chart, displaying OBs as boxes, supporting up to 500 boxes.
- **Limitations**: Retest period fixed at 15 bars; based on simple candlesticks (no volume filter); no automatic cleanup of old OBs (manual management required).
The indicator has no built-in alerts but can be extended. ATR is used dynamically to validate strength.
## Input Parameters
Input parameters are concise, divided into core settings and display group. Below explains each parameter’s default value, type, and function.
### Core Settings
- **Structure Lookback** (int, default: 10, min: 3): Lookback period for structure detection (length for ta.highest/lowest). Higher values detect stronger structures.
- **Minimum Impulse Strength (ATR ×)** (float, default: 1.5, min: 0.5): Minimum impulse strength ((high-low) > ATR * this value). Ensures significant movement before OB.
- **Bars to watch for Retest** (int, default: 15, min: 1): Number of bars to monitor for retest. OB is confirmed only if price retests the OB zone within N bars after a breakout.
### Display Settings
- **Show Bullish OBs** (bool, default: true): Show bullish OBs (demand zone, rebounds after retest).
- **Show Bearish OBs** (bool, default: true): Show bearish OBs (supply zone, reverses after retest).
Colors are fixed: green (bullish, 80% transparency), red (bearish, 80% transparency).
## Calculations and Display
### Break of Structure (BOS) Detection
- **ATR Calculation**: ta.atr(14) used for strength verification.
- **Swing High/Low**: ta.highest(high, lookback) / ta.lowest(low, lookback) to identify structure. ...
## Calculation and Display
### Structure Breakout (BOS) Detection
- **ATR Calculation**: `ta.atr(14)` used for strength verification.
- **Swing High/Low**: `ta.highest(high, lookback)` / `ta.lowest(low, lookback)` identify structure.
- **BOS Trigger**:
- **bullBOS**: close > hh (breaks previous high).
- **bearBOS**: close < ll (breaks previous low).
### Order Block Identification
- **getLastOppositeCandle(isBullish)**:
- Search for the most recent "opposite" candle within the lookback period (bullBOS: bearish candle close < open; bearBOS: bullish candle close > open).
- Returns the index (idx); if none, then na.
- **OB Logic** (only when showBullish/Bearish=true):
- **Bullish OB (bullBOS)**:
- Find previous bearish candle (idx), check momentum: (high-low) > ATR * atrMult.
- Calculate obLow = low , obHigh = high .
- Backtest check: within 15 candles low inside → inRetest = true.
- If confirmed: draw green box (from bar_index - idx to current, obLow to obHigh); label "🟩 Bullish OB (Valid)" (top-left, green, 80% transparency, white text).
- Push into bullOBs array.
- **Bearish OB (bearBOS)**: symmetric, red box, label "🟥 Bearish OB (Valid)" (bottom-left).
- **Array Management**: var box bullOBs/bearOBs store all OBs; no automatic cleanup (expandable).
### Display Elements
- **Boxes**: dynamically from idx to current candle, visually showing OB area.
- **Labels**: displayed when confirmed, positioned based on obHigh/obLow.
- No lines/fills; pure boxes + labels.
## Alert Functionality
The indicator has no built-in alerts but can be extended via TradingView alerts, for example:
- **New OB**: bullBOS and inRetest or bearBOS and inRetest.
- **Backtest**: price enters OB range.
It is recommended to add `alertcondition()` for custom alerts. ...
It is recommended to add a custom alertcondition(), such as 'Bullish OB Confirmed'.
## Usage Tips
- **Optimization**: lookback=10 balances sensitivity; atrMult=1.5 filters weak impulses; retestBars=15 is suitable for intraday.
- **Customization**: turn off showBullish/Bearish to hide types; add volume filtering to the fork for better accuracy.
- **Explanation**:
- **BOS + Backtesting**: ensure OB is 'real' (not a false breakout); only draw after backtesting to avoid noise.
- **Strength**: (high-low)>ATR*1.5 indicates strong impulses, making OB more reliable.
- **Application**: Bullish OB = buy zone (support); Bearish OB = sell zone (resistance).
- **Limitations**: fixed backtesting period may miss late retracements; no volume/time filtering; few OBs in low-volatility markets.
- **Extensions**: add OB counts or Fibonacci extensions.
ICT订单块交易指标,用于识别“订单块”(Order Blocks, OB),基于结构突破(Break of Structure, BOS)与回测(Retest)机制。它通过检测摆动高/低点后的相反方向烛台,形成潜在供给/需求区域,仅在价格回测时确认并绘制有效OB。指标强调“真实”OB:需强冲动(> ATR * 乘数)与回测验证。
- **核心功能**:检测BOS(结构突破);查找前冲动相反烛台;验证强度与回测;绘制OB盒子与标签。
- **适用场景**:适合ICT策略、供给需求交易或反转识别。帮助过滤假突破,仅显示高概率区域。
- **显示模式**:叠加在主图上,使用盒子(boxes)显示OB,支持最大500个盒子。
- **限制**:回测期固定15柱;基于简单烛台(无成交量过滤);无自动清理旧OB(手动管理)。
指标无内置警报,但可扩展。数据使用ATR动态验证强度。
## 输入参数
输入参数简洁,分为核心设置与显示组。以下说明每个参数的默认值、类型和作用。
### 核心设置
- **Structure Lookback** (int, 默认: 10, 最小: 3):结构检测回溯期(ta.highest/lowest的长度)。较高值检测更强结构。
- **Minimum Impulse Strength (ATR ×)** (float, 默认: 1.5, 最小: 0.5):最小冲动强度((high-low) > ATR * 此值)。确保OB前有显著移动。
- **Bars to watch for Retest** (int, 默认: 15, 最小: 1):回测监控柱数。突破后N柱内价格回测OB区域才确认。
### 显示设置
- **Show Bullish OBs** (bool, 默认: true):显示看涨OB(需求区,回测后反弹)。
- **Show Bearish OBs** (bool, 默认: true):显示看跌OB(供给区,回测后反转)。
颜色固定:绿(看涨,80%透明)、红(看跌,80%透明)。
## 计算与显示
### 结构突破(BOS)检测
- **ATR计算**:ta.atr(14) 用于强度验证。
- **摆动高/低**:ta.highest(high, lookback) / ta.lowest(low, lookback) 识别结构。
- **BOS触发**:
- **bullBOS**:close > hh (上破前高)。
- **bearBOS**:close < ll (下破前低)。
### 订单块识别
- **getLastOppositeCandle(isBullish)**:
- 查找最近lookback柱内“相反”烛台(bullBOS: 熊烛 close < open;bearBOS: 牛烛 close > open)。
- 返回索引(idx);若无则na。
- **OB逻辑**(仅当showBullish/Bearish=true):
- **看涨OB (bullBOS)**:
- 查找前熊烛(idx),检查冲动:(high-low) > ATR * atrMult。
- 计算obLow=low ,obHigh=high 。
- 回测检查:15柱内low 在 内 → inRetest=true。
- 若确认:绘制绿盒(bar_index-idx 到当前,obLow到obHigh);标签“🟩 Bullish OB (Valid)”(左上,绿,80%透明,白文本)。
- 推入bullOBs数组。
- **看跌OB (bearBOS)**:对称,红盒,标签“🟥 Bearish OB (Valid)”(左下)。
- **数组管理**:var box bullOBs/bearOBs 存储所有OB;无自动清理(可扩展)。
### 显示元素
- **盒子**:动态从idx到当前柱,延伸显示OB区域。
- **标签**:确认时显示,位置基于obHigh/obLow。
- 无线条/填充;纯盒子+标签。
## 警报功能
指标无内置警报,但可通过TradingView警报扩展,例如:
- **新OB**:bullBOS and inRetest 或 bearBOS and inRetest。
- **回测**:价格进入OB范围。
建议添加alertcondition()自定义,如“Bullish OB Confirmed”。
## 使用提示
- **优化**:lookback=10平衡敏感;atrMult=1.5过滤弱冲动;retestBars=15适合日内。
- **自定义**:关闭showBullish/Bearish隐藏类型;fork添加成交量过滤提升准确。
- **解释**:
- **BOS+回测**:确保OB“真实”(非假突破);仅回测后绘制,避免噪音。
- **强度**:(high-low)>ATR*1.5表示强冲动,OB更可靠。
- **应用**:看涨OB=买入区(支撑);看跌OB=卖出区(阻力)。
- **局限**:回测期固定,可能错过晚回测;无成交量/时间过滤;低波动市场少OB。
- **扩展**:添加OB计数或斐波那契扩展。






















