OPEN-SOURCE SCRIPT

Ignition Crystal Ball

Ignition Crystal Ball (ICB) Indicator

Inspired by the John Carter TTM Squeeze concept

1. Introduction

This “Ignition Crystal Ball” indicator combines Bollinger Bands (referred to here as “Ignition Bollinger Bands”) with one or two Keltner Channels to help traders visualize periods of potential “squeeze.” In John Carter’s TTM Squeeze logic, market volatility often shrinks when Bollinger Bands move inside Keltner Channels, and it expands when prices “fire” out of that squeeze.

This script also calculates custom angles on the Bollinger Bands, computes pip differences, and generates buy/sell alerts based on changing conditions. Below is a high-level overview of the indicator’s components, features, and how a trader might use it.

2. Ignition Bollinger Bands (IBB)

2.1 Inputs
• Length (default 20)
• StdDev (default 2.0)
• Threshold Angle (x10)
• Pip Differential Threshold

2.2 Calculation
1. Basis (Center Line)
Uses a simple moving average of close over length_ibb bars.
2. Upper & Lower Bands
Calculated by adding/subtracting (StdDev × standard deviation) from the basis.

2.3 Angle Detection

A custom function angle(_src, _lookback) approximates the slope of the Bollinger Bands in degrees by comparing _src[0] vs. _src[_lookback] and applying an arctangent. The script colors table outputs when these angles exceed the user-defined threshold.

3. Keltner Channels

3.1 Inputs
• Length K1 / K2
• Multiplier K1 / K2
• Source K1 / K2
• Bands Style: Choice among “Average True Range,” “True Range,” or “Range.”
• Use Exponential MA: Toggle between EMA or SMA for the baseline.

3.2 Calculation

The script’s keltnerChannel function:
1. Calculates a moving average (EMA or SMA).
2. Computes a range using either ATR, True Range, or the plain bar range (high - low).
3. Returns the upper, middle, and lower lines.

Two sets of Keltner Channels (K1 and K2) are plotted by default.
4. Bollinger vs. Keltner: Identifying the “Squeeze”

A key part of many TTM Squeeze–style strategies involves looking for when Bollinger Bands move inside narrower Keltner Channels. This script calculates:

upper_pip_diff = (upperIBB - keltner1_upper) * 10000
lower_pip_diff = (keltner1_lower - lowerIBB) * 10000

• If these differences are small, it suggests a “squeeze” is in effect.
• The script also calculates a new_label_pip_diff (the difference between upper_pip_diff and lower_pip_diff) and displays that on the chart as a floating label.


5. Labels, Tables, and Visual Elements

5.1 Floating Labels

The script uses a custom floatingLabel() function to place real-time text boxes near the Bollinger Bands showing:
• upper_pip_diff
• lower_pip_diff
• new_label_pip_diff
• A percentage label that compares the current difference to a previous one.

Colors vary to reflect bullish (green), bearish (red), or neutral (yellow/gray) indications.

5.2 Table Displays
• PipD Table: Shows the absolute distance (in pips) between upper and lower Bollinger Bands.
• Angle Table: Located on the right side of the chart, displays the angles of the upper/lower IBB lines and the basis. If an angle exceeds the threshold, it turns bright (lime or red).

5.3 Plotting & Filling
• IBB: The basis and its upper/lower bands are plotted. The background between them can be filled with a semi-transparent color.
• Keltner Channels: Up to two sets (K1 and K2), each with its own color shading.


6. Alerts

There are two alert conditions, based on a color shift in the script’s logic:

buy_alert_condition = text_color_upper[1] != color.green and text_color_upper == color.green
sell_alert_condition = text_color_upper[1] != color.red and text_color_upper == color.red

• Buy Alert: When the script detects an upper color transition from non-green to green.
• Sell Alert: When the script detects an upper color transition from non-red to red.

7. Usage Tips

1. Spotting Squeezes
Look for times when Bollinger Bands contract inside Keltner Channels, suggesting low volatility.
2. Angle Threshold
The angle table on the right can reveal whether the bands are sloping sharply up or down.
3. Pip Differences (Forex)
For currency traders, tracking pip differences can highlight volatility changes.
4. Multi-Timeframe Analysis
Works on intraday or higher timeframes to detect expansions and contractions in volatility.
5. Alerts
The built-in alerts can notify you as soon as the script’s color logic changes to bullish or bearish.
Bands and Channelsforecasting

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal