ToolsCollectionLibrary "ToolsCollection"
Helper functions for collection (map/array) type operations
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (string) : Key to be checked
default (bool) : Default return value when key not found. Default: false
Returns: bool
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (string) : Key to be checked
default (int) : Default return value when key not found. Default: -1
Returns: int
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (string) : Key to be checked
default (float) : Default return value when key not found. Default: -1
Returns: float
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (string) : Key to be checked
default (string) : Default return value when key not found. Default: ''
Returns: string
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (string) : Key to be checked
default (color) : Default return value when key not found. Default: color.white
Returns: color
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (int) : Key to be checked
default (bool) : Default return value when key not found. Default: false
Returns: bool
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (int) : Key to be checked
default (int) : Default return value when key not found. Default: -1
Returns: int
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (int) : Key to be checked
default (float) : Default return value when key not found. Default: -1
Returns: float
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (int) : Key to be checked
default (string) : Default return value when key not found. Default: ''
Returns: string
get(container, key, default)
Returns Map key's value with default return value option
Parameters:
container (map) : Map object
key (int) : Key to be checked
default (color) : Default return value when key not found. Default: color.white
Returns: color
get(container, key, default)
Returns Array key's value with default return value option
Parameters:
container (array) : Array object
key (int) : Key to be checked
default (bool) : Default return value when key not found. Default: false
Returns: bool
get(container, key, default)
Returns Array key's value with default return value option
Parameters:
container (array) : Array object
key (int) : Key to be checked
default (int) : Default return value when key not found. Default: -1
Returns: bool
get(container, key, default)
Returns Array key's value with default return value option
Parameters:
container (array) : Array object
key (int) : Key to be checked
default (float) : Default return value when key not found. Default: -1
Returns: bool
get(container, key, default)
Returns Array key's value with default return value option
Parameters:
container (array) : Array object
key (int) : Key to be checked
default (string) : Default return value when key not found. Default: ''
Returns: bool
get(container, key, default)
Returns Array key's value with default return value option
Parameters:
container (array) : Array object
key (int) : Key to be checked
default (color) : Default return value when key not found. Default: color.white
Returns: bool
指标和策略
Weekly Covered Calls StrategyWhat Does This Indicator Do?
This indicator is a tool to help you pick strike prices for your weekly covered call options strategy. It does two things:
Plots two suggested strike prices on your chart:
Aggressive Strike (red label): A strike price closer to the current price, offering higher premiums but with a higher chance of assignment.
Moderate Strike (blue label): A strike price further from the current price, offering lower premiums but with a lower chance of assignment.
Uses technical analysis (volatility) to calculate these strike prices dynamically. It adjusts them based on the market's volatility and your chosen risk settings.
How It Works:
The indicator uses the following inputs to determine the strike prices:
ATR (Average True Range):
This measures the stock's volatility (how much the stock moves up or down over a given period).
A higher ATR = more volatile stock = wider range for strike prices.
Delta Adjustments:
The default settings use Delta values of 0.12 (Aggressive) and 0.18 (Moderate).
Delta is a concept in options trading that estimates the likelihood of the option being "in the money" (ITM) by expiration.
A 0.12 Delta = 12% chance of assignment (Aggressive)
A 0.18 Delta = 18% chance of assignment (Moderate)
Volatility Factor:
This multiplies the ATR by a factor (default is 1.5) to estimate the expected price move and adjust strike prices accordingly.
How to Use the Indicator:
Step 1: Understand the Labels
Red Label (Aggressive Strike):
Closer to the current stock price.
You’ll collect higher premiums because the strike price is riskier (closer to being ITM).
Best for traders comfortable with a higher risk of assignment.
Blue Label (Moderate Strike):
Further from the current stock price.
You’ll collect lower premiums because the strike price is safer (further from being ITM).
Best for traders looking to avoid assignment and collect safer weekly income.
Step 2: Match It to the Options Chain
Open your options chain (like the one you see in Fidelity, TOS, or TradingView).
Look for the strike prices closest to the red (aggressive) and blue (moderate) labels plotted by the indicator.
Compare the premiums (the amount you collect for selling the call) and decide:
If you want higher income: Go with the Aggressive Strike.
If you want safety: Go with the Moderate Strike.
Step 3: Manage Your Risk and Income
Avoid Assignment:
If you do not want your shares to be called away, choose strike prices further from the current price (e.g., moderate strike).
Maximize Premiums:
If you’re okay with a chance of your shares being called away, choose the closer aggressive strike for higher premium income.
Weekly Income Goal:
Use this strategy consistently each week to collect premium income while holding your shares.
Step 4: Adjust for Your Risk Tolerance
You can adjust the Delta values (0.12 for Aggressive and 0.18 for Moderate) to suit your risk tolerance:
Lower Delta (e.g., 0.08–0.10): Safer, fewer chances of assignment, lower premiums.
Higher Delta (e.g., 0.20–0.25): Riskier, higher chances of assignment, higher premiums.
Technical Analysis Summary (What the Indicator Uses):
The indicator uses ATR (Average True Range) to measure volatility and estimate how far the price might move.
It then multiplies ATR by a Volatility Factor to calculate the strike prices.
Using the Delta Adjustment settings, it adjusts these strike prices to give you a balance between risk and reward.
Putting It All Together:
Look at the Chart: The indicator will show two lines and labels for strike prices.
Check the Options Chain: Find the closest strike prices and compare premiums.
Decide Your Strategy:
Want higher premium income? Choose the Aggressive Strike (red label).
Want lower risk of assignment? Choose the Moderate Strike (blue label).
Collect Weekly Income: Sell the call option and repeat this process weekly to generate consistent income.
Happy trading, and may your premiums roll in while your shares stay safe! 🎯📊
CandelaCharts - Swing Failure Pattern (SFP) 📝 Overview
The Swing Failure Pattern (SFP) indicator is designed to identify and highlight Swing Failure Patterns on a user’s chart. This pattern typically emerges when significant market participants generate liquidity by driving price action to key levels. An SFP occurs when the price temporarily breaks above a resistance level or below a support level, only to quickly reverse and return within the previous range. These movements are often associated with stop-loss hunting or liquidity grabs, providing traders with potential opportunities to anticipate reversals or key market turning points.
A Bullish SFP occurs when the price dips below a key support level, triggering stop-loss orders, but then swiftly reverses upward, signaling a potential upward trend or reversal.
A Bearish SFP happens when the price spikes above a key resistance level, triggering stop-losses of short positions, but then quickly reverses downward, indicating a potential bearish trend or reversal.
The indicator is a powerful tool for traders, helping to identify liquidity grabs and potential reversal points in real-time. By marking bullish and bearish Swing Failure Patterns on the chart, it provides clear visual cues for spotting market traps set by major players, enabling more informed trading decisions and improved risk management.
📦 Features
Bullish/Bearish SFPs
Styling
⚙️ Settings
Length: Determines the detection length of each SFP
Bullish SFP: Displays the bullish SFPs
Bearish SFP: Displays the bearish SFPs
Label: Controls the labels size
⚡️ Showcase
Bullish
Bearish
Both
📒 Usage
The best approach is to combine a few complementary indicators to gain a clearer market perspective. This doesn’t mean relying on the Golden Cross, RSI divergences, SFPs, and funding rates simultaneously, but rather focusing on one or two that align well in a given scenario.
The example above demonstrates the confluence of a Bearish Swing Failure Pattern (SFP) with an RSI divergence. This combination strengthens the signal, as the Bearish SFP indicates a potential reversal after a liquidity grab, while the RSI divergence confirms weakening momentum at the key level. Together, these indicators provide a more robust setup for identifying potential market reversals with greater confidence.
🚨 Alerts
This script provides alert options for all signals.
Bearish Signal
A bearish signal is triggered when a Bearish SFP is formed.
Bullish Signal
A bullish signal is triggered when a Bullish SFP is formed.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Candle Open Time labels (& TAPDA Lines)Description of the "4-Hour Candle Opening Times (TAPDA Lines)" Indicator
The "4-Hour Candle Opening Times (TAPDA Lines)" indicator integrates key principles of the Time and Price Action Trading Algorithm (TAPTA) with practical tools for analyzing market behavior. This script is designed for traders who leverage the interaction between time and price to identify opportunities in the market. The indicator supports the identification of significant price levels and potential areas of interest based on historical data and recurring patterns tied to specific timeframes.
Core Concepts
Time and Price Interaction (TAPTA Logic):
The script implements TAPTA principles by focusing on time intervals (4-hour candles) and the price action associated with those intervals.
Traders use this logic to recognize how prices behave at specific times, identifying patterns, levels of support or resistance, and potential reversals.
Highs and Lows Recognition (TAPDA):
The indicator includes logic for identifying and marking "Tapped Highs and Lows," which occur when price action retraces to previously significant levels within a specified tolerance. These taps are visually represented with horizontal lines, enabling traders to spot recurring price behaviors and levels of interest.
Dynamic Levels for Decision-Making:
By combining time and price, the script visualizes key price levels and their relevance over time, equipping traders with actionable insights for entry, exit, and risk management.
Indicator Features
1. Visual Representation of Candle Opening Times
The indicator marks the opening times of 4-hour candles on the chart.
A customizable label system displays the time in either a 12-hour or 24-hour format, with options to toggle the visibility of AM/PM suffixes.
2. TAPDA Logic
Identifies and highlights price levels that have been tapped within a specified tolerance.
Horizontal lines are drawn to mark these levels, allowing traders to see historical price levels acting as support or resistance.
The "Tapped Highs and Lows" are updated dynamically based on the most recent price action.
3. Timeframe-Specific Filtering
Users can limit the display to specific times of interest, such as 2 AM, 6 AM, and 10 AM, by toggling the "GCT (General Candle Times)" option.
Additional options allow filtering TAPDA logic by AM or PM timeframes, catering to traders who focus on specific market sessions.
4. Adjustable Plotting Limits
The script incorporates settings for controlling the maximum number of labels and lines displayed on the chart:
Max Labels: Limits the number of labels plotted for 4-hour candle opening times.
Max TAPDA Lines: Limits the number of TAPDA horizontal lines displayed.
A "Sync Lines and Labels" option ensures the same number of labels and lines are plotted when enabled, providing a consistent and clutter-free visualization.
5. Plot Maximum Capability
A "Plot Max" feature allows users to override the default behavior and force the plotting of the maximum allowed labels and lines, providing a comprehensive view of historical data.
6. User-Friendly Customization
Fully customizable label styles, including options for position, size, color, and background opacity.
Adjustable tolerance levels for TAPDA lines ensure compatibility with different market conditions and trading strategies.
Settings for flipping or aligning label positions above or below candles, or locking them to the opening price.
Script Logic
The script is built to prioritize efficiency and clarity, adhering to TradingView's Pine Script best practices and community standards:
Initialization:
Arrays are used to store historical price data, including highs, lows, and timestamps, ensuring only the necessary amount of data is processed.
A flexible and efficient data management system maintains a rolling window of data for both labels and TAPDA lines, ensuring smooth performance.
Label and Line Plotting:
Labels are plotted dynamically at user-defined positions and styles to mark the opening times of 4-hour candles.
TAPDA lines are drawn between historical high or low points and the current price action when the tolerance condition is met.
Limit Management:
The script enforces limits on the number of labels and lines plotted on the chart to maintain visual clarity.
Users can enable synchronization between the maximum labels and lines to ensure consistent visualization.
Customization Options:
Extensive customization settings allow traders to tailor the indicator to their strategies and preferences, including:
Label and line styles.
Session filtering (AM, PM, or specific times).
Display limits and synchronization options.
Capabilities
1. Enhance Time-Based Analysis
By marking significant times (4-hour candle openings), traders can identify key market phases and recurring behaviors tied to specific hours.
2. Leverage Historical Price Action
TAPDA logic highlights areas where price action interacts with historical highs and lows, providing actionable insights into potential support or resistance zones.
3. Improve Decision-Making
The indicator supports informed decision-making by blending visual data with time and price action principles, helping traders spot opportunities and mitigate risks.
4. Flexible Application Across Strategies
Suitable for day traders, swing traders, and position traders who utilize time and price action for trend analysis, reversals, or breakout strategies.
Best Practices for Use
Key Levels Analysis:
Focus on labels and TAPDA lines near critical price zones to gauge potential market reactions.
Session-Based Trading:
Use AM/PM filters or GCT settings to isolate specific trading sessions relevant to your strategy.
Combine with Other Indicators:
Enhance the effectiveness of this indicator by combining it with moving averages, RSI, or other tools for confirmation.
Risk Management:
Use the identified levels for stop-loss placement or target setting to align with your risk tolerance.
Extended Support and Resistance LevelsIndicator: Extended Support and Resistance Levels
This Pine Script indicator dynamically calculates support and resistance levels based on recent price action and projects these levels into the future.
Support is determined by the lowest low over a user-defined period, while Resistance is defined by the highest high over the same period.
The indicator draws lines at the calculated support and resistance levels and extends them into the future, allowing traders to visualize potential future levels where price might react.
The extension of these lines helps in identifying areas where price may respect support or resistance in the upcoming bars.
The user can adjust the period for support/resistance calculation and the number of bars for projection, providing flexibility to adapt to different timeframes and market conditions.
This tool is ideal for traders looking to anticipate future key price levels based on historical price data, helping with decision-making on potential entry or exit points.
IU EMA Channel StrategyIU EMA Channel Strategy
Overview:
The IU EMA Channel Strategy is a simple yet effective trend-following strategy that uses two Exponential Moving Averages (EMAs) based on the high and low prices. It provides clear entry and exit signals by identifying price crossovers relative to the EMAs while incorporating a built-in Risk-to-Reward Ratio (RTR) for effective risk management.
Inputs ( Settings ):
- RTR (Risk-to-Reward Ratio): Define the ratio for risk-to-reward (default = 2).
- EMA Length: Adjust the length of the EMA channels (default = 100).
How the Strategy Works
1. EMA Channels:
- High-based EMA: EMA calculated on the high price.
- Low-based EMA: EMA calculated on the low price.
The area between these two EMAs creates a "channel" that visually highlights potential support and resistance zones.
2. Entry Rules:
- Long Entry: When the price closes above the high-based EMA (crossover).
- Short Entry: When the price closes below the low-based EMA (crossunder).
These entries ensure trades are taken in the direction of momentum.
3. Stop Loss (SL) and Take Profit (TP):
- Stop Loss:
- For long positions, the SL is set at the previous bar's low.
- For short positions, the SL is set at the previous bar's high.
- Take Profit:
- TP is automatically calculated using the Risk-to-Reward Ratio (RTR) you define.
- Example: If RTR = 2, the TP will be 2x the risk distance.
4. Exit Rules:
- Positions are closed at either the stop loss or the take profit level.
- The strategy manages exits automatically to enforce disciplined risk management.
Visual Features
1. EMA Channels:
- The high and low EMAs are dynamically color-coded:
- Green: Price is above the EMA (bullish condition).
- Red: Price is below the EMA (bearish condition).
- The area between the EMAs is shaded for better visual clarity.
2. Stop Loss and Take Profit Zones:
- SL and TP levels are plotted for both long and short positions.
- Zones are filled with:
- Red: Stop Loss area.
- Green: Take Profit area.
Be sure to manage your risk and position size properly.
Market MonitorOverview
The Market Monitor Indicator provides a customisable view of dynamic percentage changes across selected indices or sectors, calculated by comparing current and previous closing prices over the chosen timeframe.
Key Features
Choose up to 20 predefined indices or your own selected indices/stocks.
Use checkboxes to show or hide individual entries.
Monitor returns over daily, weekly, monthly, quarterly, half-yearly, or yearly timeframes
Sort by returns (descending) to quickly identify top-performing indices or alphabetically for an organised and systematic review.
Customisation
Switch between Light Mode (Blue or Green themes) and Dark Mode for visual clarity.
Adjust the table’s size, position, and location.
Customise the table title to your own choice e.g. Sectoral, Broad, Portfolio etc.
Use Cases
Use multiple instances of the script with varying timeframes to study sectoral rotation and trends.
Customise the stocks to see your portfolio returns for the day or over the past week, or longer.
Cryptocurrency SentimentOverview
This script focuses on calculating and visualizing the sentiment difference between LONG positions and SHORT positions for a selected cryptocurrency pair on the Bitfinex exchange. It provides a clean and clear visual representation of the sentiment, helping traders analyze market behavior.
Key Features
Dynamic Symbol Selection:
The script automatically detects the cryptocurrency symbol from the chart (syminfo.basecurrency) and dynamically constructs the LONGS and SHORTS ticker symbols.
Works seamlessly for pairs like BTCUSD, ETHUSD, and others available on Bitfinex.
Sentiment Calculation:
The sentiment difference is calculated as:
Sentiment Difference=−1×(100− SHORTS/LONGS ×100)
LONGS : The total number of long positions.
SHORTS : The total number of short positions.
If SHORTS is 0, the value is safely skipped to avoid division errors.
Color Coding:
The script visually highlights the sentiment difference:
Green Line: Indicates that LONG positions are dominant (bullish sentiment).
Red Line: Indicates that SHORT positions are dominant (bearish sentiment).
Zero Reference Line:
A gray horizontal line at 0 helps users quickly identify the transition between bullish (above zero) and bearish (below zero) sentiment.
How It Works
Fetching Data:
The script uses request.security to fetch LONGS and SHORTS data at the current chart timeframe (timeframe.period) for the dynamically generated Bitfinex tickers.
Handling Data:
Missing or invalid data (NaN) is filtered out to prevent errors.
Extreme spikes or irregular values are safely avoided.
Visualization:
The sentiment difference is plotted with dynamic color coding:
Green when LONGS > SHORTS (bullish sentiment).
Red when SHORTS > LONGS (bearish sentiment).
Benefits
Market Sentiment Insight: Helps traders quickly identify if the market is leaning towards bullish or bearish sentiment based on actual LONG and SHORT position data.
Dynamic and Adaptive: Automatically adjusts to the selected cryptocurrency symbol on the chart.
Clean Visualization: Focuses solely on sentiment difference with color-coded signals, making it easy to interpret.
Best Use Cases
Trend Confirmation: Use the sentiment difference to confirm trends during bullish or bearish moves.
Market Reversals: Identify potential reversals when sentiment shifts from positive (green) to negative (red) or vice versa.
Sentiment Monitoring: Monitor the overall market bias for cryptocurrencies like BTC, ETH, XRP, etc., in real-time.
Sample Chart Output
Above Zero → Green Line: Bullish sentiment dominates.
Below Zero → Red Line: Bearish sentiment dominates.
Zero Line → Transition point for shifts in sentiment.
DAILY Supertrend + EMA Crossover with RSI FilterThis strategy is a technical trading approach that combines multiple indicators—Supertrend, Exponential Moving Averages (EMAs), and the Relative Strength Index (RSI)—to identify and manage trades.
Core Components:
1. Exponential Moving Averages (EMAs):
Two EMAs, one with a shorter period (fast) and one with a longer period (slow), are calculated. The idea is to spot when the faster EMA crosses above or below the slower EMA. A fast EMA crossing above the slow EMA often suggests upward momentum, while crossing below suggests downward momentum.
2. Supertrend Indicator:
The Supertrend uses Average True Range (ATR) to establish dynamic support and resistance lines. These lines shift above or below price depending on the prevailing trend. When price is above the Supertrend line, the trend is considered bullish; when below, it’s considered bearish. This helps ensure that the strategy trades only in the direction of the overall trend rather than against it.
3. RSI Filter:
The RSI measures momentum. It helps avoid buying into markets that are already overbought or selling into markets that are oversold. For example, when going long (buying), the strategy only proceeds if the RSI is not too high, and when going short (selling), it only proceeds if the RSI is not too low. This filter is meant to improve the quality of the trades by reducing the chance of entering right before a reversal.
4. Time Filters:
The strategy only triggers entries during user-specified date and time ranges. This is useful if one wants to limit trading activity to certain trading sessions or periods with higher market liquidity.
5. Risk Management via ATR-based Stops and Targets:
Both stop loss and take profit levels are set as multiples of the ATR. ATR measures volatility, so when volatility is higher, both stops and profit targets adjust to give the trade more breathing room. Conversely, when volatility is low, stops and targets tighten. This dynamic approach helps maintain consistent risk management regardless of market conditions.
Overall Logic Flow:
- First, the market conditions are analyzed through EMAs, Supertrend, and RSI.
- When a buy (long) condition is met—meaning the fast EMA crosses above the slow EMA, the trend is bullish according to Supertrend, and RSI is below the specified “overbought” threshold—the strategy initiates or adds to a long position.
- Similarly, when a sell (short) condition is met—meaning the fast EMA crosses below the slow EMA, the trend is bearish, and RSI is above the specified “oversold” threshold—it initiates or adds to a short position.
- Each position is protected by an automatically calculated stop loss and a take profit level based on ATR multiples.
Intended Result:
By blending trend detection, momentum filtering, and volatility-adjusted risk management, the strategy aims to capture moves in the primary trend direction while avoiding entries at excessively stretched prices. Allowing multiple entries can potentially amplify gains in strong trends but also increases exposure, which traders should consider in their risk management approach.
In essence, this strategy tries to ride established trends as indicated by the Supertrend and EMAs, filter out poor-quality entries using RSI, and dynamically manage trade risk through ATR-based stops and targets.
US 10Y - US 2Y Spread This script displays the Yield Spread between the 10 Year US Treasury Bond (US10Y) and the 2 Year US Treasury Bond (US02Y) as a blue line beneath the chart. It is best to be used on weekly charts a the yield spread is a leading indicator used for detecting possible recessions within the US economy.
A negative yield spread means the 2 year treasury bonds are paying a higher yield than 10 year treasury bonds indicating a possible slowdown of the US economy. In the past negative yield spreads where often followed by recessions and major corrections of the S&P500... you can see examples for this on the above chart for the Gulf War recession, the DotCom Bubble recession, the great recession due to the US housing market collapse and the short COVID recession.
Currently we are in an extended phase of negative yield spreads and if history repeats itself we could be in for a major correction on the financial markets within the next years.
Short Term Imbalance ContinuationShort Term Imbalance Continuation
This indicator identifies short-term trading opportunities based on imbalance situations followed by consolidation.
Functionality:
The indicator looks for a specific candle formation:
1. An imbalance candle where the low is above the high of the following candle (bearish) or the high is below the low of the following candle (bullish)
2. Followed by 1-2 inside candles (close within the range of the previous candle) in the same direction
Theory:
The formation is based on two important market mechanisms:
1. Imbalance and Momentum:
- The imbalance shows a strong move with one-sided orderflow dominance
- Inside candles in the same direction confirm that the opposing side cannot take control
2. Consolidation Behavior:
- Inside candles are a classic consolidation pattern
- They show that the market is "digesting" the previous strong movement
- Consolidation within the range indicates controlled accumulation/distribution
- Particularly relevant when large market participants are building or expanding positions
- Consolidation at higher/lower levels confirms the dominance of the trend direction
Settings:
- Choice between one or two inside candles for different consolidation phases
- Option whether both inside candles must have the same direction
- Customizable colors for bullish and bearish signals
Application:
The indicator is particularly suitable for:
- Trend confirmation after strong movements
- Entry into pullbacks during trends
- Identification of continuation setups after consolidations
- Detection of accumulation/distribution phases of large market participants
Notes:
- Best used in combination with higher timeframe trend
- Particularly meaningful at important price zones
- Consolidation phases can indicate institutional interest
- The length of consolidation (one vs. two inside candles) can indicate different accumulation phases
Long Position with 1:3 Risk Reward and 20EMA CrossoverThe provided Pine Script code implements a strategy to identify long entry signals based on a 20-EMA crossover on a 5-minute timeframe. Once a buy signal is triggered, it calculates and plots the following:
Entry Price: The price at which the buy signal is generated.
Stop Loss: The low of the previous candle, acting as a risk management tool.
Take Profit: The price level calculated based on a 1:3 risk-reward ratio.
Key Points:
Buy Signal: A buy signal is generated when the current 5-minute candle closes above the 20-EMA.
Risk Management: The stop-loss is set below the entry candle to limit potential losses.
Profit Target: The take-profit is calculated based on a 1:3 risk-reward ratio, aiming for a potential profit three times the size of the risk.
Visualization: The script plots the entry price, stop-loss, and take-profit levels on the chart for visual clarity.
Remember:
Backtesting: It's crucial to backtest this strategy on historical data to evaluate its performance and optimize parameters.
Risk Management: Always use appropriate risk management techniques, such as stop-loss orders and position sizing, to protect your capital.
Market Conditions: Market conditions can change, and strategies that worked in the past may not perform as well in the future. Continuously monitor and adapt your strategy.
By understanding the core components of this script and applying sound risk management principles, you can effectively use it to identify potential long entry opportunities in the market.
Wave Surge [UAlgo]The "Wave Surge " is a comprehensive indicator designed to provide advanced wave pattern analysis for market trends and price movements. Built with customizable parameters, it caters to both beginner and advanced traders looking to improve their decision-making process.
This indicator utilizes wave-based calculations, adaptive thresholds, and volume analysis to detect and visualize key market signals. By integrating multiple analysis techniques.
It calculates waves for high, low, and close prices using a configurable moving average (EMA) technique and pairs it with volume and baseline analysis to confirm patterns. The result is a robust framework for identifying potential entry and exit points in the market.
🔶 Key Features
Wave-Based Analysis: This indicator computes waves using exponential moving averages (EMA) of high, low, and close prices, with an adjustable wave period to suit different market conditions.
Customizable Baseline: Traders can select from multiple baseline types, including VWMA (Volume-Weighted Moving Average), EMA, SMA (Simple Moving Average), and HMA (Hull Moving Average), for trend confirmation.
Adaptive Thresholds: The adaptive threshold feature dynamically adjusts sensitivity based on a chosen period, ensuring the indicator remains responsive to varying market volatility.
Volume Analysis: The integrated volume analysis calculates volume ratios and allows traders to enable or disable this feature to refine signal accuracy.
Pattern Recognition: The indicator identifies specific wave patterns (Wave 1, Wave 3, Wave 4, Wave 5, Wave 6) and visually plots them on the chart for easy interpretation.
Visual and Color-Coded Signals: Clear visual signals (upward and downward arrows) are plotted on the chart to highlight potential bullish or bearish patterns. The baseline is color-coded for an intuitive understanding of market trends.
Configuration: Parameters for wave period, baseline length, volume factors, and sensitivity can be tailored to align with the trader’s strategy and market environment.
🔶 Interpreting the Indicator
Wave Patterns
The indicator detects and plots six unique wave patterns based on price changes that exceed an adaptive threshold. These patterns are validated by the direction of the baseline:
Wave 1 (Bullish): Triggered when the price increases above the threshold while the baseline is falling.
Wave 3, 4, and 6 (Bearish): Indicate potential downtrends validated by a rising baseline.
Wave 5 (Bullish): Suggests upward momentum when prices exceed the threshold with a falling baseline.
Baseline Trend
The baseline serves as a trend confirmation tool, dynamically changing color to reflect market direction:
Aqua (Rising): Indicates an upward trend.
Red (Falling): Indicates a downward trend.
Volume Confirmation
When enabled, the volume analysis feature ensures that signals are supported by significant volume movements. Patterns with high volume are considered more reliable.
Signal Visualization
Upward Arrows (🡹): Highlight potential bullish opportunities.
Downward Arrows (🡻): Highlight potential bearish opportunities.
Alerts
Alerts are triggered when key wave patterns are identified, providing traders with timely notifications to take action without being tied to the screen.
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Correlated Imbalance Detector# Correlated Imbalance Detector
This indicator helps traders identify strong market movements while avoiding fakeouts by detecting correlated imbalances across two trading instruments. By requiring confirmation from correlated markets like major indices (ES, NQ) or related forex pairs, it filters out potential false signals.
## What it Does
The indicator analyzes price action patterns known as 'imbalances' on two correlated instruments simultaneously. An imbalance occurs when there's a significant gap between price levels that hasn't been filled, indicating strong buying or selling pressure. By requiring both instruments to show the same pattern, it helps eliminate false breakouts and fakeouts.
### Key Features:
- Detects bullish and bearish imbalances across two correlated instruments
- Filters out fakeouts through correlation confirmation
- Uses candlestick direction for additional validation
- Simple visual signals with customizable colors
### Signals:
- Green square: Bullish imbalance detected on both instruments
- Red square: Bearish imbalance detected on both instruments
## Avoiding Fakeouts
The indicator's core strength lies in its correlation requirement:
- A signal only appears when both instruments show the same pattern
- Reduces false signals that might appear on a single instrument
- Helps validate genuine market moves through correlation
- Particularly effective in filtering out noise in choppy markets
## Index Correlation and Bias
Major indices often show strong correlation in their movements:
- ES (S&P 500 futures) and NQ (Nasdaq futures) typically move together
- When both show the same imbalance pattern, it significantly reduces the chance of a fakeout
- Use this correlation to confirm your market bias and strengthen your trading decisions
## Settings
- Correlated Symbol: Enter the symbol you want to correlate with
- Bearish Color: Customize the color for bearish signals
- Bullish Color: Customize the color for bullish signals
## Usage Tips
1. Particularly effective with correlated indices (ES/NQ)
2. Use to confirm your existing market bias
3. Best used on higher timeframes (H1 and above)
4. Wait for confirmation from both instruments to avoid fakeouts
5. Consider overall market context when interpreting signals
6. Use the absence of correlation as a warning sign for potential fakeouts
Note: This indicator is designed to help filter out false signals through correlation. It works best as part of your broader market analysis and should align with your trading bias and strategy.
Sunil Spinning Top IndicatorThe spinning top is single candlestick pattern can be used as a reversal pattern.
Long Entry ->
If formed near the support go long on the next candle crossing over the high of the spinning top candle.
Stop Loss = Low of the Spinning Top Candle
If formed near the Resistance go short on the next candle crossing under the low of the spinning top candle.
Stop Loss = High of the Spinning Top Candle
Back test and give your feedback.
EMA with VWAPThis indicator combines two popular technical analysis tools: the Exponential Moving Average (EMA) and the Volume Weighted Average Price (VWAP), into a single, powerful overlay on your chart. It allows you to analyze both trend direction using the EMA and institutional interest and fair value using the VWAP, all while saving valuable indicator slots on your TradingView layout.
Key Features:
- Exponential Moving Average (EMA):
- Calculates the EMA based on a user-defined Length and Source (e.g., close, open, hl2).
- Includes an optional Offset to shift the EMA line forward or backward on the chart.
- Offers a Smoothing Line feature, allowing you to further smooth the EMA using various moving average types (SMA, EMA, SMMA (RMA), WMA, VWMA) with a customizable Smoothing Length.
- EMA and Smoothing Line can be toggled on or off.
- EMA and Smoothing Line have independent offset capabilities.
Volume Weighted Average Price (VWAP):
-Calculates the VWAP, a crucial indicator that reflects the average price weighted by volume.
- Offers a wide range of Anchor Periods for resetting the VWAP calculation, including: Session, Week, Month, Quarter, Year, Decade, Century, Earnings, Dividends, and Splits.
- Includes an optional Offset to shift the VWAP line.
- Option to Hide VWAP on 1D or Above timeframes to focus on intraday analysis.
- Provides up to three customizable Standard Deviation Bands above and below the VWAP, visually representing volatility and potential support/resistance levels.
- Bands can be calculated using either "Standard Deviation" or "Percentage" methods.
- Bands can be turned on or off independently.
How to Use:
- EMA: Use the EMA to identify the overall trend direction. An upward-sloping EMA suggests an uptrend, while a downward-sloping EMA suggests a downtrend. The Smoothing Line can help confirm the EMA's trend.
- VWAP: The VWAP acts as a benchmark for the "fair" price of an asset during the selected anchor period. Prices above the VWAP may indicate bullish sentiment, while prices below may indicate bearish sentiment.
- Bands: The Standard Deviation Bands can help identify potential overbought and oversold conditions. Price reaching the upper bands might suggest overbought levels, while price reaching the lower bands might suggest oversold levels.
Customization:
- The indicator offers extensive customization through its settings:
- EMA Settings: Adjust the EMA length, source, offset, smoothing method, and smoothing length.
- VWAP Settings: Choose the VWAP anchor period, source, offset, and whether to hide it on daily or higher timeframes.
- VWAP Bands Settings: Control the visibility, multiplier, and calculation method for each of the three standard deviation bands.
Benefits:
- Consolidated Analysis: Combines two essential indicators into one, providing a comprehensive view of price action and volume.
- Saves Indicator Slots: Frees up valuable indicator slots on your TradingView chart.
- Highly Customizable: Offers a wide range of settings to tailor the indicator to your specific trading style and preferences.
- Visual Clarity: Clearly displays the EMA, VWAP, and optional bands on the chart, facilitating quick and easy analysis.
This combined EMA and VWAP indicator is a valuable tool for traders of all levels, offering a powerful and flexible way to analyze market trends and identify potential trading opportunities.
Double RSIDouble RSI (DRSI) Indicator
The Double RSI (DRSI) is a technical analysis tool designed to provide traders with enhanced buy and sell signals by identifying uptrend and downtrend thresholds. It refines traditional RSI-based signals by applying a "double calculation" to the Relative Strength Index (RSI), improving precision in detecting trend changes.
Key Concepts Behind the Indicator
1. Double RSI Calculation
The DRSI indicator takes the standard RSI (calculated using the closing price over a specified length) and applies a second RSI calculation to it. This creates a smoother, more refined RSI value, making it more effective at highlighting the general trend of the market.
RSI: Measures the strength of recent price movements, ranging from 0 to 100.
Double RSI (DRSI): Applies the RSI formula to the RSI values themselves, smoothing out fluctuations and generating clearer signals.
How Does the Indicator Work?
The DRSI identifies uptrends and downtrends using two user-defined thresholds:
Uptrend Threshold (Default = 59): A value above this threshold signals a potential shift into an uptrend.
Downtrend Threshold (Default = 52): A value below this threshold signals a potential shift into a downtrend.
Signal Generation
Buy Signal: A crossover occurs when the DRSI value crosses above the Downtrend Threshold, signaling the beginning of an upward movement.
Sell Signal: A crossunder occurs when the DRSI value crosses below the Uptrend Threshold, signaling the beginning of a downward movement.
Customizable Inputs
The indicator offers customizable settings for increased flexibility:
DRSI Length (Default = 13): Determines the lookback period for RSI calculations. A shorter length increases sensitivity, while a longer length smooths the signals.
Uptrend Threshold (Default = 59): Sets the level above which an uptrend is confirmed.
Downtrend Threshold (Default = 52): Sets the level below which a downtrend is confirmed.
Bar Color and Glow Effects: Traders can enable colored candles or glowing DRSI lines for better visual representation.
Why is This Indicator Useful for Traders?
1. Noise Reduction
By applying a second RSI calculation, the DRSI smooths out minor fluctuations and highlights the overall trend.
2. Clear Uptrend and Downtrend Signals
The indicator provides intuitive buy (green arrow) and sell (red arrow) markers, simplifying decision-making.
3. Customizable Thresholds
Traders can adjust the thresholds and length to better suit specific trading strategies or market conditions.
4. Bar Coloring
Bars are color-coded to indicate the trend:
Green (Above Uptrend Threshold): Indicates an uptrend.
Red (Below Downtrend Threshold): Indicates a downtrend.
How the Indicator Appears on the Chart
DRSI Line: A smooth line derived from the double RSI calculation.
Threshold Lines: Two horizontal lines (green for the Uptrend Threshold, red for the Downtrend Threshold) to visualize trend changes.
Colored Candles: Candlesticks dynamically change color based on the trend direction (green for uptrends, red for downtrends).
Buy/Sell Markers:
Buy Signal: A green upward triangle below the bar, marking the start of an uptrend.
Sell Signal: A red downward triangle above the bar, marking the start of a downtrend.
In Summary
The Double RSI (DRSI) indicator is a powerful tool for identifying uptrends and downtrends with:
Smoothed trend detection using double-calculated RSI values.
Clear, actionable buy and sell signals.
Customizable settings to match different trading styles.
By focusing on trend thresholds rather than overbought or oversold levels, the DRSI provides traders with precise, noise-free signals to optimize their trading decisions.
Thygoo Countdown TimerThis custom Pine Script indicator displays a real-time countdown timer on your chart, showing the remaining time until the current candle closes based on the active timeframe. The timer is updated dynamically, providing a clear and easy-to-read countdown directly on the chart.
Features:
Real-Time Countdown: The indicator automatically calculates the time remaining for the current candle to close, updating in real-time.
Multiple Timeframes: It works with any active timeframe, including minute-based and multi-minute intervals, such as 3m, 5m, 15m, 1h, etc.
Dynamic Box Position: The countdown is displayed inside a resizable and repositionable box on the chart, placed above the current price action.
Visibility: The box and text are clearly visible, with customizable font sizes for better readability.
No Extra Clutter: The countdown text appears without any unnecessary border lines, keeping the display clean and unobtrusive.
How to Use:
Add this indicator to your chart to monitor the countdown of the current timeframe.
The timer will update automatically, showing the time left (minutes:seconds) until the next bar closes.
Adjust the chart's zoom level to ensure the timer box remains clearly visible in the right-hand section of your chart.
Ideal for:
Traders who want a quick and efficient way to track the time remaining on their current chart timeframe.
Anyone looking to add a countdown timer to their TradingView chart without the clutter of additional indicators.
RSI Divergence - Left Candles Onlyrsi
The **RSI Divergence** indicator in this script is designed to highlight **divergence** between the **Relative Strength Index (RSI)** and **price action** on a chart. Divergence can be a key signal for potential trend reversals or continuation in technical analysis.
### **Key Components of the Indicator:**
1. **RSI Calculation:**
- The **Relative Strength Index (RSI)** is calculated using a typical 14-period length, but the user can customize this input.
- RSI is a momentum oscillator that measures the speed and change of price movements, oscillating between 0 and 100. Values above 70 indicate overbought conditions, and values below 30 indicate oversold conditions.
2. **Divergence Logic:**
- **Bullish Divergence:** Occurs when the price forms a **lower low**, but the RSI forms a **higher low**. This suggests that despite price continuing to drop, momentum (RSI) is strengthening, which may indicate a potential price reversal to the upside.
- **Bearish Divergence:** Occurs when the price forms a **higher high**, but the RSI forms a **lower high**. This indicates that even though price is rising, the momentum (RSI) is weakening, which could signal a price reversal to the downside.
3. **Pivot Identification:**
- The script identifies **pivot points** (local highs and lows) on both price and RSI.
- **Bullish Divergence:** A lower price low with a higher RSI low.
- **Bearish Divergence:** A higher price high with a lower RSI high.
4. **Lookback Periods:**
- **Lookback Left (lookbackLeft):** Defines the number of bars to look back for pivot confirmation. This allows for adjusting the sensitivity of the divergence.
- The **divergence range** is constrained by two parameters:
- **Minimum range (rangeLower):** The minimum number of bars for divergence to be considered.
- **Maximum range (rangeUpper):** The maximum number of bars for divergence to be considered.
5. **Signal Generation and Plotting:**
- When a **bullish divergence** is detected, a **green label** is plotted below the bar where the divergence occurs.
- When a **bearish divergence** is detected, a **red label** is plotted above the bar.
- The script uses **`plotshape()`** to plot these labels on the chart.
6. **Alerts:**
- Alerts are configured for both **bullish** and **bearish divergences** so that you can be notified when a divergence signal occurs.
---
### **How the Indicator Works:**
- The RSI and price action are compared using **pivots**: The script checks whether the price and RSI are forming new highs or lows within the specified **lookback period**.
- If the conditions for divergence (higher/lower RSI pivot vs price pivot) are met, a signal is plotted on the chart.
- The script helps to visually identify potential reversal points and allows users to set alerts for these divergence signals.
---
### **Use Case:**
- This script is useful for traders looking to trade potential trend reversals based on **divergence** between price and RSI.
- **Bullish divergence** can indicate a **buy** opportunity, while **bearish divergence** can suggest a **sell** opportunity.
- The indicator works best in **volatile markets** and when combined with other technical analysis tools for confirmatio
20/50 SMA Cross 200 SMAThis Pine Script code is designed to identify and visualize crossovers of two shorter-term Simple Moving Averages (SMAs), a 20-period SMA and a 50-period SMA, with a longer-term 200-period SMA on a price chart. It also includes alerts for these crossover events. Here's a breakdown:
**Purpose:**
The core idea behind this script is to detect potential trend changes. Crossovers of shorter-term moving averages over a longer-term moving average are often interpreted as bullish signals, while crossovers below are considered bearish.
**Key Components:**
1. **Moving Average Calculation:**
* `sma20 = ta.sma(close, 20)`: Calculates the 20-period SMA of the closing price.
* `sma50 = ta.sma(close, 50)`: Calculates the 50-period SMA of the closing price.
* `sma200 = ta.sma(close, 200)`: Calculates the 200-period SMA of the closing price.
2. **Crossover Detection:**
* `crossUp20 = ta.crossover(sma20, sma200)`: Returns `true` when the 20-period SMA crosses above the 200-period SMA.
* `crossDown20 = ta.crossunder(sma20, sma200)`: Returns `true` when the 20-period SMA crosses below the 200-period SMA.
* Similar logic applies for `crossUp50` and `crossDown50` with the 50-period SMA.
3. **Recent Crossover Tracking (Crucial Improvement):**
* `lookback = 7`: Defines a lookback period of 7 bars.
* `var bool hasCrossedUp20 = false`, etc.: Declares `var` (persistent) boolean variables to track if a crossover has occurred *within* the last 7 bars. This is the most important correction from previous versions.
* The logic using `ta.barssince()` is the key:
* If a crossover happens (`crossUp20` is true), the corresponding `hasCrossedUp20` is set to `true`.
* If no crossover happens on the current bar, it checks if a crossover happened within the last 7 bars using `ta.barssince(crossUp20) <= lookback`. If so, it keeps `hasCrossedUp20` as `true`. After 7 bars, it becomes `false`.
4. **Plotting Crossovers:**
* `plotshape(...)`: Plots circles on the chart to visually mark the crossovers.
* Green circles below the bars for bullish crossovers (20 and 50).
* Red circles above the bars for bearish crossovers (20 and 50).
* Different shades of green/red (green/lime, red/maroon) distinguish between 20 and 50 SMA crossovers.
5. **Plotting Moving Averages (Optional but Helpful):**
* `plot(sma20, color=color.blue, linewidth=1)`: Plots the 20-period SMA in blue.
* Similar logic for the 50-period SMA (orange) and 200-period SMA (gray).
6. **Alerts:**
* `alertcondition(...)`: Triggers alerts when crossovers occur. This is essential for real-time trading signals.
**How it Works (in Simple Terms):**
The script continuously calculates the 20, 50, and 200 SMAs. It then monitors for instances where the 20 or 50 SMA crosses the 200 SMA. When such a crossover happens, a colored circle is plotted on the chart, and an alert is triggered. The key improvement is that it remembers if a crossover occurred in the last 7 bars and continues to display the circle during that period.
**Use Case:**
Traders use this type of indicator to identify potential entry and exit points in the market. A bullish crossover (shorter SMA crossing above the longer SMA) might be a signal to buy, while a bearish crossover might be a signal to sell.
**Key Improvements over Previous Versions:**
* **Correct Lookback Implementation:** The use of `ta.barssince()` and `var` variables is the correct and efficient way to check for crossovers within a lookback period. This fixes the major flaw in earlier versions.
* **Clear Visualizations:** The use of `plotshape` with distinct colors makes it easy to distinguish between 20 and 50 SMA crossovers.
* **Alerts:** The inclusion of alerts makes the script much more practical for real-time trading.
This improved version provides a robust and useful tool for identifying and tracking SMA crossovers.
FIR Low Pass Filter Suite (FIR)The FIR Low Pass Filter Suite is an advanced signal processing indicator that applies finite impulse response (FIR) filtering techniques to price data. At its core, the indicator uses windowed-sinc filtering, which provides optimal frequency response characteristics for separating trend from noise in financial data.
The indicator offers multiple window functions including Kaiser, Kaiser-Bessel Derived (KBD), Hann, Hamming, Blackman, Triangular, and Lanczos. Each window type provides different trade-offs between main-lobe width and side-lobe attenuation, allowing users to fine-tune the frequency response characteristics of the filter. The Kaiser and KBD windows provide additional control through an alpha parameter that adjusts the shape of the window function.
A key feature is the ability to operate in either linear or logarithmic space. Logarithmic filtering can be particularly appropriate for financial data due to the multiplicative nature of price movements. The indicator includes an envelope system that can adaptively calculate bands around the filtered price using either arithmetic or geometric deviation, with separate controls for upper and lower bands to account for the asymmetric nature of market movements.
The implementation handles edge effects through proper initialization and offers both centered and forward-only filtering modes. Centered mode provides zero phase distortion but introduces lag, while forward-only mode operates causally with no lag but introduces some phase distortion. All calculations are performed using vectorized operations for efficiency, with carefully designed state management to handle the filter's warm-up period.
Visual feedback is provided through customizable color gradients that can reflect the current trend direction, with optional glow effects and background fills to enhance visibility. The indicator maintains high numerical precision throughout its calculations while providing smooth, artifact-free output suitable for both analysis and visualization.
True Amplitude Envelopes (TAE)The True Envelopes indicator is an adaptation of the True Amplitude Envelope (TAE) method, based on the research paper " Improved Estimation of the Amplitude Envelope of Time Domain Signals Using True Envelope Cepstral Smoothing " by Caetano and Rodet. This indicator aims to create an asymmetric price envelope with strong predictive power, closely following the methodology outlined in the paper.
Due to the inherent limitations of Pine Script, the indicator utilizes a Kernel Density Estimator (KDE) in place of the original Cepstral Smoothing technique described in the paper. While this approach was chosen out of necessity rather than superiority, the resulting method is designed to be as effective as possible within the constraints of the Pine environment.
This indicator is ideal for traders seeking an advanced tool to analyze price dynamics, offering insights into potential price movements while working within the practical constraints of Pine Script. Whether used in dynamic mode or with a static setting, the True Envelopes indicator helps in identifying key support and resistance levels, making it a valuable asset in any trading strategy.
Key Features:
Dynamic Mode: The indicator dynamically estimates the fundamental frequency of the price, optimizing the envelope generation process in real-time to capture critical price movements.
High-Pass Filtering: Uses a high-pass filtered signal to identify and smoothly interpolate price peaks, ensuring that the envelope accurately reflects significant price changes.
Kernel Density Estimation: Although implemented as a workaround, the KDE technique allows for flexible and adaptive smoothing of the envelope, aimed at achieving results comparable to the more sophisticated methods described in the original research.
Symmetric and Asymmetric Envelopes: Provides options to select between symmetric and asymmetric envelopes, accommodating various trading strategies and market conditions.
Smoothness Control: Features adjustable smoothness settings, enabling users to balance between responsiveness and the overall smoothness of the envelopes.
The True Envelopes indicator comes with a variety of input settings that allow traders to customize the behavior of the envelopes to match their specific trading needs and market conditions. Understanding each of these settings is crucial for optimizing the indicator's performance.
Main Settings
Source: This is the data series on which the indicator is applied, typically the closing price (close). You can select other price data like open, high, low, or a custom series to base the envelope calculations.
History: This setting determines how much historical data the indicator should consider when calculating the envelopes. A value of 0 will make the indicator process all available data, while a higher value restricts it to the most recent n bars. This can be useful for reducing the computational load or focusing the analysis on recent market behavior.
Iterations: This parameter controls the number of iterations used in the envelope generation algorithm. More iterations will typically result in a smoother envelope, but can also increase computation time. The optimal number of iterations depends on the desired balance between smoothness and responsiveness.
Kernel Style: The smoothing kernel used in the Kernel Density Estimator (KDE). Available options include Sinc, Gaussian, Epanechnikov, Logistic, and Triangular. Each kernel has different properties, affecting how the smoothing is applied. For example, Gaussian provides a smooth, bell-shaped curve, while Epanechnikov is more efficient computationally with a parabolic shape.
Envelope Style: This setting determines whether the envelope should be Static or Dynamic. The Static mode applies a fixed period for the envelope, while the Dynamic mode automatically adjusts the period based on the fundamental frequency of the price data. Dynamic mode is typically more responsive to changing market conditions.
High Q: This option controls the quality factor (Q) of the high-pass filter. Enabling this will increase the Q factor, leading to a sharper cutoff and more precise isolation of high-frequency components, which can help in better identifying significant price peaks.
Symmetric: This setting allows you to choose between symmetric and asymmetric envelopes. Symmetric envelopes maintain an equal distance from the central price line on both sides, while asymmetric envelopes can adjust differently above and below the price line, which might better capture market conditions where upside and downside volatility are not equal.
Smooth Envelopes: When enabled, this setting applies additional smoothing to the envelopes. While this can reduce noise and make the envelopes more visually appealing, it may also decrease their responsiveness to sudden market changes.
Dynamic Settings
Extra Detrend: This setting toggles an additional high-pass filter that can be applied when using a long filter period. The purpose is to further detrend the data, ensuring that the envelope focuses solely on the most recent price oscillations.
Filter Period Multiplier: This multiplier adjusts the period of the high-pass filter dynamically based on the detected fundamental frequency. Increasing this multiplier will lengthen the period, making the filter less sensitive to short-term price fluctuations.
Filter Period (Min) and Filter Period (Max): These settings define the minimum and maximum bounds for the high-pass filter period. They ensure that the filter period stays within a reasonable range, preventing it from becoming too short (and overly sensitive) or too long (and too sluggish).
Envelope Period Multiplier: Similar to the filter period multiplier, this adjusts the period for the envelope generation. It scales the period dynamically to match the detected price cycles, allowing for more precise envelope adjustments.
Envelope Period (Min) and Envelope Period (Max): These settings establish the minimum and maximum bounds for the envelope period, ensuring the envelopes remain adaptive without becoming too reactive or too slow.
Static Settings
Filter Period: In static mode, this setting determines the fixed period for the high-pass filter. A shorter period will make the filter more responsive to price changes, while a longer period will smooth out more of the price data.
Envelope Period: This setting specifies the fixed period used for generating the envelopes in static mode. It directly influences how tightly or loosely the envelopes follow the price action.
TAE Smoothing: This controls the degree of smoothing applied during the TAE process in static mode. Higher smoothing values result in more gradual envelope curves, which can be useful in reducing noise but may also delay the envelope’s response to rapid price movements.
Visual Settings
Top Band Color: This setting allows you to choose the color for the upper band of the envelope. This band represents the resistance level in the price action.
Bottom Band Color: Similar to the top band color, this setting controls the color of the lower band, which represents the support level.
Center Line Color: This is the color of the central price line, often referred to as the carrier. It represents the detrended price around which the envelopes are constructed.
Line Width: This determines the thickness of the plotted lines for the top band, bottom band, and center line. Thicker lines can make the envelopes more visible, especially when overlaid on price data.
Fill Alpha: This controls the transparency level of the shaded area between the top and bottom bands. A lower alpha value will make the fill more transparent, while a higher value will make it more opaque, helping to highlight the envelope more clearly.
The envelopes generated by the True Envelopes indicator are designed to provide a more precise and responsive representation of price action compared to traditional methods like Bollinger Bands or Keltner Channels. The core idea behind this indicator is to create a price envelope that smoothly interpolates the significant peaks in price action, offering a more accurate depiction of support and resistance levels.
One of the critical aspects of this approach is the use of a high-pass filtered signal to identify these peaks. The high-pass filter serves as an effective method of detrending the price data, isolating the rapid fluctuations in price that are often lost in standard trend-following indicators. By filtering out the lower frequency components (i.e., the trend), the high-pass filter reveals the underlying oscillations in the price, which correspond to significant peaks and troughs. These oscillations are crucial for accurately constructing the envelope, as they represent the most responsive elements of the price movement.
The algorithm works by first applying the high-pass filter to the source price data, effectively detrending the series and isolating the high-frequency price changes. This filtered signal is then used to estimate the fundamental frequency of the price movement, which is essential for dynamically adjusting the envelope to current market conditions. By focusing on the peaks identified in the high-pass filtered signal, the algorithm generates an envelope that is both smooth and adaptive, closely following the most significant price changes without overfitting to transient noise.
Compared to traditional envelopes and bands, such as Bollinger Bands and Keltner Channels, the True Envelopes indicator offers several advantages. Bollinger Bands, which are based on standard deviations, and Keltner Channels, which use the average true range (ATR), both tend to react to price volatility but do not necessarily follow the peaks and troughs of the price with precision. As a result, these traditional methods can sometimes lag behind or fail to capture sudden shifts in price momentum, leading to either false signals or missed opportunities.
In contrast, the True Envelopes indicator, by using a high-pass filtered signal and a dynamic period estimation, adapts more quickly to changes in price behavior. The envelopes generated by this method are less prone to the lag that often affects standard deviation or ATR-based bands, and they provide a more accurate representation of the price's immediate oscillations. This can result in better predictive power and more reliable identification of support and resistance levels, making the True Envelopes indicator a valuable tool for traders looking for a more responsive and precise approach to market analysis.
In conclusion, the True Envelopes indicator is a powerful tool that blends advanced theoretical concepts with practical implementation, offering traders a precise and responsive way to analyze price dynamics. By adapting the True Amplitude Envelope (TAE) method through the use of a Kernel Density Estimator (KDE) and high-pass filtering, this indicator effectively captures the most significant price movements, providing a more accurate depiction of support and resistance levels compared to traditional methods like Bollinger Bands and Keltner Channels. The flexible settings allow for extensive customization, ensuring the indicator can be tailored to suit various trading strategies and market conditions.
3_SMA_Strategy_V-Singhal by ParthibIndicator Name: 3_SMA_Strategy_V-Singhal by Parthib
Description:
The 3_SMA_Strategy_V-Singhal by Parthib is a dynamic trend-following strategy that combines three key simple moving averages (SMA) — SMA 20, SMA 50, and SMA 200 — to generate buy and sell signals. This strategy uses these SMAs to capture and follow market trends, helping traders identify optimal entry (buy) and exit (sell) points. Additionally, the strategy highlights the closing price (CP), which plays a critical role in confirming buy and sell signals.
The strategy also features a Second Buy Signal triggered if the price falls more than 10% after an initial buy signal, providing a re-entry opportunity with a different visual highlight for the second buy signal.
Features:
Three Simple Moving Averages (SMA):
SMA 20: Short-term moving average reflecting immediate market trends.
SMA 50: Medium-term moving average showing the prevailing trend.
SMA 200: Long-term moving average that indicates the overall market trend.
Buy Signal (B1):
Triggered when:
SMA 200 > SMA 50 > SMA 20, indicating a bullish market structure.
The closing price is positioned below all three SMAs, confirming a potential upward reversal.
A green label appears at the low of the bar with the text B1-Price, indicating the price at which the buy signal is generated.
Second Buy Signal (B2):
Triggered if the price falls more than 10% after the first buy signal, providing an opportunity to re-enter the market at a potentially better price.
A blue label appears at the low of the bar with the text B2-Price, showing the price at which the second buy opportunity arises.
Sell Signal (S):
Triggered when:
SMA 20 > SMA 50 > SMA 200, indicating a bearish trend.
The closing price (CP) is positioned above all three SMAs, confirming a potential downward movement.
A red label appears at the high of the bar with the text S-Price, showing the price at which the sell signal is triggered.
How It Works:
Buy Conditions:
SMA 200 > SMA 50 > SMA 20: Indicates a bullish market where the long-term trend (SMA 200) is above the medium-term (SMA 50), and the medium-term trend is above the short-term (SMA 20).
Closing price below all three SMAs: Confirms that the price is in a favorable position for a potential upward reversal.
Sell Conditions:
SMA 20 > SMA 50 > SMA 200: This setup indicates a bearish trend.
Closing price above all three SMAs: Confirms that the price is in a favorable position for a potential downward movement.
Second Buy Signal (B2): If the price falls more than 10% after the first buy signal, the strategy triggers a second buy opportunity (B2) at a potentially better price. This helps traders take advantage of pullbacks or corrections after an initial favorable entry.
Labeling System:
B1-Price: The first buy signal label, appearing when the market is bullish and the closing price is below all three SMAs.
B2-Price: The second buy signal label, triggered if the price falls more than 10% after the initial buy signal.
S-Price: The sell signal label, appearing when the market turns bearish and the closing price is above all three SMAs.
How to Use:
Add the Indicator: Add "3_SMA_Strategy_V-Singhal by Parthib" to your chart on TradingView.
Interpret Buy Signals (B1): Look for green labels with the text "B1-Price" when the closing price (CP) is below all three SMAs and the trend is bullish.
Interpret Second Buy Signals (B2): If the price falls more than 10% after the first buy, look for blue labels with "B2-Price" and a re-entry opportunity.
Interpret Sell Signals (S): Look for red labels with the text "S-Price" when the market turns bearish, and the closing price (CP) is above all three SMAs.
Conclusion:
The 3_SMA_Strategy_V-Singhal by Parthib is an efficient and simple trend-following tool for traders looking to make informed buy and sell decisions. By combining the power of three SMAs and the closing price (CP) confirmation, this strategy helps traders to buy when the market shows a strong bullish setup and sell when the trend turns bearish. Additionally, the second buy signal feature ensures that traders don’t miss out on re-entry opportunities after price corrections, giving them a chance to re-enter the market at a favorable price.