PROTECTED SOURCE SCRIPT
已更新

Volatility Contraction Box (VCB)

76
Volatility Contraction Box (VCB) [Confirmed Breakouts]

Description (Copy & Paste)
This script is a specialized breakout detector designed for scalpers on the Nifty, BankNifty, and NSE 1-minute timeframes.

Inspiration & Concept The core philosophy of this script is based on the concept of Volatility Contraction—the idea that strong market moves are almost always preceded by a period of "quiet compression."

Conceptual Source: This script was inspired by the trading theory discussed in the article "What 90% of Traders Miss Before a Breakout" by betashorts1998, which highlights the importance of identifying low-volatility zones before the expansion phase occurs.

Adaptation: While the original concept often uses ATR to measure contraction, this script adapts that theory into a Price Action Box Model. It detects physical price stagnation (flat Highs and Lows) to draw visual "Kill Zones" on the chart.

The Problem: The "Fakeout" In 1-minute scalping, a simple breakout often results in a wick that traps traders (a "fakeout"). The Solution: This script uses a Next-Candle Confirmation Algorithm. It detects a breakout but hides the signal until the next candle closes in the direction of the trend. If the follow-through fails, the box and signal are discarded, keeping your chart clean and your capital safe.

How the Code Works (Programmer's Logic)
For those interested in the Pine Script logic, here is how the algorithm processes market data:

1. Stagnation Detection (range_changed) The script uses ta.highest(length) and ta.lowest(length) to track the Donchian Channel of the price.

It checks ta.change(h) and ta.change(l).

If both return 0 (meaning the High and Low haven't moved), a counter (count_activity) increments.

Once this counter hits the threshold (default: 5 bars), a "Virtual Box" is created in the code's memory.

2. The "Ghost" State (Pending Logic) Unlike standard indicators that plot immediately, this script enters a "Pending" state when price breaks the box levels:

pendingDir variable is set to 1 (Buy) or -1 (Sell).

breakoutBar records the specific time of the break.

Crucially, nothing is drawn on the chart yet.

3. The Confirmation Loop The script waits for bar_index == breakoutBar + 1 (the very next candle).

It runs a boolean check: isValid.

For Buys: close >= open (The candle must be Green).

For Sells: close <= open (The candle must be Red).

If isValid is true, the script utilizes box.new and label.new to retroactively draw the setup.

If isValid is false, the variables are reset, and the setup is deleted from memory.

How to Use
Wait for the Signal: Do not pre-empt the move. Wait for the colored Box and "BUY/SELL" label to appear.

Entry: The signal appears on the close of the confirmation candle. Enter immediately.

Stop Loss: Place your SL at the opposite end of the Box.

Targets: Aim for a quick 1:1.5 or 1:2 Risk-Reward, or trail your stop using the previous candle's low/high.

Settings
Lookback Length: How far back to check for High/Low (Default: 20).

Min Flat Candles: Minimum duration of the squeeze (Default: 5).

Box Width: Adjusts the visual multiplier of the box.
版本注释
Added TArget, stoploss and trend ribbon in bottom....
版本注释
Added MTF Filter ........
版本注释
Added Reversal setup.......

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。