Percentile Momentum IndicatorInput Parameters:
lengthPercentile: Defines the period used to calculate the percentile values (default: 30).
lengthMomentum: Defines the period for calculating the Rate of Change (ROC) momentum (default: 10).
Core Logic:
Rate of Change (ROC): The script calculates the ROC of the closing price over the specified period (lengthMomentum).
Percentile Calculations: The script calculates two key percentiles:
percentile_upper (80th percentile of the high prices)
percentile_lower (20th percentile of the low prices)
Percentile Average: An average of the upper and lower percentiles is calculated (avg_percentile).
Trade Signals:
Buy Signal: Triggered when the ROC is positive, the close is above the percentile_lower, and the close is above the avg_percentile.
Sell Signal: Triggered when the ROC is negative, the close is below the percentile_upper, and the close is below the avg_percentile.
Trade State Management:
The script uses a binary state: 1 for long (buy) and -1 for short (sell).
The trade state is updated based on buy or sell signals.
Bar Coloring:
Bars are colored dynamically based on the trade state:
Green for long (buy signal).
Red for short (sell signal).
The same color is applied to the percentile and average percentile lines for visual consistency.
指标和策略
Exposure Oscillator (Cumulative 0 to ±100%)
Exposure Oscillator (Cumulative 0 to ±100%)
This Pine Script indicator plots an "Exposure Oscillator" on the chart, which tracks the cumulative market exposure from a range of technical buy and sell signals. The exposure is measured on a scale from -100% (maximum short exposure) to +100% (maximum long exposure), helping traders assess the strength of their position in the market. It provides an intuitive visual cue to aid decision-making for trend-following strategies.
Buy Signals (Increase Exposure Score by +10%)
Buy Signal 1 (Cross Above 21 EMA):
This signal is triggered when the price crosses above the 21-period Exponential Moving Average (EMA), where the current bar closes above the EMA21, and the previous bar closed below the EMA21. This indicates a potential upward price movement as the market shifts into a bullish trend.
buySignal1 = ta.crossover(close, ema21)
Buy Signal 2 (Trending Above 21 EMA):
This signal is triggered when the price closes above the 21-period EMA for each of the last 5 bars, indicating a sustained bullish trend. It confirms that the price is consistently above the EMA21 for a significant period.
buySignal2 = ta.barssince(close <= ema21) > 5
Buy Signal 3 (Living Above 21 EMA):
This signal is triggered when the price has closed above the 21-period EMA for each of the last 15 bars, demonstrating a strong, prolonged uptrend.
buySignal3 = ta.barssince(close <= ema21) > 15
Buy Signal 4 (Cross Above 50 SMA):
This signal is triggered when the price crosses above the 50-period Simple Moving Average (SMA), where the current bar closes above the 50 SMA, and the previous bar closed below it. It indicates a shift toward bullish momentum.
buySignal4 = ta.crossover(close, sma50)
Buy Signal 5 (Cross Above 200 SMA):
This signal is triggered when the price crosses above the 200-period Simple Moving Average (SMA), where the current bar closes above the 200 SMA, and the previous bar closed below it. This suggests a long-term bullish trend.
buySignal5 = ta.crossover(close, sma200)
Buy Signal 6 (Low Above 50 SMA):
This signal is true when the lowest price of the current bar is above the 50-period SMA, indicating strong bullish pressure as the price maintains itself above the moving average.
buySignal6 = low > sma50
Buy Signal 7 (Accumulation Day):
An accumulation day occurs when the closing price is in the upper half of the daily range (greater than 50%) and the volume is larger than the previous bar's volume, suggesting buying pressure and accumulation.
buySignal7 = (close - low) / (high - low) > 0.5 and volume > volume
Buy Signal 8 (Higher High):
This signal occurs when the current bar’s high exceeds the highest high of the previous 14 bars, indicating a breakout or strong upward momentum.
buySignal8 = high > ta.highest(high, 14)
Buy Signal 9 (Key Reversal Bar):
This signal is generated when the stock opens below the low of the previous bar but rallies to close above the previous bar’s high, signaling a potential reversal from bearish to bullish.
buySignal9 = open < low and close > high
Buy Signal 10 (Distribution Day Fall Off):
This signal is triggered when a distribution day (a day with high volume and a close near the low of the range) "falls off" the rolling 25-bar period, indicating the end of a bearish trend or selling pressure.
buySignal10 = ta.barssince(close < sma50 and close < sma50) > 25
Sell Signals (Decrease Exposure Score by -10%)
Sell Signal 1 (Cross Below 21 EMA):
This signal is triggered when the price crosses below the 21-period Exponential Moving Average (EMA), where the current bar closes below the EMA21, and the previous bar closed above it. It suggests that the market may be shifting from a bullish trend to a bearish trend.
sellSignal1 = ta.crossunder(close, ema21)
Sell Signal 2 (Trending Below 21 EMA):
This signal is triggered when the price closes below the 21-period EMA for each of the last 5 bars, indicating a sustained bearish trend.
sellSignal2 = ta.barssince(close >= ema21) > 5
Sell Signal 3 (Living Below 21 EMA):
This signal is triggered when the price has closed below the 21-period EMA for each of the last 15 bars, suggesting a strong downtrend.
sellSignal3 = ta.barssince(close >= ema21) > 15
Sell Signal 4 (Cross Below 50 SMA):
This signal is triggered when the price crosses below the 50-period Simple Moving Average (SMA), where the current bar closes below the 50 SMA, and the previous bar closed above it. It indicates the start of a bearish trend.
sellSignal4 = ta.crossunder(close, sma50)
Sell Signal 5 (Cross Below 200 SMA):
This signal is triggered when the price crosses below the 200-period Simple Moving Average (SMA), where the current bar closes below the 200 SMA, and the previous bar closed above it. It indicates a long-term bearish trend.
sellSignal5 = ta.crossunder(close, sma200)
Sell Signal 6 (High Below 50 SMA):
This signal is true when the highest price of the current bar is below the 50-period SMA, indicating weak bullishness or a potential bearish reversal.
sellSignal6 = high < sma50
Sell Signal 7 (Distribution Day):
A distribution day is identified when the closing range of a bar is less than 50% and the volume is larger than the previous bar's volume, suggesting that selling pressure is increasing.
sellSignal7 = (close - low) / (high - low) < 0.5 and volume > volume
Sell Signal 8 (Lower Low):
This signal occurs when the current bar's low is less than the lowest low of the previous 14 bars, indicating a breakdown or strong downward momentum.
sellSignal8 = low < ta.lowest(low, 14)
Sell Signal 9 (Downside Reversal Bar):
A downside reversal bar occurs when the stock opens above the previous bar's high but falls to close below the previous bar’s low, signaling a reversal from bullish to bearish.
sellSignal9 = open > high and close < low
Sell Signal 10 (Distribution Cluster):
This signal is triggered when a distribution day occurs three times in the rolling 7-bar period, indicating significant selling pressure.
sellSignal10 = ta.valuewhen((close < low) and volume > volume , 1, 7) >= 3
Theme Mode:
Users can select the theme mode (Auto, Dark, or Light) to match the chart's background or to manually choose a light or dark theme for the oscillator's appearance.
Exposure Score Calculation: The script calculates a cumulative exposure score based on a series of buy and sell signals.
Buy signals increase the exposure score, while sell signals decrease it. Each signal impacts the score by ±10%.
Signal Conditions: The buy and sell signals are derived from multiple conditions, including crossovers with moving averages (EMA21, SMA50, SMA200), trend behavior, and price/volume analysis.
Oscillator Visualization: The exposure score is visualized as a line on the chart, changing color based on whether the exposure is positive (long position) or negative (short position). It is limited to the range of -100% to +100%.
Position Type: The indicator also indicates the position type based on the exposure score, labeling it as "Long," "Short," or "Neutral."
Horizontal Lines: Reference lines at 0%, 100%, and -100% visually mark neutral, increasing long, and increasing short exposure levels.
Exposure Table: A table displays the current exposure level (in percentage) and position type ("Long," "Short," or "Neutral"), updated dynamically based on the oscillator’s value.
Inputs:
Theme Mode: Choose "Auto" to use the default chart theme, or manually select "Dark" or "Light."
Usage:
This oscillator is designed to help traders track market sentiment, gauge exposure levels, and manage risk. It can be used for long-term trend-following strategies or short-term trades based on moving average crossovers and volume analysis.
The oscillator operates in conjunction with the chart’s price action and provides a visual representation of the market’s current trend strength and exposure.
Important Considerations:
Risk Management: While the exposure score provides valuable insight, it should be combined with other risk management tools and analysis for optimal trading decisions.
Signal Sensitivity: The accuracy and effectiveness of the signals depend on market conditions and may require adjustments based on the user’s trading strategy or timeframe.
Disclaimer:
This script is for educational purposes only. Trading involves significant risk, and users should carefully evaluate all market conditions and apply appropriate risk management strategies before using this tool in live trading environments.
Old Price OscillatorThe Old Price Oscillator (OPO) is a momentum indicator widely used by traders and analysts to gauge the direction and strength of price trends. It works by calculating the difference between two moving averages—a shorter-term moving average and a longer-term moving average—of a security’s price. This difference is plotted as an oscillating line, helping traders visualize the momentum and determine when price reversals or continuations might occur. Typically, when the oscillator value is positive, the price is trending upwards, suggesting potential buy signals; conversely, when the oscillator turns negative, it indicates downward momentum, which could signal a potential sell.
The OPO is similar to other oscillators, like the Moving Average Convergence Divergence (MACD), in that it uses moving averages to smooth out price fluctuations and clarify trends. Traders often customize the length of the short- and long-term moving averages to better suit specific assets or market conditions. Generally, this indicator is especially useful in markets that exhibit clear trends. However, it may generate false signals during sideways or highly volatile periods, so many traders combine the OPO with other technical indicators or filters to improve accuracy.
Z Value AlertZ Value Alert analyzes daily price movements by evaluating fluctuations relative to historical volatility. It calculates the daily percentage change in the closing price, the average of this change over 252 days, and the standard deviation. Using these values, a Z-Score is calculated, indicating how much the current price change deviates from the historical range of fluctuations.
The user can set a threshold in standard deviations (Z-Score). When the absolute Z-Score exceeds this threshold, a significant movement is detected, indicating increased volatility. The Z-Score is visualized as a histogram, and an alert can be triggered when a significant movement occurs.
The number of trading days used to calculate historical volatility is adjustable, allowing the Sigma Move Alert to be tailored to various trading strategies and analysis periods.
Additionally, a dropdown option for the calculation method is available in the input menu, allowing the user to select between:
Normal: Calculates the percentage change in closing prices without using the logarithm.
Logarithmic: Uses the natural logarithm of daily returns. This method is particularly suitable for longer timeframes and scientific analyses, as logarithmic returns are additive.
These comprehensive features allow for precise customization of the Sigma Move Alert to individual needs and specific market conditions.
CAO BA NHAN//@version=5
indicator("Potential Buy/Sell Limit Zones", overlay=true)
// Tham số đầu vào
volume_threshold = input.float(1.5, title="Volume Spike Threshold", step=0.1)
support_resistance_length = input.int(20, title="Support/Resistance Lookback Length")
// Tính toán SMA của volume và kiểm tra volume spike
volume_sma = ta.sma(volume, support_resistance_length)
volume_spike = volume > volume_sma * volume_threshold
// Xác định hỗ trợ và kháng cự
support = ta.lowest(close, support_resistance_length)
resistance = ta.highest(close, support_resistance_length)
// Hiển thị các vùng giới hạn có khả năng
plot(volume_spike ? support : na, title="Potential Buy Limit Zone", color=color.green, linewidth=2, style=plot.style_stepline)
plot(volume_spike ? resistance : na, title="Potential Sell Limit Zone", color=color.red, linewidth=2, style=plot.style_stepline)
// Đánh dấu trên biểu đồ khi có volume spike tại các vùng hỗ trợ/kháng cự
bgcolor(volume_spike and close == support ? color.new(color.green, 80) : na, title="Buy Zone")
bgcolor(volume_spike and close == resistance ? color.new(color.red, 80) : na, title="Sell Zone")
Multi-Timeframe Moving Averages by Skyito"Hope everyone likes this and finds it useful! This multi-timeframe moving average indicator provides a comprehensive view of moving averages from various timeframes directly on one chart. It’s designed to help traders analyze market trends and levels more effectively without constantly switching between charts.
Script Explanation: This indicator supports a range of moving average types, including SMA, EMA, HMA, WMA, VWMA, RMA, SSMA, and DEMA, allowing for flexibility in analysis. Each moving average is fully customizable by length and type for each timeframe, giving you control over how trends are represented.
The indicator includes timeframes such as 15 minutes, 1 hour, 4 hours, 6 hours, 8 hours, 12 hours, 1 day, 3 days, 5 days, 1 week, 3 weeks, and 1 month. Each moving average is displayed as a line with a small dashed extension, showing a label that contains the moving average’s timeframe, type, and current price level. The dark blue labels are slightly enlarged to enhance readability on the chart, making it easier to track important levels at a glance.
Use Case: This tool is ideal for traders looking to stay aware of trend levels across multiple timeframes on one chart. Adjusting the moving averages’ lengths and types enables customization for any strategy, while the label information provides an immediate understanding of the timeframe and trend context.
Enjoy the streamlined view and the added insights from multi-timeframe analysis!"
Previous Daily Candle The Previous Daily Candle indicator is a powerful tool designed to enhance your intraday trading by providing clear visual cues of the previous day's price action. By outlining the high, low, open, and close of the previous daily candle and adding a middle dividing line, this indicator offers valuable context to inform your trading decisions.
🎯 Purpose
Visual Clarity: Highlight the key levels from the previous day's price movement directly on your intraday charts.
Trend Confirmation: Quickly identify bullish or bearish sentiment based on the previous day's candle structure.
Support and Resistance: Use the outlined high and low as potential support and resistance levels for your trading strategies.
Customizable Visualization: Tailor the appearance of the outlines and middle line to fit your trading style and chart aesthetics.
🛠️ Features
Outlined Candle Structure:
High and Low Lines: Clearly mark the previous day's high and low with customizable colors and line widths.
Open and Close Representation: Visualize the previous day's open and close through the outlined structure.
Middle Dividing Line:
Average Price Level: A horizontal line divides the candle in half, representing the average of the open and close prices.
Customizable Appearance: Adjust the color and thickness to distinguish it from the high and low outlines.
Bullish and Bearish Differentiation:
Color-Coded Outlines: Automatically change the outline color based on whether the previous day's candle was bullish (green by default) or bearish (red by default).
Enhanced Visual Feedback: Quickly assess market sentiment with intuitive color cues.
Customization Options:
Outline Colors: Choose distinct colors for bullish and bearish candle outlines to match your chart's color scheme.
Middle Line Color: Select a color that stands out or blends seamlessly with your existing chart elements.
Line Width Adjustment: Modify the thickness of all lines to ensure visibility without cluttering the chart.
Transparent Candle Body:
Non-Intrusive Display: The indicator only draws the outlines and middle line, keeping the candle body transparent to maintain the visibility of your primary chart data.
⚙️ How It Works
Data Retrieval: The indicator fetches the previous day's open, high, low, and close prices using TradingView's request.security function.
Candle Analysis: Determines whether the previous day's candle was bullish or bearish by comparing the close and open prices.
Dynamic Drawing: Upon the start of a new day, the indicator deletes the previous outlines and redraws them based on the latest data.
Time Synchronization: Accurately aligns the outlines with the corresponding time periods on your intraday chart.
📈 How to Use
Add to Chart:
Open TradingView and navigate to the Pine Editor.
Paste the provided Pine Script code into the editor.
Click on Add to Chart to apply the indicator.
Customize Settings:
Access the indicator's settings by clicking the gear icon next to its name on the chart.
Adjust the Bullish Outline Color, Bearish Outline Color, Middle Line Color, and Outline Width to your preference.
Interpret the Lines:
Bullish Candle: If the previous day's close is higher than its open, the outlines will display in the bullish color (default green).
Bearish Candle: If the previous day's close is lower than its open, the outlines will display in the bearish color (default red).
Middle Line: Represents the midpoint between the open and close, providing a quick reference for potential support or resistance.
Integrate with Your Strategy:
Use the high and low outlines as potential entry or exit points.
Combine with other indicators for confirmation to strengthen your trading signals.
Frosty the Trendman: A Gift to Brighten Your Christmas TradesFrosty the Trendman: A Gift to Brighten Your Christmas Trades 🎁
This festive indicator we bring to you as a Christmas gift in the form of a snowman ☃️, to light up your chart with joy and the Christmas spirit. 🎄✨
Frosty is not just a festive snowman, he's also a market expert! 📈
And he’s useful as a trading indicator. 🤑
Key Features:
• Frosty changes color based on the trend! ❄️🎨
When the trend is bullish 💹, that is, when the price is above the 200-period simple moving average (SMA 200), Frosty turns a light green 🌱, reflecting a positive, growing atmosphere. This color activates when the price is above the SMA 200, indicating a bullish trend. 📈
• When the trend is bearish 📉, that is, when the price is below the SMA 200, Frosty changes to a light red 🔴, reflecting a negative market trend and a more pessimistic sentiment. 😔
See it here!
• Interactive elements 🤖: With buttons, eyes 👀, and a nose (in the shape of a triangle), Frosty even has a dollar sign 💵 on his hat because we all like a little Christmas cheer in our trades! 💰
• Christmas cheer 🎅🏼: The snowman not only represents festive fun, but also includes a label that says "Merry Christmas" 🎄 to remind you to enjoy the Christmas spirit in your trading. 🎉
• Perfect for the holiday season! 🎁
Although Frosty is a snowman, the purpose of this indicator is to bring warmth and joy 🌟 to your trading experience. Whether for fun or simply to add some Christmas magic to your charts, Frosty is here to guide your holiday trades with a festive touch! 🎅🎄✨
Enjoy the holiday spirit while trading with Frosty! ❄️
Español
Frosty the Trendman: Un regalo para alegrar tus trades navideños 🎁
Este indicador festivo que traemos para ti como un regalo navideño en forma de un muñeco de nieve ☃️, para iluminar tu gráfico con alegría y el espíritu navideño. 🎄✨
Frosty no solo es un muñeco de nieve festivo, ¡también es un experto en el mercado! 📈 Y tiene utilidad como indicador de trading. 🤑
Características clave:
• ¡Frosty cambia de color según la tendencia! ❄️🎨
Cuando la tendencia es alcista 💹, es decir, cuando el precio se encuentra por encima de la media móvil simple de 200 periodos (SMA 200), Frosty adquiere un color verde claro 🌱, que refleja un ambiente positivo y de crecimiento.
Este color se activa cuando el precio está por encima del SMA 200, indicando que la tendencia es alcista. 📈
• Cuando la tendencia es bajista 📉, es decir, cuando el precio se encuentra por debajo del SMA 200, Frosty cambia a un color rojo claro 🔴, lo que refleja una tendencia negativa en el mercado y un sentimiento más pesimista. 😔
• Elementos interactivos 🤖: Con botones, ojos 👀 y una nariz (en forma de triángulo), ¡Frosty incluso lleva un signo de dólar 💵 en su sombrero, porque a todos nos gusta un poco de alegría navideña en nuestras operaciones! 💰
• Ánimo navideño 🎅🏼: El muñeco de nieve no solo representa diversión festiva, sino que también incluye una etiqueta que dice "Merry Christmas" 🎄 para recordarte disfrutar del espíritu navideño en tu trading. 🎉
• ¡Perfecto para la temporada navideña! 🎁: Aunque Frosty sea un muñeco de nieve, el propósito de este indicador es traer calor y alegría 🌟 a tu experiencia de trading. Ya sea para divertirte o simplemente añadir un poco de magia navideña a tus gráficos,
¡Frosty está aquí para guiar tus operaciones navideñas con un toque festivo! 🎅🎄✨
Dollar Cost Averaging (YavuzAkbay)The Dollar Cost Averaging (DCA) indicator is designed to support long-term investors following a Dollar Cost Averaging strategy. The core aim of this tool is to provide insights into overbought and oversold levels, assisting investors in managing buy and sell decisions with a clear visual cue system. Specifically developed for use in trending or fluctuating markets, this indicator leverages support and resistance levels to give structure to investors' buying strategies. Here’s a detailed breakdown of the indicator’s key features and intended usage:
Key Features and Color Coding
Overbought/Oversold Detection:
The indicator shades candles from light green to dark green when an asset becomes increasingly overbought. Dark green signals indicate a peak, where the asset is overbought, suggesting a potential opportunity to take partial profits.
Conversely, candles turn from light red to dark red when the market is oversold. Dark red signifies a heavily oversold condition, marking an ideal buying window for initiating or adding to a position. This color scheme provides a quick visual reference for investors to manage entries and exits effectively.
Support and Resistance Levels:
To address the risk of assets falling further after an overbought signal, the DCA indicator dynamically calculates support and resistance levels. These levels guide investors on key price areas to watch for potential price reversals, allowing them to make more informed buying or selling decisions.
Support levels help investors assess whether they should divide their capital across multiple buy orders, starting at the current oversold zone and extending to anticipated support zones for maximum flexibility.
Usage Methodology
This indicator is intended for Dollar Cost Averaging, a method where investors gradually add to their position rather than entering all at once. Here’s how it complements the DCA approach:
Buy at Oversold Levels: When the indicator shows a dark red candle, it signals that the asset is oversold, marking an optimal entry point. The presence of support levels can help investors determine if they should fully invest their intended amount or stagger buys at potential lower levels.
Sell at Overbought Levels: When the indicator transitions to dark green, it suggests that the asset is overbought. This is an ideal time to consider selling a portion of holdings to realize gains. The resistance levels, marked by the indicator, offer guidance on where the price may encounter selling pressure, aiding investors in planning partial exits.
Customizable Settings
The DCA indicator offers several user-adjustable parameters:
Pivot Frequency and Source: Define the pivot point frequency and the source (candle wick or body) for more tailored support/resistance detection.
Maximum Pivot Points: Set the maximum number of pivot points to be used in support/resistance calculations, providing flexibility in adapting to different market structures.
Channel Width and Line Width: Adjust the width of the channel for support/resistance levels and the thickness of the lines for easier visual tracking.
Color Intensities for Overbought/Oversold Levels: Customize the shading intensity for each overbought and oversold level to align with your trading preferences.
BTCUSD Price Overextension from Configurable SMAsBTCUSD Price Overextension Indicator with Configurable SMAs
This indicator helps identify potential correction points for BTCUSD by detecting overextended conditions based on customizable short-term and long-term SMAs, average price deviation, and divergence.
Key Features:
Customizable SMAs: Set your own lengths for short-term (default 20) and long-term (default 50) SMAs, allowing you to tailor the indicator to different market conditions.
Overextension Detection: Detects when the average price over a set period (default 10 bars) is overextended above the short-term SMA by a configurable adjustment factor.
Divergence Threshold: Highlights when the short-term and long-term SMAs diverge beyond a specified threshold, signaling potential trend continuation.
Conditional Highlight: Displays a red background only when all conditions are met, and the current candle closes at or above the previous candle. A label "Overextended" appears only on the first bar of each overextended sequence for clear identification.
How to Use:
Identify Correction Signals: Look for red background highlights, which indicate a potential overextension based on the configured SMA and divergence thresholds.
Adjust Parameters: Use the adjustment factor, divergence threshold, and SMA lengths to fine-tune the indicator for different market environments or trading strategies.
This tool is ideal for BTCUSD traders looking to spot potential pullback areas or continuation zones by analyzing trend strength and overextension relative to key moving averages.
Customizable Multi-Timeframe Doji with Ray and Editable LabelScript Overview
Script Name: Customizable Multi-Timeframe Doji Candle Levels with Ray and Editable Label
Purpose: This script helps traders identify significant price levels based on high timeframe Doji candles, allowing them to visualize key areas of support, resistance, entry, and exit. By plotting real-time Doji levels from higher timeframes directly on the current chart, traders can easily spot areas where market indecision or potential trend reversals have previously occurred, making these levels highly relevant for future price action.
How the Script Works
This script detects Doji candles on a selected higher timeframe (e.g., daily, weekly, monthly) and plots a ray at the Doji’s closing level on the current chart. The Doji candle formation, characterized by an open and close that are very close or equal, is often an indicator of market indecision. By identifying these Doji levels from high timeframes, the script provides traders with insight into where strong support and resistance zones may form.
The script continuously monitors and updates the Doji level based on the selected timeframe, ensuring that only the latest detected Doji candle is displayed on the chart, helping traders avoid clutter and focus on the most recent data.
Core Components and Calculations
1 Doji Detection Logic:
-The script calculates the Doji candle formation based on a small body percentage (defined by the C_DojiBodyPercent parameter) and relative symmetry in upper and lower shadows (defined by C_ShadowPercent and C_ShadowEqualsPercent).
-A Doji is considered valid when the open and close prices are nearly equal, and the shadows are symmetric within the defined parameters, indicating indecision.
2 Multi-Timeframe Data Retrieval:
-Using the request.security() function, the script fetches open, high, low, and close prices from the specified higher timeframe. It applies Doji detection logic to this higher timeframe data.
-barmerge.lookahead_on and barmerge.gaps_on ensure real-time updates, so the Doji level is immediately reflected on the chart when detected.
3 Ray and Label Plotting:
-When a Doji candle is detected on the selected timeframe, the script plots a ray at the Doji's close price, extending forward on the chart.
-Customizable options for the ray, including color, width, and style (solid, dotted, or dashed), help traders visually differentiate the Doji levels from other chart elements.
-An editable label can be positioned alongside the ray to denote the Doji level, with customizable text, color, background, and size to provide additional context.
4 Automatic Line and Label Management:
-The script dynamically deletes any previous ray and label when a new Doji is detected. This approach minimizes chart clutter and ensures that only the most recent Doji level from the higher timeframe is displayed.
Customization Options
1 Timeframe Selection:
Users can choose any timeframe (e.g., hourly, daily, weekly, monthly) to display Doji levels based on their specific trading strategy.
2 Ray and Label Appearance:
Ray: Customize color, width, and line style (solid, dotted, dashed) for better visibility and integration with the chart’s theme.
Label: Customize the label text, background color, text color, text size, and position (above, below, left, or right of the ray) for a personalized view.
How to Use This Script
1 Select the Target Timeframe for Doji Detection: Choose a high timeframe (such as daily or weekly) to view Doji-based support/resistance levels.
2 Set Custom Ray and Label Parameters : Adjust the visual aspects of the ray and label to align with your chart setup and make the Doji level stand out.
3 Interpretation of Doji Levels: Use the plotted Doji levels as potential support or resistance zones. Since Doji candles reflect market indecision, they often precede significant price reversals or strong continuation moves. By analyzing these levels, traders can:
- Identify key support/resistance zones based on historical market indecision.
- Set entry and exit levels around these zones to capitalize on potential reversals or
continuations.
-Spot confluence areas where the Doji level aligns with other indicators or technical patterns.
Recommended Chart Setup
For optimal clarity, use this script on a clean chart, free from overlapping indicators. This script is designed to work independently, so avoid layering multiple support/resistance scripts unless essential to avoid clutter. A clean chart helps ensure that Doji levels are readily visible, enabling a clear focus on significant levels relevant to your trading strategy.
Optimus trader Optimus Trader
Indicator Description:
The Optimus Trader indicator is designed for technical traders looking for entry and exit points in financial markets. It combines signals based on volume, moving averages, VWAP (Volume Weighted Average Price), as well as the recognition of candlestick patterns such as Pin Bar and Inside Bars. This indicator helps identify opportune moments to buy or sell based on trends, volumes, and recent liquidity zones.
Parameters and Features:
1. Simple Moving Average (MA) and VWAP:
- Optimus Trader uses a 50-period simple moving average to determine the underlying trend. It also includes VWAP for precise price analysis based on traded volumes.
- These two indicators help identify whether the market is in an uptrend or downtrend, enhancing the reliability of buy and sell signals.
2. Volume :
- To avoid false signals, a volume threshold is set using a 20-period moving average, adjusted to 1.2 times the average volume. This filters signals by considering only high-volume periods, indicating heightened market interest.
3. Candlestick Pattern Recognition:
- Pin Bar: This sought-after candlestick pattern is detected for both bullish and bearish setups. A bullish or bearish *Pin Bar* often signals a possible reversal or continuation.
- *Inside Bar*: This price compression pattern is also detected, indicating a zone of indecision before a potential movement.
4. Trend:
- An uptrend is confirmed when the price is above the MA and VWAP, while a downtrend is identified when the price is below both indicators.
5. Liquidity Zones:
- Optimus Trader includes an approximate liquidity zone detection feature. By identifying recent support and resistance levels, the indicator detects if the price is near these zones. This feature strengthens the relevance of buy or sell signals.
6. Buy and Sell Signals:
- Buy: A buy signal is generated when the indicator detects a bullish *Pin Bar* or *Inside Bar* in an uptrend with high volume, and the price is close to a liquidity zone.
- Sell: A sell signal is generated when a bearish *Pin Bar* or *Inside Bar* is detected in a downtrend with high volume, and the price is near a liquidity zone.
Signal Display:
The signals are visible directly on the chart:
- A "BUY" label in green is displayed below the bar for buy signals.
- A "SELL" label in red is displayed above the bar for sell signals.
Summary:
This indicator is intended for traders seeking precise entry and exit points by integrating trend analysis, volume, and candlestick patterns. With liquidity zones, *Optimus Trader* helps minimize false signals, providing clear and accurate alerts.
---
This description can be directly added to TradingView to help users quickly understand the features and logic of this indicator.
Fractal Trend Detector [Skyrexio]Introduction
Fractal Trend Detector leverages the combination of Williams fractals and Alligator Indicator to help traders to understand with the high probability what is the current trend: bullish or bearish. It visualizes the potential uptrend with the coloring bars in green, downtrend - in red color. Indicator also contains two additional visualizations, the strong uptrend and downtrend as the green and red zones and the white line - trend invalidation level (more information in "Methodology and it's justification" paragraph)
Features
Optional strong up and downtrends visualization: with the specified parameter in settings user can add/hide the green and red zones of the strong up and downtrends.
Optional trend invalidation level visualization: with the specified parameter in settings user can add/hide the white line which shows the current trend invalidation price.
Alerts: user can set up the alert and have notifications when uptrend/downtrend has been started, strong uptrend/downtrend started.
Methodology and it's justification
In this script we apply the concept of trend given by Bill Williams in his book "Trading Chaos". This approach leverages the Alligator and Fractals in conjunction. Let's briefly explain these two components.
The Williams Alligator, created by Bill Williams, is a technical analysis tool used to identify trends and potential market reversals. It consists of three moving averages, called the jaw, teeth, and lips, which represent different time periods:
Jaw (Blue Line): The slowest line, showing a 13-period smoothed moving average shifted 8 bars forward.
Teeth (Red Line): The medium-speed line, an 8-period smoothed moving average shifted 5 bars forward.
Lips (Green Line): The fastest line, a 5-period smoothed moving average shifted 3 bars forward.
When the lines are spread apart and aligned, the "alligator" is "awake," indicating a strong trend. When the lines intertwine, the "alligator" is "sleeping," signaling a non-trending or range-bound market. This indicator helps traders identify when to enter or avoid trades.
Williams Fractals, introduced by Bill Williams, are a technical analysis tool used to identify potential reversal points on a price chart. A fractal is a series of at least five consecutive bars where the middle bar has the highest high (for a up fractal) or the lowest low (for a down fractal), compared to the two bars on either side.
Key Points:
Up fractal: Formed when the middle bar shows a higher high than the two preceding and two following bars, signaling a potential turning point downward.
Down fractal: Formed when the middle bar has a lower low than the two surrounding bars, indicating a potential upward reversal.
Fractals are often used with other indicators to confirm trend direction or reversal, helping traders make more informed trading decisions.
How we can use its combination? Let's explain the uptrend example. The up fractal breakout to the upside can be interpret as bullish sign, there is a high probability that uptrend has just been started. It can be explained as following: the up fractal created is the potential change in market's behavior. A lot of traders made a decision to sell and it created the pullback with the fractal at the top. But if price is able to reach the fractal's top and break it, this is a high probability sign that market "changed his opinion" and bullish trend has been started. The moment of breaking is the potential changing to the uptrend. Here is another one important point, this breakout shall happen above the Alligator's teeth line. If not, this crossover doesn't count and the downtrend potentially remaining. The inverted logic is true for the down fractals and downtrend.
According to this methodology we received the high probability up and downtrend changes, but we can even add it. If current trend established by the indicator as the uptrend and alligator's lines have the following order: lips is higher than teeth, teeth is higher than jaw, script count it as a strong uptrend and start print the green zone - zone between lips and jaw. It can be used as a high probability support of the current bull market. The inverted logic can be used for bearish trend and red zones: if lips is lower than teeth and teeth is lower than jaw it's interpreted by the indicator as a strong down trend.
Indicator also has the trend invalidation line (white line). If current bar is green and market condition is interpreted by the script as an uptrend you will see the invalidation line below current price. This is the price level which shall be crossed by the price to change up trend to down trend according to algorithm. This level is recalculated on every candle. The inverted logic is valid for downtrend.
How to use indicator
Apply it to desired chart and time frame. It works on every time frame.
Setup the settings with enabling/disabling visualization of strong up/downtrend zones and trend invalidation line. "Show Strong Bullish/Bearish Trends" and "Show Trend Invalidation Price" checkboxes in the settings. By default they are turned on.
Analyze the price action. Indicator colored candle in green if it's more likely that current state is uptrend, in red if downtrend has the high probability to be now. Green zones between two lines showing if current uptrend is likely to be strong. This zone can be used as a high probability support on the uptrend. The red zone show high probability of strong downtrend and can be used as a resistance. White line is showing the level where uptrend or downtrend is going be invalidated according to indicator's algorithm. If current bar is green invalidation line will be below the current price, if red - above the current price.
Set up the alerts if it's needed. Indicator has four custom alerts called "Uptrend has been started" when current bar closed as green and the previous was not green, "Downtrend has been started" when current bar closed red and the previous was not red, "Uptrend became strong" if script started printing the green zone "Downtrend became strong" if script started printing the red zone.
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test indicators before live implementation.
Position Size Calculator by Dr. Rahul Ware.Position Size Calculator
The Position Size Calculator script helps traders determine the optimal position size for their trades based on their account balance, risk percentage, and stop loss parameters. It calculates the number of shares to buy and the total position size in INR (Indian Rupees), providing a clear and concise way to manage risk effectively.
Key Features:
Account Balance Input: Specify your account balance in INR to tailor the position size calculations to your specific trading capital.
Risk Percentage Input: Define the percentage of your account balance you are willing to risk on each trade, ensuring you stay within your risk tolerance.
Stop Loss Options: Choose between using a fixed stop loss price or a stop loss percentage to calculate the risk amount per share.
Dynamic Stop Loss Line: The script plots a red dotted line representing the stop loss price on the chart, updating dynamically for the last bar.
Comprehensive Table Display: View key metrics, including account balance, risk percentage, amount at risk, current price, stop loss price, stop loss percentage, position size in INR, and the number of shares to buy, all in a neatly formatted table.
This tool is designed to enhance your trading strategy by providing precise position sizing, helping you manage risk effectively and make informed trading decisions. Use this script to optimize your trade sizes and improve your overall trading performance.
Liquidity Channels [TFO]This indicator was built to visually demonstrate the significance of major, untouched pivots. With traders commonly placing orders at or near significant pivots, these areas are commonly referred to as Resting Liquidity. If we attribute some factor of growth over time, we can quickly visualize that certain pivots originated much further away than others, if their channels appear larger.
A pivot in this case is validated by the Liquidity Strength parameter. If set to 50 for example, then a pivot high is validated if its high is greater than the high of the 50 bars to the left and right of itself. This also implies a delay in finding pivots, as the drawings won't actually appear until validation, which would occur 50 bars after the original high has formed in this case. This is typical of indicators using swing highs and lows, as one must wait some period of time to validate the pivots in question.
The Channel Growth parameter dictates how much the Liquidity Channels will expand over time. The following chart is an example, where the left-hand side is using a Channel Growth of 1, and the right-hand side is using a Channel Growth of 10.
When price reaches these levels, they become invalidated and will stop extending to the right. The other condition for invalidation is the Delete After (Bars) parameter which, when enabled, declares that untouched levels will be deleted if the distance from their origin exceeds this many bars.
This indicator also offers an option to Hide Expanding Channels for those who just want the actual levels on their chart, without the extra visuals, which would look something like the below chart.
Moving Average Pullback Signals [UAlgo]The "Moving Average Pullback Signals " indicator is designed to identify potential trend continuation or reversal points based on moving average (MA) pullback patterns. This tool combines multiple types of moving averages, customized trend validation parameters, and candlestick wick patterns to provide reliable buy and sell signals. By leveraging several advanced MA methods (such as TEMA, DEMA, ZLSMA, and McGinley-D), this script can adapt to different market conditions, providing traders with flexibility and more precise trend-based entries and exits. The addition of a gradient color-coded moving average line and wick validation logic enables traders to visualize market sentiment and trend strength dynamically.
🔶 Key Features
Multiple Moving Average (MA) Calculation Methods: This indicator offers various MA calculation types, including SMA, EMA, DEMA, TEMA, ZLSMA, and McGinley-D, allowing traders to select the MA that best fits their strategy.
Trend Validation and Pattern Recognition: The indicator includes a customizable trend validation length, ensuring that the trend is consistent before buy/sell signals are generated. The "Trend Pattern Mode" setting provides flexibility between "No Trend in Progress," "Trend Continuation," and "Both," tailoring signals to the trader’s preferred style.
Wick Validation Logic: To enhance the accuracy of entries, this indicator identifies specific wick patterns for bullish or bearish pullbacks, which signal potential trend continuation or reversal. Wick length and validation factor are adjustable to suit various market conditions and timeframes.
Gradient Color-coded MA Line: This feature provides a quick visual cue for trend strength, with color changes reflecting relative highs and lows of the MA, enhancing market sentiment interpretation.
Alerts for Buy and Sell Signals: Alerts are triggered when either a bullish or bearish pullback is detected, allowing traders to receive instant notifications without continuously monitoring the chart.
Visual Labels for Reversal Points: The indicator plots labels ("R") at potential reversal points, with color-coded labels for bullish (green) and bearish (red) pullbacks, highlighting pullback opportunities that align with the trend or reversal potential.
🔶 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.
Smooth Price Oscillator [BigBeluga]The Smooth Price Oscillator by BigBeluga leverages John Ehlers' SuperSmoother filter to produce a clear and smooth oscillator for identifying market trends and mean reversion points. By filtering price data over two distinct periods, this indicator effectively removes noise, allowing traders to focus on significant signals without the clutter of market fluctuations.
🔵 KEY FEATURES & USAGE
● SuperSmoother-Based Oscillator:
This oscillator uses Ehlers' SuperSmoother filter, applied to two different periods, to create a smooth output that highlights price momentum and reduces market noise. The dual-period application enables a comparison of long-term and short-term price movements, making it suitable for both trend-following and reversion strategies.
// @function SuperSmoother filter based on Ehlers Filter
// @param price (float) The price series to be smoothed
// @param period (int) The smoothing period
// @returns Smoothed price
method smoother_F(float price, int period) =>
float step = 2.0 * math.pi / period
float a1 = math.exp(-math.sqrt(2) * math.pi / period)
float b1 = 2 * a1 * math.cos(math.sqrt(2) * step / period)
float c2 = b1
float c3 = -a1 * a1
float c1 = 1 - c2 - c3
float smoothed = 0.0
smoothed := bar_index >= 4
? c1 * (price + price ) / 2 + c2 * smoothed + c3 * smoothed
: price
smoothed
● Mean Reversion Signals:
The indicator identifies two types of mean reversion signals:
Simple Mean Reversion Signals: Triggered when the oscillator moves between thresholds of 1 and Overbought or between thresholds -1 and Ovesold, providing additional reversion opportunities. These signals are useful for capturing shorter-term corrections in trending markets.
Strong Mean Reversion Signals: Triggered when the oscillator above the overbought (upper band) or below oversold (lower band) thresholds, indicating a strong reversal point. These signals are marked with a "+" symbol on the chart for clear visibility.
Both types of signals are plotted on the oscillator and the main chart, helping traders to quickly identify potential trade entries or exits.
● Dynamic Bands and Thresholds:
The oscillator includes overbought and oversold bands based on a dynamically calculated standard deviation and EMA. These bands provide visual boundaries for identifying extreme price conditions, helping traders anticipate potential reversals at these levels.
● Real-Time Labels:
Labels are displayed at key thresholds and bands to indicate the oscillator’s status: "Overbought," "Oversold," and "Neutral". Mean reversion signals are also displayed on the main chart, providing an at-a-glance summary of current indicator conditions.
● Customizable Threshold Levels:
Traders can adjust the primary threshold and smoothing length according to their trading style. A higher threshold can reduce signal frequency, while a lower setting will provide more sensitivity to market reversals.
The Smooth Price Oscillator by BigBeluga is a refined, noise-filtered indicator designed to highlight mean reversion points with enhanced clarity. By providing both strong and simple reversion signals, as well as dynamic overbought/oversold bands, this tool allows traders to spot potential reversals and trend continuations with ease. Its dual representation on the oscillator and the main price chart offers flexibility and precision for any trading strategy focused on capturing cyclical market movements.
Systematic Investment Tracker by Ceyhun Gonul### English Description
**Systematic Investment Tracker with Enhanced Features**
This script, titled **Systematic Investment Tracker with Enhanced Features**, is a TradingView tool designed to support systematic investments across different market conditions. It provides traders with two customizable investment strategies — **Continuous Buying** and **Declining Buying** — and includes advanced dynamic investment adjustment features for each.
#### Detailed Explanation of Script Features and Originality
1. **Two Investment Strategies**:
- **Continuous Buying**: This strategy performs purchases consistently at each interval, as set by the user, regardless of market price changes. It follows the principle of dollar-cost averaging, allowing users to build an investment position over time.
- **Declining Buying**: Unlike Continuous Buying, this strategy triggers purchases only when the asset's price has declined from the previous interval's closing price. This approach helps users capitalize on lower price points, potentially improving average costs during downward trends.
2. **Dynamic Investment Adjustment**:
- For both strategies, the script includes a **Dynamic Investment Adjustment** feature. If enabled, this feature increases the purchasing amount by 50% if the current price has fallen by a specific user-defined percentage relative to the previous price. This allows users to accumulate a larger position when the asset is declining, which may benefit long-term cost-averaging strategies.
3. **Customizable Time Frames**:
- Users can specify a **start and end date** for investment, allowing them to restrict or backtest strategies within a specific timeframe. This feature is valuable for evaluating strategy performance over specific market cycles or historical periods.
4. **Graphical Indicators and Labels**:
- The script provides graphical labels on the chart that display purchase points. These indicators help users visualize their investment entries based on the strategy selected.
- A summary **performance label** is also displayed, providing real-time updates on the total amount spent, accumulated quantity, average cost, portfolio value, and profit percentage for each strategy.
5. **Language Support**:
- The script includes English and Turkish language options. Users can toggle between these languages, allowing the summary label text and descriptions to be displayed in their preferred language.
6. **Performance Comparison Table**:
- An optional **Performance Comparison Table** is available, offering a side-by-side analysis of net profit, total investment, and profit percentage for both strategies. This comparison table helps users assess which strategy has yielded better returns, providing clarity on each approach's effectiveness under the chosen parameters.
#### How the Script Works and Its Uniqueness
This closed-source script brings together two established investment strategies in a single, dynamic tool. By integrating continuous and declining purchase strategies with advanced settings for dynamic investment adjustment, the script offers a powerful, flexible tool for both passive and active investors. The design of this script provides unique benefits:
- Enables automated, systematic investment tracking, allowing users to build positions gradually.
- Empowers users to leverage declines through dynamic adjustments to optimize average cost over time.
- Presents an easy-to-read performance label and table, enabling an efficient and transparent performance comparison for informed decision-making.
---
### Türkçe Açıklama
**Gelişmiş Özellikli Sistematik Yatırım Takipçisi**
**Gelişmiş Özellikli Sistematik Yatırım Takipçisi** adlı bu TradingView scripti, çeşitli piyasa koşullarında sistematik yatırım stratejilerini desteklemek üzere tasarlanmış bir araçtır. Script, kullanıcıya iki özelleştirilebilir yatırım stratejisi — **Sürekli Alım** ve **Düşen Alım** — ve her strateji için gelişmiş dinamik yatırım ayarlama seçenekleri sunar.
#### Script Özelliklerinin Detaylı Açıklaması ve Özgünlük
1. **İki Yatırım Stratejisi**:
- **Sürekli Alım**: Bu strateji, fiyat değişimlerine bakılmaksızın kullanıcının belirlediği her aralıkta sabit bir miktar yatırım yapar. Bu yaklaşım, uzun vadede pozisyonu kademeli olarak oluşturmak isteyenler için idealdir.
- **Düşen Alım**: Sürekli Alım’ın aksine, bu strateji yalnızca fiyat bir önceki aralığın kapanış fiyatına göre düştüğünde alım yapar. Bu yöntem, yatırımcıların daha düşük fiyatlardan alım yaparak ortalama maliyeti potansiyel olarak iyileştirmelerine yardımcı olur.
2. **Dinamik Yatırım Ayarlaması**:
- Her iki strateji için de **Dinamik Yatırım Ayarlaması** özelliği bulunmaktadır. Bu özellik aktif edildiğinde, mevcut fiyatın bir önceki fiyata göre kullanıcı tarafından belirlenen bir yüzde oranında düşmesi durumunda alım miktarını %50 artırır. Bu durum, uzun vadede maliyet ortalaması stratejilerine katkıda bulunur.
3. **Özelleştirilebilir Tarih Aralığı**:
- Kullanıcılar, yatırımı belirli bir tarih aralığında sınırlandırmak veya test etmek için bir **başlangıç ve bitiş tarihi** belirleyebilir. Bu özellik, strateji performansını geçmiş piyasa döngüleri veya belirli dönemlerde değerlendirmek için kullanışlıdır.
4. **Grafiksel İşaretleyiciler ve Etiketler**:
- Script, grafik üzerinde alım noktalarını gösteren işaretleyiciler sağlar. Bu görsel göstergeler, kullanıcıların seçilen stratejiye göre yatırım girişlerini görselleştirmesine yardımcı olur.
- Ayrıca, her strateji için harcanan toplam tutar, biriken miktar, ortalama maliyet, portföy değeri ve kâr yüzdesi gibi bilgileri gerçek zamanlı olarak gösteren bir **performans etiketi** sunar.
5. **Dil Desteği**:
- Script, İngilizce ve Türkçe dillerini desteklemektedir. Kullanıcılar, performans etiketi metninin ve açıklamalarının tercih ettikleri dilde görüntülenmesi için dil seçimini yapabilir.
6. **Performans Karşılaştırma Tablosu**:
- İsteğe bağlı olarak kullanılabilen bir **Performans Karşılaştırma Tablosu**, her iki strateji için net kâr, toplam yatırım ve kâr yüzdesi gibi bilgileri yan yana analiz eder. Bu tablo, kullanıcıların hangi stratejinin daha yüksek getiri sağladığını değerlendirmesine yardımcı olur.
#### Scriptin Çalışma Prensibi ve Özgünlüğü
Bu script, iki yatırım stratejisini gelişmiş bir araçta birleştirir. Sürekli ve düşen fiyatlara dayalı alım stratejilerini dinamik yatırım ayarlama özelliğiyle entegre ederek yatırımcılar için güçlü ve esnek bir çözüm sunar. Script’in tasarımı aşağıdaki benzersiz faydaları sağlamaktadır:
- Otomatik, sistematik yatırım takibi yaparak kullanıcıların pozisyonlarını kademeli olarak oluşturmalarına olanak tanır.
- Dinamik ayarlama ile düşüşlerden yararlanarak zaman içinde ortalama maliyeti optimize etme olanağı sağlar.
- Her iki stratejinin performansını basit ve anlaşılır bir şekilde karşılaştıran etiket ve tablo ile verimli bir performans değerlendirmesi sunar.
Machine Learning RSI [BackQuant]Machine Learning RSI
The Machine Learning RSI is a cutting-edge trading indicator that combines the power of Relative Strength Index (RSI) with Machine Learning (ML) clustering techniques to dynamically determine overbought and oversold thresholds. This advanced indicator adapts to market conditions in real-time, offering traders a robust tool for identifying optimal entry and exit points with increased precision.
Core Concept: Relative Strength Index (RSI)
The RSI is a well-known momentum oscillator that measures the speed and change of price movements, oscillating between 0 and 100. Typically, RSI values above 70 are considered overbought, and values below 30 are considered oversold. However, static thresholds may not be effective in all market conditions.
This script enhances the RSI by integrating a dynamic thresholding system powered by Machine Learning clustering, allowing it to adapt thresholds based on historical RSI behavior and market context.
Machine Learning Clustering for Dynamic Thresholds
The Machine Learning (ML) component uses clustering to calculate dynamic thresholds for overbought and oversold levels. Instead of relying on fixed RSI levels, this indicator clusters historical RSI values into three groups using a percentile-based initialization and iterative optimization:
Cluster 1: Represents lower RSI values (typically associated with oversold conditions).
Cluster 2: Represents mid-range RSI values.
Cluster 3: Represents higher RSI values (typically associated with overbought conditions).
Dynamic thresholds are determined as follows:
Long Threshold: The upper centroid value of Cluster 3.
Short Threshold: The lower centroid value of Cluster 1.
This approach ensures that the indicator adapts to the current market regime, providing more accurate signals in volatile or trending conditions.
Smoothing Options for RSI
To further enhance the effectiveness of the RSI, this script allows traders to apply various smoothing methods to the RSI calculation, including:
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Weighted Moving Average (WMA)
Hull Moving Average (HMA)
Linear Regression (LINREG)
Double Exponential Moving Average (DEMA)
Triple Exponential Moving Average (TEMA)
Adaptive Linear Moving Average (ALMA)
T3 Moving Average
Traders can select their preferred smoothing method and adjust the smoothing period to suit their trading style and market conditions. The option to smooth the RSI reduces noise and makes the indicator more reliable for detecting trends and reversals.
Long and Short Signals
The indicator generates long and short signals based on the relationship between the RSI value and the dynamic thresholds:
Long Signals: Triggered when the RSI crosses above the long threshold, signaling bullish momentum.
Short Signals: Triggered when the RSI falls below the short threshold, signaling bearish momentum.
These signals are dynamically adjusted to reflect real-time market conditions, making them more robust than static RSI signals.
Visualization and Clustering Insights
The Machine Learning RSI provides an intuitive and visually rich interface, including:
RSI Line: Plotted in real-time, color-coded based on its position relative to the dynamic thresholds (green for long, red for short, gray for neutral).
Dynamic Threshold Lines: The script plots the long and short thresholds calculated by the ML clustering process, providing a clear visual reference for overbought and oversold levels.
Cluster Plots: Each RSI cluster is displayed with distinct colors (green, orange, and red) to give traders insights into how RSI values are grouped and how the dynamic thresholds are derived.
Customization Options
The Machine Learning RSI is highly customizable, allowing traders to tailor the indicator to their preferences:
RSI Settings : Adjust the RSI length, source price, and smoothing method to match your trading strategy.
Threshold Settings : Define the range and step size for clustering thresholds, allowing you to fine-tune the clustering process.
Optimization Settings : Control the performance memory, maximum clustering steps, and maximum data points for ML calculations to ensure optimal performance.
UI Settings : Customize the appearance of the RSI plot, dynamic thresholds, and cluster plots. Traders can also enable or disable candle coloring based on trend direction.
Alerts and Automation
To assist traders in staying on top of market movements, the script includes alert conditions for key events:
Long Signal: When the RSI crosses above the long threshold.
Short Signal: When the RSI crosses below the short threshold.
These alerts can be configured to notify traders in real-time, enabling timely decisions without constant chart monitoring.
Trading Applications
The Machine Learning RSI is versatile and can be applied to various trading strategies, including:
Trend Following: By dynamically adjusting thresholds, this indicator is effective in identifying and following trends in real-time.
Reversal Trading: The ML clustering process helps identify extreme RSI levels, offering reliable signals for reversals.
Range-Bound Trading: The dynamic thresholds adapt to market conditions, making the indicator suitable for trading in sideways markets where static thresholds often fail.
Final Thoughts
The Machine Learning RSI represents a significant advancement in RSI-based trading indicators. By integrating Machine Learning clustering techniques, this script overcomes the limitations of static thresholds, providing dynamic, adaptive signals that respond to market conditions in real-time. With its robust visualization, customizable settings, and alert capabilities, this indicator is a powerful tool for traders seeking to enhance their momentum analysis and improve decision-making.
As always, thorough backtesting and integration into a broader trading strategy are recommended to maximize the effectiveness!
Easy CotHow to Use the Commitment of Traders (COT) Report for Market Analysis
The Commitment of Traders (COT) report is a weekly publication by the Commodity Futures Trading Commission (CFTC) that breaks down the open interest in various futures markets. It categorizes traders into three main groups: Commercials, Non-Commercials, and Retail Traders (Non-Reportable positions). Understanding and analyzing the COT report can provide insights into market sentiment and potential reversals, especially in commodity, currency, and stock index futures.
Key Components of the COT Report
Commercials (Hedgers)
These are entities involved in the production or consumption of the underlying asset. For example, oil producers might hedge by selling oil futures to lock in prices, while airlines might buy futures to hedge against rising prices.
Commercials typically act as hedgers, so their positions can indicate the need for protection rather than speculative intent. Because they are less price-sensitive, their positions are usually opposite to the trend near market reversals.
Non-Commercials (Large Speculators)
This group includes hedge funds, asset managers, and large traders who take speculative positions to profit from price movements.
Non-Commercials are often trend-followers, meaning they increase long positions in an uptrend and short positions in a downtrend. When Non-Commercials become extremely bullish or bearish, it may signal a potential market reversal.
Retail Traders (Non-Reportable Positions)
These are smaller individual traders whose positions are too small to be reported individually.
Retail traders tend to be less experienced and are often on the wrong side of major market moves, so extreme positions by retail traders can sometimes signal a market turning point.
How to Interpret the COT Data
1. Identify Extreme Positions
Extreme Long or Short Positions: When a group reaches a historically extreme level of long or short positions, it often signals a potential reversal. For instance, if Non-Commercials are overwhelmingly long, it may indicate that the uptrend is overextended, and a reversal could be near.
Contrarian Indicator: Since Retail Traders are often on the wrong side, you may look for signals where they are extremely long or short, indicating a possible reversal in the opposite direction.
2. Look for Divergences
Divergence Between Groups: If Non-Commercials (speculators) and Retail Traders are moving in opposite directions, it could indicate that a trend is losing momentum and a reversal is possible.
Commercials vs. Non-Commercials: Commercials are often positioned opposite to Non-Commercials. If there’s a divergence where Non-Commercials are highly bullish, but Commercials are increasingly bearish, it might suggest a coming reversal.
3. Trend Confirmation and Reversal Signals
Trend Confirmation: If both Non-Commercials and Retail Traders are aligned in one direction, it might confirm the trend. However, keep in mind that such alignment may signal the later stages of a trend.
Reversal Signals: Look for signs when Non-Commercials are reaching a peak in one direction while Retail Traders peak in the opposite. Such situations can often indicate that the current trend is close to exhaustion.
Using the COT Report in Trading Strategies
Contrarian Trading Strategy
Extreme Positions as Reversal Signals: Use COT data to identify extreme positions. For instance, if Non-Commercials have a very high long position in a commodity, it might suggest that a bullish trend is overextended and a bearish reversal could be near.
Retail Trader Extremes: If Retail Traders are heavily long or short, consider taking the opposite position once you have additional confirmation signals (e.g., technical indicators).
Following the Trend with Large Speculators
Non-Commercials tend to be trend-followers, so if you see them increasingly long (or short) on an asset, it could be a signal to follow the trend until extreme levels are reached.
Using Divergences for Entry and Exit Points
Entry: If Non-Commercials are long, but Retail Traders are heavily short, consider entering a long position as it may confirm the trend.
Exit: If Non-Commercials begin to reduce their positions while Retail Traders increase theirs, it might be time to consider exiting, as the trend could be losing momentum.
Weighted CG Oscillator with ATRATR-Weighted CG Oscillator
The ATR-Weighted CG Oscillator is an enhanced version of the Center of Gravity (CG) Oscillator, originally developed by John Ehlers . By adding the Average True Range (ATR) to dynamically adjust the oscillator’s values based on market volatility, this indicator aims to make trend signals more responsive to price changes, offering an adaptive tool for trend analysis.
Functionality Overview :
The CG Oscillator, a classic trend-following indicator, has been modified here to incorporate the ATR for improved context and adaptability in different market conditions. The indicator calculates the CG Oscillator and scales it by dividing the ATR by the closing price to normalize for volatility. This creates a “weighted” CG Oscillator that generates more contextually relevant signals. A colored line shows green for long signals (above the long threshold), red for short signals (below the short threshold), and gray for neutral conditions.
Input Parameters :
CGO Length : Sets the period of the CG Oscillator calculation.
ATR Length : Determines the period of the ATR calculation. Longer periods smooth out the volatility impact.
Long Threshold : The threshold that triggers a long signal; a long (green) signal occurs when the weighted CG Oscillator crosses above this level.
Short Threshold : The threshold that triggers a short signal; a short (red) signal occurs when the weighted CG Oscillator crosses below this level.
Source : Specifies the data source for CG Oscillator calculations, with the default set to the closing price.
Recommended Use :
This indicator is designed to be an adaptive tool, not your sole resource. To ensure its effectiveness, it’s essential to backtest the indicator on your chosen asset over your preferred timeframe. Market dynamics vary, so testing the indicator’s parameters—especially the thresholds—will allow you to find the settings that best suit your strategy. While the default values work well for some scenarios, customizing the settings will help align the indicator with your unique trading style and the asset’s characteristics.
Momentum TrackerTo screen for momentum movers, one can filter for stocks that have made a noticeable move over a set period—this initial move defines the momentum or swing move. From this list of candidates, we can create a watchlist by selecting those showing a momentum pause, such as a pullback or consolidation, which later could set up for a continuation.
This Momentum Tracker Indicator serves as a study tool to visualize when stocks historically met these momentum conditions. It marks on the chart where a stock would have appeared on the screener, allowing us to review past momentum patterns and screener requirements.
Indicator Calculation
Bullish Momentum: Price is above the lowest point within the lookback period by the specified threshold percentage.
Bearish Momentum: Price is below the highest point within the lookback period by the specified threshold percentage.
The tool is customizable in terms of lookback period and percentage threshold to accommodate different trading styles and timeframes, allowing us to set criteria that align with specific hold times and momentum requirements.
William Fractals + SignalsWilliams Fractals + Trading Signals
This indicator identifies Williams Fractals and generates trading signals based on price sweeps of these fractal levels.
Williams Fractals are specific candlestick patterns that identify potential market turning points. Each fractal requires a minimum of 5 bars (2 before, 1 center, 2 after), though this indicator allows you to customize the number of bars checked.
Up Fractal (High Point) forms when you have a center bar whose HIGH is higher than the highs of 'n' bars before and after it. For example, with n=2, you'd see a pattern where the center bar's high is higher than 2 bars before and 2 bars after it. The indicator also recognizes patterns where up to 4 bars after the center can have equal highs before requiring a lower high.
Down Fractal (Low Point) forms when you have a center bar whose LOW is lower than the lows of 'n' bars before and after it. For example, with n=2, you'd see a pattern where the center bar's low is lower than 2 bars before and 2 bars after it. The indicator also recognizes patterns where up to 4 bars after the center can have equal lows before requiring a higher low.
Trading Signals:
The indicator generates signals when price "sweeps" these fractal levels:
Buy Signal (Green Triangle) triggers when price sweeps a down fractal. This requires price to go BELOW the down fractal's low level and then CLOSE ABOVE it . This pattern often indicates a failed breakdown and potential reversal upward.
Sell Signal (Red Triangle) triggers when price sweeps an up fractal. This requires price to go ABOVE the up fractal's high level and then CLOSE BELOW it. This pattern often indicates a failed breakout and potential reversal downward.
Customizable Settings:
1. Periods (default: 10) - How many bars to check before and after the center bar (minimum value: 2)
2. Maximum Stored Fractals (default: 1) - How many fractal levels to keep in memory. Older levels are removed when this limit is reached to prevent excessive signals and maintain indicator performance.
Important Notes:
• The indicator checks the actual HIGH and LOW prices of each bar, not just closing prices
• Fractal levels are automatically removed after generating a signal to prevent repeated triggers
• Signals are only generated on bar close to avoid false triggers
• Alerts include the ticker symbol and the exact price level where the sweep occurred
Common Use Cases:
• Identifying potential reversal points
• Finding stop-hunt levels where price might reverse
• Setting stop-loss levels above up fractals or below down fractals
• Trading failed breakouts/breakdowns at fractal levels