BRT Cluster VolumeTitle and Purpose
BRT Cluster Volume is a powerful market analysis tool designed to identify key support and resistance levels, cluster volumes, and breakout signals. This script is highly beneficial for traders who aim to gain deeper insights into market trends and pinpoint zones of interest for buyers and sellers.
Key Features
1. Support and Resistance Levels:
- The script automatically detects chart extremums by analyzing a specified number of bars on the left and right to form levels. This approach effectively identifies local highs and lows.
- The uniqueness of this implementation lies in its dynamic data processing. For each extremum, the "channel width" is calculated, allowing insignificant levels to be filtered out based on a user-defined minimum width. This method eliminates noise and ensures focus on critical levels.
- Extremum lines can be extended to the right (when enabled), allowing traders to track current price movements relative to historical levels.
2. Cluster Volume:
- The cluster analysis is based on lower timeframe data, providing precise identification of key zones of market participant activity. The script dynamically requests close prices and volumes from lower timeframes, calculates the average volume, and identifies levels where volumes exceed a defined threshold.
- The visualization of cluster volumes is unique: volumes exceeding the threshold are displayed as candles with customizable colors and markers. These indicators help traders identify zones of significant interest.
- Cluster volume is only displayed when it interacts with support or resistance levels, ensuring that the visualization remains precise and relevant for market analysis.
3. Breakout Signals:
- The script evaluates "breakout strength" for each breakout of support or resistance levels by comparing the current price with the level. This helps filter false breakouts and focus on significant price movements.
- Traders can select the source for breakout signals (close price or high/low), offering flexibility for various trading styles and strategies.
- By incorporating the concept of "maximum breakout strength," the script highlights only meaningful breakouts, ignoring minor fluctuations.
4. Integration of Trading Sessions:
- Extremum levels for major trading sessions (Asia, Europe, USA) are identified and labeled on the chart. This allows traders to see when significant price levels were formed during the day.
- The script uses timestamps to automatically detect session times, ensuring accuracy and minimizing manual adjustments.
5. Dynamic Data Updates:
- The script dynamically updates support and resistance levels in real time as new data becomes available. This feature is crucial for traders working in fast-moving markets.
- Outdated information (such as obsolete levels) is automatically removed to keep the chart clean and focused on relevant data.
6. Visualization of Activity Zones:
- Trend direction is visualized using color-coded candles based on cluster volumes. For instance, candles with volumes exceeding the average are highlighted with specific colors, helping traders quickly identify areas of heightened activity.
- The unique aspect of this visualization is that cluster volumes appear only in zones where they interact with breakout levels, providing an intuitive and streamlined presentation of critical data.
Usage
- Support and Resistance: Adjust the "Left Bars" and "Right Bars" settings to determine extremums. Use the "Channel Min Width" setting to filter out insignificant levels.
- Cluster Volume: Customize the analysis period and volume threshold to identify high-activity zones. Enable breakout clusters to see how volumes interact with breakouts.
- Session Extremums: Highlight significant levels for Asia, Europe, and US trading sessions to gain insights into market dynamics across different time zones.
- Breakout Signals: Configure the breakout strength and source (close or high/low) for precise signal detection.
Parameter Details
1. Support & Resistance:
- `Left Bars` / `Right Bars`: Number of bars to consider for determining extremums.
- `# of Lines`: Maximum number of support/resistance lines to display.
- `Channel Min Width`: Minimum channel width to filter insignificant levels.
2. Breakout:
- `Show Breakouts`: Toggle breakout signal display.
- `Max breakout strength`: Maximum strength for valid breakouts.
- `Breakout source`: Data source for breakouts (close or high/low).
3. Cluster Volume:
- `Lookback`: Number of bars to analyze for cluster volumes.
- `Threshold`: Volume threshold (percentage above the average).
- `Cluster Volume Timeframe`: Timeframe for cluster volume analysis.
- `Breakout Cluster`: Display cluster volumes only for breakout-related zones.
4. Visual Settings:
- `Extend extremum lines to the right`: Extend support/resistance lines to the right.
- `Show ASIA/EU/US Session Extremums`: Display extremums for trading sessions.
Features and Benefits
- The script provides flexible parameter customization, allowing it to adapt to different trading styles and timeframes.
- The visualization is designed to be clean and intuitive, ensuring users can easily interpret the data.
- Suitable for all timeframes, making it ideal for both intraday and long-term market analysis.
Limitations
- The script is not suitable for analysis on non-standard chart types (e.g., Heikin Ashi, Renko, Kagi).
- To ensure accurate performance, realistic data for commission and slippage should be used.
Warnings
- The script relies on historical data for calculations, which may cause discrepancies in real-time conditions.
- Users should fully understand the functionality of cluster analysis and breakout signals before using the script in live trading.
This script combines advanced data processing logic, dynamic level adjustments, and unique visualization approaches, making it an indispensable tool for market analysis and trading decision-making.
インジケーターとストラテジー
4-Year Cycles [jpkxyz]Overview of the Script
I wanted to write a script that encompasses the wide-spread macro fund manager investment thesis: "Crypto is simply and expression of macro." A thesis pioneered by the likes of Raoul Pal (EXPAAM) , Andreesen Horowitz (A16Z) , Joe McCann (ASYMETRIC) , Bob Loukas and many more.
Cycle Theory Background:
The 2007-2008 financial crisis transformed central bank monetary policy by introducing:
- Quantitative Easing (QE): Creating money to buy assets and inject liquidity
- Coordinated global monetary interventions
Proactive 4-year economic cycles characterised by:
- Expansionary periods (low rates, money creation)
- Followed by contraction/normalisation
Central banks now deliberately manipulate liquidity, interest rates, and asset prices to control economic cycles, using monetary policy as a precision tool rather than a blunt instrument.
Cycle Characteristics (based on historical cycles):
- A cycle has 4 seasons (Spring, Summer, Fall, Winter)
- Each season with a cycle lasts 365 days
- The Cycle Low happens towards the beginning of the Spring Season of each new cycle
- This is followed by a run up throughout the Spring and Summer Season
- The Cycle High happens towards the end of the Fall Season
- The Winter season is characterised by price corrections until establishing a new floor in the Spring of the next cycle
Key Functionalities
1. Cycle Tracking
- Divides market history into 4-year cycles (Spring, Summer, Fall, Winter)
- Starts tracking cycles from 2011 (first cycle after the 2007 crisis cycle)
- Identifies and marks cycle boundaries
2. Visualization
- Colors background based on current cycle season
- Draws lines connecting:
- Cycle highs and lows
- Inter-cycle price movements
- Adds labels showing:
- Percentage gains/losses between cycles
- Number of days between significant points
3. Customization Options
- Allows users to customize:
- Colors for each season
- Line and label colors
- Label size
- Background opacity
Detailed Mechanism
Cycle Identification
- Uses a modulo calculation to determine the current season in the 4-year cycle
- Preset boundary years include 2015, 2019, 2023, 2027
- Automatically tracks and marks cycle transitions
Price Analysis
- Tracks highest and lowest prices within each cycle
- Calculates percentage changes:
- Intra-cycle (low to high)
- Inter-cycle (previous high to current high/low)
Visualization Techniques
- Background color changes based on current cycle season
- Dashed and solid lines connect significant price points
- Labels provide quantitative insights about price movements
Unique Aspects
1. Predictive Cycle Framework: Provides a structured way to view market movements beyond traditional technical analysis
2. Seasonal Color Coding: Intuitive visual representation of market cycle stages
3. Comprehensive Price Tracking: Captures both intra-cycle and inter-cycle price dynamics
4. Highly Customizable: Users can adjust visual parameters to suit their preferences
Potential Use Cases
- Technical analysis for long-term investors
- Identifying market cycle patterns
- Understanding historical price movement rhythms
- Educational tool for market cycle theory
Limitations/Considerations
- Based on a predefined 4-year cycle model (Liquidity Cycles)
- Historic Cycle Structures are not an indication for future performance
- May not perfectly represent all market behavior
- Requires visual interpretation
This script is particularly interesting for investors who believe in cyclical market theories and want a visual, data-driven representation of market stages.
High Volume BarsThis indicator highlights the highest volume bullish and bearish bars within a specified lookback period. It provides a visual representation of significant volume activity, which can be useful for identifying potential trend reversals or continuations.
Key Features:
Customizable lookback period to find highest volume bars
Lime-colored bars for bullish (up) volume
Fuchsia-colored bars for bearish (down) volume
Filled areas between high and low of highest volume bars
Easy-to-read visual cues for volume analysis
The indicator scans the specified number of previous bars to identify the highest volume bullish and bearish bars. It then colors these bars and draws filled areas to make them stand out on the chart. This can help traders quickly spot areas of significant buying or selling pressure.
Use this indicator to:
Identify potential support and resistance levels
Spot volume-based trend reversals
Confirm breakouts or breakdowns
Enhance your volume analysis in conjunction with price action
Adjust the lookback period to fine-tune the indicator's sensitivity to recent volume activity. A longer lookback period will identify more significant volume events, while a shorter period will be more responsive to recent changes.
Note: This indicator is best used in combination with other technical analysis tools and should not be relied upon solely for making trading decisions.
CandleCandle: A Comprehensive Pine Script™ Library for Candlestick Analysis
Overview
The Candle library, developed in Pine Script™, provides traders and developers with a robust toolkit for analyzing candlestick data. By offering easy access to fundamental candlestick components like open, high, low, and close prices, along with advanced derived metrics such as body-to-wick ratios, percentage calculations, and volatility analysis, this library enables detailed insights into market behavior.
This library is ideal for creating custom indicators, trading strategies, and backtesting frameworks, making it a powerful resource for any Pine Script™ developer.
Key Features
1. Core Candlestick Data
• Open : Access the opening price of the current candle.
• High : Retrieve the highest price.
• Low : Retrieve the lowest price.
• Close : Access the closing price.
2. Candle Metrics
• Full Size : Calculates the total range of the candle (high - low).
• Body Size : Computes the size of the candle’s body (open - close).
• Wick Size : Provides the combined size of the upper and lower wicks.
3. Wick and Body Ratios
• Upper Wick Size and Lower Wick Size .
• Body-to-Wick Ratio and Wick-to-Body Ratio .
4. Percentage Calculations
• Upper Wick Percentage : The proportion of the upper wick size relative to the full candle size.
• Lower Wick Percentage : The proportion of the lower wick size relative to the full candle size.
• Body Percentage and Wick Percentage relative to the candle’s range.
5. Candle Direction Analysis
• Determines if a candle is "Bullish" or "Bearish" based on its closing and opening prices.
6. Price Metrics
• Average Price : The mean of the open, high, low, and close prices.
• Midpoint Price : The midpoint between the high and low prices.
7. Volatility Measurement
• Calculates the standard deviation of the OHLC prices, providing a volatility metric for the current candle.
Code Architecture
Example Functionality
The library employs a modular structure, exporting various functions that can be used independently or in combination. For instance:
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © DevArjun
//@version=6
indicator("Candle Data", overlay = true)
import DevArjun/Candle/1 as Candle
// Body Size %
bodySize = Candle.BodySize()
// Determining the candle direction
candleDirection = Candle.CandleDirection()
// Calculating the volatility of the current candle
volatility = Candle.Volatility()
// Plotting the metrics (for demonstration)
plot(bodySize, title="Body Size", color=color.blue)
label.new(bar_index, high, candleDirection, style=label.style_circle)
Scalability
The modularity of the Candle library allows seamless integration into more extensive trading systems. Functions can be mixed and matched to suit specific analytical or strategic needs.
Use Cases
Trading Strategies
Developers can use the library to create strategies based on candle properties such as:
• Identifying long-bodied candles (momentum signals).
• Detecting wicks as potential reversal zones.
• Filtering trades based on candle ratios.
Visualization
Plotting components like body size, wick size, and directional labels helps visualize market behavior and identify patterns.
Backtesting
By incorporating volatility and ratio metrics, traders can design and test strategies on historical data, ensuring robust performance before live trading.
Education
This library is a great tool for teaching candlestick analysis and how each component contributes to market behavior.
Portfolio Highlights
Project Objective
To create a Pine Script™ library that simplifies candlestick analysis by providing comprehensive metrics and insights, empowering traders and developers with advanced tools for market analysis.
Development Challenges and Solutions
• Challenge : Achieving high precision in calculating ratios and percentages.
• Solution : Implemented robust mathematical operations and safeguarded against division-by-zero errors.
• Challenge : Ensuring modularity and scalability.
• Solution : Designed functions as independent modules, allowing flexible integration.
Impact
• Efficiency : The library reduces the time required to calculate complex candlestick metrics.
• Versatility : Supports various trading styles, from scalping to swing trading.
• Clarity : Clean code and detailed documentation ensure usability for developers of all levels.
Conclusion
The Candle library exemplifies the power of Pine Script™ in simplifying and enhancing candlestick analysis. By including this project in your portfolio, you showcase your expertise in:
• Financial data analysis.
• Pine Script™ development.
• Creating tools that solve real-world trading challenges.
This project demonstrates both technical proficiency and a keen understanding of market analysis, making it an excellent addition to your professional portfolio.
Library "Candle"
A comprehensive library to access and analyze the basic components of a candlestick, including open, high, low, close prices, and various derived metrics such as full size, body size, wick sizes, ratios, percentages, and additional analysis metrics.
Open()
Open
@description Returns the opening price of the current candle.
Returns: float - The opening price of the current candle.
High()
High
@description Returns the highest price of the current candle.
Returns: float - The highest price of the current candle.
Low()
Low
@description Returns the lowest price of the current candle.
Returns: float - The lowest price of the current candle.
Close()
Close
@description Returns the closing price of the current candle.
Returns: float - The closing price of the current candle.
FullSize()
FullSize
@description Returns the full size (range) of the current candle (high - low).
Returns: float - The full size of the current candle.
BodySize()
BodySize
@description Returns the body size of the current candle (open - close).
Returns: float - The body size of the current candle.
WickSize()
WickSize
@description Returns the size of the wicks of the current candle (full size - body size).
Returns: float - The size of the wicks of the current candle.
UpperWickSize()
UpperWickSize
@description Returns the size of the upper wick of the current candle.
Returns: float - The size of the upper wick of the current candle.
LowerWickSize()
LowerWickSize
@description Returns the size of the lower wick of the current candle.
Returns: float - The size of the lower wick of the current candle.
BodyToWickRatio()
BodyToWickRatio
@description Returns the ratio of the body size to the wick size of the current candle.
Returns: float - The body to wick ratio of the current candle.
UpperWickPercentage()
UpperWickPercentage
@description Returns the percentage of the upper wick size relative to the full size of the current candle.
Returns: float - The percentage of the upper wick size relative to the full size of the current candle.
LowerWickPercentage()
LowerWickPercentage
@description Returns the percentage of the lower wick size relative to the full size of the current candle.
Returns: float - The percentage of the lower wick size relative to the full size of the current candle.
WickToBodyRatio()
WickToBodyRatio
@description Returns the ratio of the wick size to the body size of the current candle.
Returns: float - The wick to body ratio of the current candle.
BodyPercentage()
BodyPercentage
@description Returns the percentage of the body size relative to the full size of the current candle.
Returns: float - The percentage of the body size relative to the full size of the current candle.
WickPercentage()
WickPercentage
@description Returns the percentage of the wick size relative to the full size of the current candle.
Returns: float - The percentage of the wick size relative to the full size of the current candle.
CandleDirection()
CandleDirection
@description Returns the direction of the current candle.
Returns: string - "Bullish" if the candle is bullish, "Bearish" if the candle is bearish.
AveragePrice()
AveragePrice
@description Returns the average price of the current candle (mean of open, high, low, and close).
Returns: float - The average price of the current candle.
MidpointPrice()
MidpointPrice
@description Returns the midpoint price of the current candle (mean of high and low).
Returns: float - The midpoint price of the current candle.
Volatility()
Volatility
@description Returns the standard deviation of the OHLC prices of the current candle.
Returns: float - The volatility of the current candle.
Earnings Gap UpsBased on research conducted by John Pocorobba and Jason Thompson, the Earnings Gap Ups Indicator is designed to identify three types of earnings gaps, key levels, and the "alpha window"—a period when stocks often outperform following a gap. These gaps are frequently observed in high-performing stocks.
What is an Earnings Gap?
An earnings gap occurs when a stock's price makes a significant jump, after the company reports earnings signifying the street (institutions) were caught off guard.
The three different types of gaps are as follows: [/b
PEG (Power Earnings Gap)
Price gain of 10% or more
Volume is greater than 200% above the 50-day average
EPS surprise of at least 20%
Monster Gap
Price gain of 20% or more
Volume is greater than 300% above the 50-day average
No fundamental requirement
Monster Peg
Price Gain of 20% or more
Volume is greater than 300% above the 50-day average
EPS surprise of at least 20%
Key Levels and the Alpha Window
In addition to spotting these gaps, the indicator marks key levels on the chart and extends them through the alpha window, which represents the time period when the stock tends to outperform after the gap.
Key levels include:
High volume close: The closing price on a day with unusually high trading volume
High volume close minus 5%: A potential support level below the high volume close
Gap day high: The highest price reached on the gap day
Gap day low: The lowest price reached on the gap day
By understanding and tracking these gaps and levels, traders can map out a playbook for trading earnings gaps.
Median Deviation Suite [InvestorUnknown]The Median Deviation Suite uses a median-based baseline derived from a Double Exponential Moving Average (DEMA) and layers multiple deviation measures around it. By comparing price to these deviation-based ranges, it attempts to identify trends and potential turning points in the market. The indicator also incorporates several deviation types—Average Absolute Deviation (AAD), Median Absolute Deviation (MAD), Standard Deviation (STDEV), and Average True Range (ATR)—allowing traders to visualize different forms of volatility and dispersion. Users should calibrate the settings to suit their specific trading approach, as the default values are not optimized.
Core Components
Median of a DEMA:
The foundation of the indicator is a Median applied to the 7-day DEMA (Double Exponential Moving Average). DEMA aims to reduce lag compared to simple or exponential moving averages. By then taking a median over median_len periods of the DEMA values, the indicator creates a robust and stable central tendency line.
float dema = ta.dema(src, 7)
float median = ta.median(dema, median_len)
Multiple Deviation Measures:
Around this median, the indicator calculates several measures of dispersion:
ATR (Average True Range): A popular volatility measure.
STDEV (Standard Deviation): Measures the spread of price data from its mean.
MAD (Median Absolute Deviation): A robust measure of variability less influenced by outliers.
AAD (Average Absolute Deviation): Similar to MAD, but uses the mean absolute deviation instead of median.
Average of Deviations (avg_dev): The average of the above four measures (ATR, STDEV, MAD, AAD), providing a combined sense of volatility.
Each measure is multiplied by a user-defined multiplier (dev_mul) to scale the width of the bands.
aad = f_aad(src, dev_len, median) * dev_mul
mad = f_mad(src, dev_len, median) * dev_mul
stdev = ta.stdev(src, dev_len) * dev_mul
atr = ta.atr(dev_len) * dev_mul
avg_dev = math.avg(aad, mad, stdev, atr)
Deviation-Based Bands:
The indicator creates multiple upper and lower lines based on each deviation type. For example, using MAD:
float mad_p = median + mad // already multiplied by dev_mul
float mad_m = median - mad
Similar calculations are done for AAD, STDEV, ATR, and the average of these deviations. The indicator then determines the overall upper and lower boundaries by combining these lines:
float upper = f_max4(aad_p, mad_p, stdev_p, atr_p)
float lower = f_min4(aad_m, mad_m, stdev_m, atr_m)
float upper2 = f_min4(aad_p, mad_p, stdev_p, atr_p)
float lower2 = f_max4(aad_m, mad_m, stdev_m, atr_m)
This creates a layered structure of volatility envelopes. Traders can observe which layers price interacts with to gauge trend strength.
Determining Trend
The indicator generates trend signals by assessing where price stands relative to these deviation-based lines. It assigns a trend score by summing individual signals from each deviation measure. For instance, if price crosses above the MAD-based upper line, it contributes a bullish point; crossing below an ATR-based lower line contributes a bearish point.
When the aggregated trend score crosses above zero, it suggests a shift towards a bullish environment; crossing below zero indicates a bearish bias.
// Define Trend scores
var int aad_t = 0
if ta.crossover(src, aad_p)
aad_t := 1
if ta.crossunder(src, aad_m)
aad_t := -1
var int mad_t = 0
if ta.crossover(src, mad_p)
mad_t := 1
if ta.crossunder(src, mad_m)
mad_t := -1
var int stdev_t = 0
if ta.crossover(src, stdev_p)
stdev_t := 1
if ta.crossunder(src, stdev_m)
stdev_t := -1
var int atr_t = 0
if ta.crossover(src, atr_p)
atr_t := 1
if ta.crossunder(src, atr_m)
atr_t := -1
var int adev_t = 0
if ta.crossover(src, adev_p)
adev_t := 1
if ta.crossunder(src, adev_m)
adev_t := -1
int upper_t = src > upper ? 3 : 0
int lower_t = src < lower ? 0 : -3
int upper2_t = src > upper2 ? 1 : 0
int lower2_t = src < lower2 ? 0 : -1
float trend = aad_t + mad_t + stdev_t + atr_t + adev_t + upper_t + lower_t + upper2_t + lower2_t
var float sig = 0
if ta.crossover(trend, 0)
sig := 1
else if ta.crossunder(trend, 0)
sig := -1
Practical Usage and Calibration
Default settings are not optimized: The given parameters serve as a starting point for demonstration. Users should adjust:
median_len: Affects how smooth and lagging the median of the DEMA is.
dev_len and dev_mul: Influence the sensitivity of the deviation measures. Larger multipliers widen the bands, potentially reducing false signals but introducing more lag. Smaller multipliers tighten the bands, producing quicker signals but potentially more whipsaws.
This flexibility allows the trader to tailor the indicator for various markets (stocks, forex, crypto) and time frames.
Backtesting and Performance Metrics
The code integrates with a backtesting library that allows traders to:
Evaluate the strategy historically
Compare the indicator’s signals with a simple buy-and-hold approach
Generate performance metrics (e.g., mean returns, Sharpe Ratio, Sortino Ratio) to assess historical effectiveness.
Disclaimer
No guaranteed results: Historical performance does not guarantee future outcomes. Market conditions can vary widely.
User responsibility: Traders should combine this indicator with other forms of analysis, appropriate risk management, and careful calibration of parameters.
ToolsFluentLibrary "ToolsFluent"
Fluent data holder object with retrieval and modification functions
set(fluent, key, value)
Returns Fluent object after setting related fluent value
Parameters:
fluent (Fluent) : Fluent Fluent object
key (string) : string|int Key to be set
value (int) : int|float|bool|string|color Value to be set
Returns: Fluent
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (string)
value (float)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (string)
value (bool)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (string)
value (string)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (string)
value (color)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (int)
value (int)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (int)
value (float)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (int)
value (bool)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (int)
value (string)
set(fluent, key, value)
Parameters:
fluent (Fluent)
key (int)
value (color)
get(fluent, key, default)
Returns Fluent object key's value or default value when key not found
Parameters:
fluent (Fluent) : Fluent object
key (string)
default (int) : int|float|bool|string|color Value to be returned when key not exists
Returns: int|float|bool|string|color
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (string)
default (float)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (string)
default (bool)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (string)
default (string)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (string)
default (color)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (int)
default (int)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (int)
default (float)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (int)
default (bool)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (int)
default (string)
get(fluent, key, default)
Parameters:
fluent (Fluent)
key (int)
default (color)
Fluent
Fluent - General purpose data holder object
Fields:
msi (map) : map String key, integer value info holder map. Default: na
msf (map) : map String key, float value info holder map. Default: na
msb (map) : map String key, boolean value info holder map. Default: na
mss (map) : map String key, string value info holder map. Default: na
msc (map) : map String key, color value info holder map. Default: na
mii (map) : map Integer key, integer value info holder map. Default: na
mif (map) : map Integer key, float value info holder map. Default: na
mib (map) : map Integer key, boolean value info holder map. Default: na
mis (map) : map Integer key, string value info holder map. Default: na
mic (map) : map Integer key, color value info holder map. Default: na
Weekly Covered Calls Strategy with IV & Delta LogicWhat Does the Indicator Do?
this is interactive you must use it with your options chain to input data based on the contract you want to trade.
Visualize three strike price levels for covered calls based on:
Aggressive (closest to price, riskier).
Moderate (mid-range, balanced).
Low Delta (farthest, safer).
Incorporate Implied Volatility (IV) from the options chain to make strike predictions more realistic and aligned with market sentiment. Adjust the risk tolerance by modifying Delta inputs and IV values. Risk is defined for example .30 delta means 30% chance of your shares being assigned. If you want to generate steady income with your shares you might want to lower the risk of them being assigned to .05 or 5% etc.
How to Use the Indicator with the Options Chain
Start with the Options Chain:
Look for the following data points from your options chain:
Implied Volatility (IV Mid): Average IV for a particular strike price.
Delta:
~0.30 Delta: Closest strike (Aggressive).
~0.15–0.20 Delta: Mid-range strike (Moderate).
~0.05–0.10 Delta: Far OTM, safer (Low Delta).
Strike Price: Identify strike prices for the desired Deltas.
Open Interest: Check liquidity; higher OI ensures tighter spreads.
Input IV into the Indicator:
Enter the IV Mid value (e.g., 0.70 for 70%) from the options chain into the Implied Volatility field of the indicator.
Adjust Delta Inputs Based on Risk Tolerance:
Aggressive Delta: Increase if you want strikes closer to the current price (riskier, higher premium).
Default: 0.2 (20% chance of shares being assigned).
Moderate Delta: Balanced risk/reward.
Default: 0.12 (12%)
Low Delta: Decrease for safer, farther OTM strikes.
Default: 0.05 (5%)
Visualize the Chart:
Once inputs are updated:
Red Line: Aggressive Strike (closest, riskiest, higher premium).
Blue Line: Moderate Strike (mid-range).
Green Line: Low Delta Strike (farthest, safer).
Step-by-Step Workflow Example
Open the options chain and note:
Implied Volatility (IV Mid): Example 71.5% → input as 0.715.
Delta for desired strikes:
Aggressive: 0.30 Delta → Closest strike ~ $455.
Moderate: 0.15 Delta → Mid-range strike ~ $470.
Low Delta: 0.05 Delta → Farther strike ~ $505.
Open the indicator and adjust:
IV Mid: Enter 0.715.
Aggressive Delta: Leave at 0.12 (or adjust to bring strikes closer).
Moderate Delta: Leave at 0.18.
Low Delta: Adjust to 0.25 for safer, farther strikes.
View the chart:
Compare the indicator's strikes (red, blue, green) with actual options chain strikes.
Use the visualization to: Validate the risk/reward for each strike.
Align strikes with technical trends, support/resistance.
Adjusting Inputs Based on Risk Tolerance
Higher Risk: Increase Aggressive Delta (e.g., 0.15) for closer strikes.
Use higher IV values for volatile stocks.
Moderate Risk: Use default values (0.12–0.18 Delta).
Balance premiums and probability.
Lower Risk: Increase Low Delta (e.g., 0.30) for farther, safer strikes.
Focus on higher IV stocks with good open interest.
Key Benefits
Simplifies Strike Selection: Visualizes the three risk levels directly on the chart.
Aligns with Market Sentiment: Incorporates IV for realistic forecasts.
Customizable for Risk: Adjust inputs to match personal risk tolerance.
By combining the options chain (IV, Delta, and liquidity) with the technical chart, you get a powerful, visually intuitive tool for covered call strategies.
Market Structure V3Indicator Description:
The Market Structure indicator is a unique and innovative tool for identifying and visualizing key market structures based on dynamic swing highs and lows. This indicator stands apart from similar tools by utilizing a distinct methodology for updating levels and identifying trends, ensuring precision and flexibility in market analysis.
Key Features of Uniqueness:
1. No Fixed Lookback Periods for Extremum Detection:
- Unlike most indicators that rely on a predefined number of candles (lookback period) to determine highs or lows, this script dynamically updates levels based solely on price action.
- A new high (resistance) or low (support) is confirmed only when the closing price breaks above the previous high or below the previous low, representing the last significant extremums .
- This approach eliminates arbitrary lookback-based restrictions, allowing the indicator to adapt seamlessly to different market conditions and timeframes.
2. Dynamic Level Adjustments:
- Levels are recalculated and adjusted in real time as new price action unfolds, providing traders with highly accurate and relevant support and resistance levels.
- The upper and lower bounds serve as dynamic anchors for trend analysis, updating only when a confirmed breakout occurs.
3. Fractal and Trend-Driven Logic:
- The script inherently respects the fractal nature of price movements by focusing on confirmed breakouts of previous significant extremums , avoiding reliance on shorter-term noise.
- This makes the indicator particularly effective for identifying true trend reversals and continuations.
4. Visual Clarity and Structure Mapping:
- The indicator labels the following structural points directly on the chart:
- **Higher Highs (HH)** for uptrend confirmation.
- **Lower Highs (LH)** for potential trend weakening.
- **Lower Lows (LL)** for downtrend confirmation.
- **Higher Lows (HL)** for potential trend reversals.
- Levels and labels are updated dynamically and accurately reflect the market's structural evolution.
5. Clean and Noise-Free Analysis:
- The absence of arbitrary inputs (e.g., lookback periods) ensures the indicator focuses only on meaningful price action, reducing false signals.
- Works seamlessly across all instruments and timeframes without requiring constant parameter adjustments.
6. Highly Adaptable:
- Suitable for any financial market, including stocks, forex, and cryptocurrencies.
- Performs equally well on all timeframes, from intraday to long-term analysis.
How the Indicator Works:
1. Dynamic Level Updates :
- The indicator evaluates price action in real time and identifies significant levels based on breakouts above previous highs or below previous lows.
- Upper Bound (Resistance) : Updated only when the closing price exceeds the previous significant high.
- Lower Bound (Support) : Updated only when the closing price falls below the previous significant low.
2. Trend Determination:
- Identifies and marks structural points (HH, LH, LL, HL) as trends develop.
- Swing points are updated dynamically without relying on fixed lookback parameters, ensuring that levels reflect the true market structure.
3. Confirmation Logic:
- The script uses a user-configurable parameter `Extremum confirmation bars count` to refine the process of confirming significant swing points.
- This ensures flexibility in adapting to different market conditions while maintaining precision in level detection.
Unique Advantages Over Similar Indicators:
1. No Arbitrary Inputs:
- Unlike other indicators that require users to set the number of candles for extremum detection, this script eliminates the need for such settings, relying solely on actual price breakouts.
2. Dynamic Real-Time Adjustments:
- The logic of level updates is event-driven (based on closing prices crossing key levels), making it more reactive and precise compared to static lookback-based calculations.
3. Enhanced Structural Clarity:
- Focuses exclusively on confirmed significant levels , avoiding clutter and ambiguity often seen in lookback-based indicators.
4. Fractal and Self-Adaptive Nature:
- The script inherently respects market fractality, making it effective across all timeframes and market conditions.
Practical Applications:
- Trend Identification:
Helps identify whether the market is in an uptrend, downtrend, or consolidation phase.
- Entry and Exit Points:
Use swing highs and lows as references for entering or exiting positions.
- Support and Resistance Levels:
Dynamic levels provide actionable areas for placing stop-losses and take-profits.
Input Parameters:
- Extremum Confirmation Bars Count:
Adjusts the sensitivity of extremum detection. The higher the value, the more conservative the indicator becomes in confirming levels. Default is `3`.
Chart Setup and Usage Notes:
1. Clean Visualization:
- Ensure a clean chart for better visibility of structural points and levels.
- Do not overlay with additional indicators unless explicitly required.
2. User Guidance:
- Combine this indicator with volume analysis or other confirmation tools to enhance decision-making.
Disclaimer:
This indicator is for educational purposes only and does not constitute financial advice. Always perform your own analysis and trade responsibly.
Momentum Matrix (BTC-COIN)The Momentum Matrix (BTC-COIN) indicator analyzes the momentum relationship between Coinbase stock ( NASDAQ:COIN ) and Bitcoin ( CRYPTOCAP:BTC ). By combining RSI, correlation, and dominance metrics, it identifies bullish and bearish macro trends to align trades with market momentum.
How It Works
Price Inputs: Pulls weekly price data for CRYPTOCAP:BTC and NASDAQ:COIN for macro analysis.
Metrics Calculated:
• RSI Divergence: Measures momentum differences between CRYPTOCAP:BTC and $COIN.
• Price Ratio: Tracks the $COIN/ CRYPTOCAP:BTC relationship relative to its long-term average (SMA).
• Correlation: Analyzes price co-movement between CRYPTOCAP:BTC and $COIN.
• Dominance Impact: Incorporates CRYPTOCAP:BTC dominance for broader crypto trends.
Composite Momentum Score: Combines these metrics into a smoothed macro momentum value.
Thresholds for Trend Detection: Upper and lower thresholds dynamically adapt to market conditions.
Signals and Visualization:
• Buy Signal: Momentum exceeds the upper threshold, indicating bullish trends.
• Sell Signal: Momentum falls below the lower threshold, indicating bearish trends.
• Background Colors: Green (bullish), Red (bearish).
Strengths
Integrates multiple metrics for robust macro analysis.
Dynamic thresholds adapt to market conditions.
Effective for identifying macro momentum shifts.
Limitations
Lag in high volatility due to smoothing.
Less effective in choppy, sideways markets.
Assumes CRYPTOCAP:BTC dominance drives NASDAQ:COIN momentum, which may not always hold true.
Improvements
Multi-Timeframe Analysis: Add daily or monthly data for precision.
Volume Filters: Include volume thresholds for signal validation.
Additional Metrics: Consider MACD or Stochastics for further confirmation.
Complementary Tools
Volume Indicators: OBV or cumulative delta for confirmation.
Trend-Following Systems: Pair with moving averages for timing.
Market Breadth Metrics: Combine with CRYPTOCAP:BTC dominance trends for context.
COIN/BTC Trend OscillatorThe COIN/BTC Trend Oscillator is a versatile tool designed to measure and visualize momentum divergences between Coinbase stock ( NASDAQ:COIN ) and Bitcoin ( CRYPTOCAP:BTC ). It helps identify overbought and oversold conditions, while also highlighting potential trend reversals.
Key Features:
VWAP-Based Divergence Analysis:
• Tracks the difference between NASDAQ:COIN and CRYPTOCAP:BTC relative to their respective VWAPs.
• Highlights shifts in momentum between the two assets.
Normalized Oscillator:
• Uses ATR normalization to adapt to different volatility conditions.
• Displays momentum shifts on a standardized scale for better comparability.
Overbought and Oversold Conditions:
• Identifies extremes using customizable thresholds (default: ±80).
• Dynamic background colors for quick visual identification:
• Blue for overbought zones (potential sell).
• White for oversold zones (potential buy).
Rolling Highs and Lows Detection:
• Tracks turning points in the oscillator to identify possible trend reversals.
• Useful for spotting exhaustion or accumulation phases.
Use Case:
This indicator is ideal for trading Coinbase stock relative to Bitcoin’s momentum. It’s especially useful during strong market trends, helping traders time entries and exits based on extremes in relative performance.
Limitations:
• Performance may degrade in choppy or sideways markets.
• Assumes a strong correlation between NASDAQ:COIN and CRYPTOCAP:BTC , which may not hold during independent events.
Pro Tip: Use this oscillator with broader trend confirmation tools like moving averages or RSI to improve reliability. For macro strategies, consider combining with higher timeframes for alignment.
R-based Strategy Template [Daveatt]Have you ever wondered how to properly track your trading performance based on risk rather than just profits?
This template solves that problem by implementing R-multiple tracking directly in TradingView's strategy tester.
This script is a tool that you must update with your own trading entry logic.
Quick notes
Before we dive in, I want to be clear: this is a template focused on R-multiple calculation and visualization.
I'm using a basic RSI strategy with dummy values just to demonstrate how the R tracking works. The actual trading signals aren't important here - you should replace them with your own strategy logic.
R multiple logic
Let's talk about what R-multiple means in practice.
Think of R as your initial risk per trade.
For instance, if you have a $10,000 account and you're risking 1% per trade, your 1R would be $100.
A trade that makes twice your risk would be +2R ($200), while hitting your stop loss would be -1R (-$100).
This way of measuring makes it much easier to evaluate your strategy's performance regardless of account size.
Whenever the SL is hit, we lose -1R
Proof showing the strategy tester whenever the SL is hit: i.imgur.com
The magic happens in how we calculate position sizes.
The script automatically determines the right position size to risk exactly your specified percentage on each trade.
This is done through a simple but powerful calculation:
risk_amount = (strategy.equity * (risk_per_trade_percent / 100))
sl_distance = math.abs(entry_price - sl_price)
position_size = risk_amount / (sl_distance * syminfo.pointvalue)
Limitations with lower timeframe gaps
This ensures that if your stop loss gets hit, you'll lose exactly the amount you intended to risk. No more, no less.
Well, could be more or less actually ... let's assume you're trading futures on a 15-minute chart but in the 1-minute chart there is a gap ... then your 15 minute SL won't get filled and you'll likely to not lose exactly -1R
This is annoying but it can't be fixed - and that's how trading works anyway.
Features
The template gives you flexibility in how you set your stop losses. You can use fixed points, ATR-based stops, percentage-based stops, or even tick-based stops.
Regardless of which method you choose, the position sizing will automatically adjust to maintain your desired risk per trade.
To help you track performance, I've added a comprehensive statistics table in the top right corner of your chart.
It shows you everything you need to know about your strategy's performance in terms of R-multiples: how many R you've won or lost, your win rate, average R per trade, and even your longest winning and losing streaks.
Happy trading!
And remember, measuring your performance in R-multiples is one of the most classical ways to evaluate and improve your trading strategies.
Daveatt
Spread Analysis (COIN/BTC)The Spread Analysis (COIN/BTC) indicator calculates the Z-score of the price ratio between Coinbase stock ( NASDAQ:COIN ) and Bitcoin ( CRYPTOCAP:BTC ). It helps identify overbought or oversold conditions based on deviations from the historical mean of their price relationship.
Key Features:
Z-Score Calculation:
• Tracks the relative price ratio of NASDAQ:COIN to $BTC.
• Compares the current ratio to its historical average, highlighting extreme overvaluation or undervaluation.
• Buy and Sell Signals:
• Buy Signal: Triggered when the Z-score is less than -2, indicating NASDAQ:COIN may be undervalued relative to $BTC.
• Sell Signal: Triggered when the Z-score exceeds 2, suggesting NASDAQ:COIN may be overvalued relative to $BTC.
• Dynamic Z-Score Visualization:
• Blue line plots the Z-score over time.
• Dashed lines at +2 and -2 mark overbought and oversold thresholds.
• Green and red triangles highlight actionable buy and sell signals.
Use Case:
This indicator is ideal for identifying relative valuation opportunities between NASDAQ:COIN and $BTC. Use it to exploit divergences in their historical relationship and anticipate potential reversions to the mean.
Limitations:
• Best suited for range-bound markets; may produce false signals in strongly trending conditions.
• Assumes a consistent correlation between NASDAQ:COIN and CRYPTOCAP:BTC , which may break during independent price drivers like news or earnings.
ToolsPosLibrary "ToolsPos"
Library for general purpose position helpers
new_pos(state, price, when, index)
Returns new PosInfo object
Parameters:
state (series PosState) : Position state
price (float) : float Entry price
when (int) : int Entry bar time UNIX. Default: time
index (int) : int Entry bar index. Default: bar_index
Returns: PosInfo
new_tp(pos, price, when, index, info)
Returns PosInfo object with new take profit info object
Parameters:
pos (PosInfo) : PosInfo object
price (float) : float Entry price
when (int) : int Entry bar time UNIX. Default: time
index (int) : int Entry bar index. Default: bar_index
info (Info type from aybarsm/Tools/14) : Info holder object. Default: na
Returns: PosInfo
new_re(pos, price, when, index, info)
Returns PosInfo object with new re-entry info object
Parameters:
pos (PosInfo) : PosInfo object
price (float) : float Entry price
when (int) : int Entry bar time UNIX. Default: time
index (int) : int Entry bar index. Default: bar_index
info (Info type from aybarsm/Tools/14) : Info holder object. Default: na
Returns: PosInfo
PosTPInfo
PosTPInfo - Position Take Profit info object
Fields:
price (series float) : float Take profit price
when (series int) : int Take profit bar time UNIX. Default: time
index (series int) : int Take profit bar index. Default: bar_index
info (Info type from aybarsm/Tools/14) : Info holder object
PosREInfo
PosREInfo - Position Re-Entry info object
Fields:
price (series float) : float Re-entry price
when (series int) : int Re-entry bar time UNIX. Default: time
index (series int) : int Take profit bar index. Default: bar_index
info (Info type from aybarsm/Tools/14) : Info holder object
PosInfo
PosInfo - Position info object
Fields:
state (series PosState) : Position state
price (series float) : float Entry price
when (series int) : int Entry bar time UNIX. Default: time
index (series int) : int Entry bar index. Default: bar_index
tp (array) : PosTPInfo Take profit info. Default: na
re (array) : PosREInfo Re-entry info. Default: na
info (Info type from aybarsm/Tools/14) : Info holder object
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.