OPEN-SOURCE SCRIPT

LRSI-TTM Squeeze - Aynet

מעודכן
This Pine Script code creates an indicator called LRSI-TTM Squeeze , which combines two key concepts to analyze momentum, squeeze conditions, and price movements in the market:

Laguerre RSI (LaRSI): A modified version of RSI used to identify trend reversals in price movements.
TTM Squeeze: Identifies market compressions (low volatility) and potential breakouts from these squeezes.
Functionality and Workflow of the Code
1. Laguerre RSI (LaRSI)
Purpose:
Provides a smoother and less noisy version of RSI to track price movements.
Calculation:
The script uses a filtering coefficient (alpha) to process price data through four levels (L0, L1, L2, L3).
Movement differences between these levels calculate buying pressure (cu) and selling pressure (cd).
The ratio of these pressures forms the Laguerre RSI:
bash
Kodu kopyala
LaRSI = cu / (cu + cd)
The LaRSI value indicates:
Below 20: Oversold condition (potential buy signal).
Above 80: Overbought condition (potential sell signal).
2. TTM Squeeze
Purpose:
Analyzes the relationship between Bollinger Bands (BB) and Keltner Channels (KC) to determine whether the market is compressed (low volatility) or expanded (high volatility).
Calculation:
Bollinger Bands:
Calculated based on the moving average (SMA) of the price, with an upper and lower band.
Keltner Channels:
Created using the Average True Range (ATR) to calculate an upper and lower band.
Squeeze States:
Squeeze On: BB is within KC.
Squeeze Off: BB is outside KC.
Other States (No Squeeze): Neither of the above applies.
3. Momentum Calculation
Momentum is computed using the linear regression of the difference between the price and its SMA. This helps anticipate the direction and strength of price movements when the squeeze ends.
Visuals on the Chart
Laguerre RSI Line:

An RSI indicator scaled to 0-100 is plotted.
The line's color changes based on its movement:
Green line: RSI is rising.
Red line: RSI is falling.
Key levels:
20 level: Oversold condition (buy signal can be triggered).
80 level: Overbought condition (sell signal can be triggered).
Momentum Histogram:

Displays momentum as histogram bars with colors based on its direction and strength:
Lime (light green): Positive momentum increasing.
Green: Positive momentum decreasing.
Red: Negative momentum decreasing.
Maroon (dark red): Negative momentum increasing.
Squeeze Status Indicator:

A marker is plotted on the zero line to indicate the squeeze state:
Yellow: Squeeze On (compression active).
Blue: Squeeze Off (compression ended, movement expected).
Gray: No Squeeze.
Information Table
A table is displayed in the top-right corner of the chart, showing closing prices for different timeframes (e.g., 1 minute, 5 minutes, 1 hour, etc.). Each timeframe is color-coded.

Alerts
LaRSI Alerts:

Crosses above 20: Exiting oversold condition (buy signal).
Crosses below 80: Exiting overbought condition (sell signal).
Squeeze Alerts:

When the squeeze ends: Indicates a potential price move.
When the squeeze starts: Indicates volatility is decreasing.
Summary
This indicator is a powerful tool for determining market trends, momentum, and squeeze conditions. It helps users identify periods when the market is likely to move or remain stagnant, providing alerts based on these analyses to support trading strategies.






הערות שחרור

This Pine Script code, titled "LRSI-TTM Squeeze - Aynet", combines two popular technical indicators: the Laguerre RSI (LRSI) and the TTM Squeeze. It incorporates multi-timeframe analysis and additional features like support/resistance calculations and an information table. Below is an overview of the components and functionality:

Laguerre RSI (LRSI):
The LRSI is a smoothed RSI-like indicator that uses Laguerre polynomials to filter price movements.
Parameters: Alpha (smoothing factor), with default 0.2.
Calculation:
Four Laguerre levels (L0, L1, L2, L3) are computed iteratively.
The LRSI is derived as the ratio of cumulative upward movements (cu) to the total movement (cu + cd).
TTM Squeeze:
A momentum-based indicator that identifies market compression or expansion using Bollinger Bands (BB) and Keltner Channels (KC).
Parameters:
BB Period (length) and Multiplier (mult), with defaults 20 and 2.0, respectively.
KC Multiplier (multKC), with default 1.5.
Squeeze Status:
Active (Squeeze On): BBs are inside KCs.
Inactive (Squeeze Off): BBs are outside KCs.
Neutral: Neither condition is met.
Features:
Multi-timeframe Analysis:

Retrieves the closing prices for multiple timeframes (1m, 5m, 15m, etc.) using request.security.
Support/Resistance Levels:

Computes the lowest and highest levels over a specified period.
Information Table:

Displays key metrics:
Momentum (positive/negative).
Squeeze status (active/inactive/neutral).
RSI status (overbought/oversold/neutral).
Current support and resistance levels.
Visual Enhancements:

LRSI and momentum histograms are plotted with color coding.
Horizontal lines mark overbought (80) and oversold (20) levels for LRSI.
Alerts:

Alerts for LRSI crossing key thresholds (20 and 80).
Alerts for transitions in the Squeeze status.
Attribution:
The concepts of Laguerre RSI (LRSI) and TTM Squeeze are not original to this script but are widely known in technical analysis:

The Laguerre RSI is attributed to John Ehlers, a pioneer in digital signal processing for trading.
The TTM Squeeze was popularized by John Carter, author of Mastering the Trade.
This script integrates these methodologies into a unified tool for identifying momentum, compression, and potential trading opportunities.
Bands and ChannelseducationalFundamental Analysis

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


גם על:

כתב ויתור