Stochastics + Williams VixFix Master Strategy📈 Stochastics + Williams VixFix Master Strategy
A precision-built reversal detection tool that combines momentum exhaustion with volatility panic spikes to identify high-probability turning points — especially effective on daily charts for ETFs and indices.
🔍 How It Works:
✅ Buy Signal triggers when:
Stochastics %K and %D are both oversold
A bullish crossover occurs
A VixFix spike confirms market fear
❌ Sell Signal requires:
%K and %D overbought
A bearish crossover + bearish candle confirmation (lower close and red bar)
🎯 Highlights:
Relaxed signal logic to avoid missed opportunities
Filters out weak sell signals in choppy zones
Clean visuals with background color cues
Alerts ready for automation
Use this strategy to confidently spot fear-driven bottoms and euphoria-driven tops — before the herd reacts.
Regressions
Auto Trend Channel + Buy/Sell AlertsThis indicator automatically detects trend channels using a linear regression line, and dynamically plots upper and lower channel boundaries based on standard deviation. It helps traders identify potential Buy and Sell zones with clear visual signals and customizable alerts.
💡 How It Works:
🧠 Regression-Based Channel: Calculates the central trend line using ta.linreg() over a user-defined length.
📏 Dynamic Boundaries: Upper and lower channel lines are offset by a multiplier of the standard deviation for precision volatility tracking.
✅ Buy Signals: Triggered when price crosses above the lower boundary — potential bounce entry.
❌ Sell Signals: Triggered when price crosses below the upper boundary — potential reversal exit.
🔔 Alerts Enabled: Get real-time alerts when price touches the channel lines.
LDC Fib + TP + SL (Full Clean Version)LDC Fib + TP + SL Backtester (Enhanced Version)
Description:
The modified version of backtester from @jdehorty.
This script is a highly enhanced version of a Fibonacci-based backtester, originally inspired by @jdehorty's logic.
🚀 Key Features:
Entry/Exit signals based on external source (src) with full date filtering (Start Date, End Date).
Automatic calculation of Fibonacci targets (1.618, 2.618, 3.618) and Stop Loss levels.
Flexible partial take profits with user-defined percentages (TP1 / TP2 / TP3 / ML exit).
Realistic tracking of capital growth, PNL, ROI, Winrate, Profit/Loss ratio, and average gains/losses per trade.
Automatic detection of Stop Loss hits.
📈 Full visualization:
Fib levels
Stop Loss lines
TP hits marked with small circles
Debug labels showing all trade exit details.
📋 Full on-screen Dashboard (Table) with key performance metrics.
🔔 Pre-configured alerts for:
Opening Long/Short positions
Closing positions
Take Profit levels
Stop Loss activation
This backtester is designed for serious strategy refinement and visual clarity.
Perfect for those who need deep analysis and accurate performance tracking on TradingView.
🚀
Massive thanks to @jdehorty for the original inspiration!
This version pushes it even further with a clean structure, advanced stats, and professional visualization!
Ichimoku Signals PROBuy (green background):
The green background will remain until there are 2 red candles completely under the Kijun.
If the conditions change (two red candles under the Kijun), the green background is removed.
Sale (red background):
The red background will remain until there are 2 green candles completely on the Kijun.
If the conditions change (two green candles over the Kijun), the red background is removed.
Background change conditions:
We use a logic that keeps the bottom until the opposite condition is met (2 red candles under the Kijun for purchase or 2 green candles on the Kijun for sale).
网格交易v1.0### Strategy Function Overview
**Grid Trading Framework:**
- Set up 11 grid buy levels evenly distributed between `maxPrice` and `minPrice`.
- Fund allocation increases progressively with each lower grid level (weights 1–11), resulting in more buying at lower prices.
- The grid range is controlled by the `range1` parameter (default: -10%).
**Semi-Final and Final DCA (Dollar-Cost Averaging) Buys:**
- A larger buy order is triggered when the price drops to the `semifinal` level (default: -12%).
- The largest buy order is triggered when the price drops to the `final` level (default: -15%).
**Take-Profit Mechanism:**
- **Primary Take-Profit:** All holdings are sold for profit when the average entry price rises by `tp%`.
- **First Order Trailing Take-Profit:** If only the first order has been executed, a dynamic trailing take-profit is set based on ATR.
**Visualization Elements:**
- **Grid Lines and Labels:** Show the price and quantity at each buy level.
- **Price Lines:** Indicate the highest grid price, the current average entry price, and the take-profit target.
- **Event Markers:** Flag for start time, 🛑 for semi-final trigger, and 🚀 for final trigger.
TASC 2025.05 Trading The Channel█ OVERVIEW
This script implements channel-based trading strategies based on the concepts explained by Perry J. Kaufman in the article "A Test Of Three Approaches: Trading The Channel" from the May 2025 edition of TASC's Traders' Tips . The script explores three distinct trading methods for equities and futures using information from a linear regression channel. Each rule set corresponds to different market behaviors, offering flexibility for trend-following, breakout, and mean-reversion trading styles.
█ CONCEPTS
Linear regression
Linear regression is a model that estimates the relationship between a dependent variable and one or more independent variables by fitting a straight line to the observed data. In the context of financial time series, traders often use linear regression to estimate trends in price movements over time.
The slope of the linear regression line indicates the strength and direction of the price trend. For example, a larger positive slope indicates a stronger upward trend, and a larger negative slope indicates the opposite. Traders can look for shifts in the direction of a linear regression slope to identify potential trend trading signals, and they can analyze the magnitude of the slope to support trading decisions.
One caveat to linear regression is that most financial time series data does not follow a straight line, meaning a regression line cannot perfectly describe the relationships between values. Prices typically fluctuate around a regression line to some degree. As such, analysts often project ranges above and below regression lines, creating channels to model the expected extent of the data's variability. This strategy constructs a channel based on the method used in Kaufman's article. It measures the maximum distances from points on the linear regression line to historical price values, then adds those distances and the current slope to the regression points.
Depending on the trading style, traders might look for prices to move outside an established channel for breakout signals, or they might look for price action to reach extremes within the channel for potential mean reversion opportunities.
█ STRATEGY CALCULATIONS
Primary trade rules
This strategy implements three distinct sets of rules for trend, breakout, and mean-reversion trades based on the methods Kaufman describes in his article:
Trade the trend (Rule 1) : Open new positions when the sign of the slope changes, indicating a potential trend reversal. Close short trades and enter a long trade when the slope changes from negative to positive, and do the opposite when the slope changes from positive to negative.
Trade channel breakouts (Rule 2) : Open new positions when prices cross outside the linear regression channel for the current sample. Close short trades and enter a long trade when the price moves above the channel, and do the opposite when the price moves below the channel.
Trade within the channel (Rule 3) : Open new positions based on price values within the channel's range. Close short trades and enter a long trade when the price is near the channel's low, within a specified percentage of the channel's range, and do the opposite when the price is near the channel's high. With this rule, users can also filter the trades based on the channel's slope. When the filter is active, long positions are allowed only when the slope is positive, and short positions are allowed only when it is negative.
Position sizing
Kaufman's strategy uses specific trade sizes for equities and futures markets:
For an equities symbol, the number of shares traded is $10,000 divided by the current price.
For a futures symbol, the number of contracts traded is based on a volatility-adjusted formula that divides $25,000 by the product of the 20-bar average true range and the instrument's point value.
By default, this script automatically uses these sizes for its trade simulation on equities and futures symbols and does not simulate trading on other symbols. However, users can control position sizes from the "Settings/Properties" tab and enable trade simulation on other symbol types by selecting the "Manual" option in the script's "Position sizing" input.
Stop-loss
This strategy includes the option to place an accompanying stop-loss order for each trade, which users can enable from the "SL %" input in the "Settings/Inputs" tab. When enabled, the strategy places a stop-loss order at a specified percentage distance from the closing price where the entry order occurs, allowing users to compare how the strategy performs with added loss protection.
█ USAGE
This strategy adapts its display logic for the three trading approaches based on the rule selected in the "Trade rule" input:
For all rules, the script plots the linear regression slope in a separate pane. The plot is color-coded to indicate whether the current slope is positive or negative.
When the selected rule is "Trade the trend", the script plots triangles in the separate pane to indicate when the slope's direction changes from positive to negative or vice versa. Additionally, it plots a color-coded SMA on the main chart pane, allowing visual comparison of the slope to directional changes in a moving average.
When the rule is "Trade channel breakouts" or "Trade within the channel", the script draws the current period's linear regression channel on the main chart pane, and it plots bands representing the history of the channel values from the specified start time onward.
When the rule is "Trade within the channel", the script plots overbought and oversold zones between the bands based on a user-specified percentage of the channel range to indicate the value ranges where new trades are allowed.
Users can customize the strategy's calculations with the following additional inputs in the "Settings/Inputs" tab:
Start date : Sets the date and time when the strategy begins simulating trades. The script marks the specified point on the chart with a gray vertical line. The plots for rules 2 and 3 display the bands and trading zones from this point onward.
Period : Specifies the number of bars in the linear regression channel calculation. The default is 40.
Linreg source : Specifies the source series from which to calculate the linear regression values. The default is "close".
Range source : Specifies whether the script uses the distances from the linear regression line to closing prices or high and low prices to determine the channel's upper and lower ranges for rules 2 and 3. The default is "close".
Zone % : The percentage of the channel's overall range to use for trading zones with rule 3. The default is 20, meaning the width of the upper and lower zones is 20% of the range.
SL% : If the checkbox is selected, the strategy adds a stop-loss to each trade at the specified percentage distance away from the closing price where the entry order occurs. The checkbox is deselected by default, and the default percentage value is 5.
Position sizing : Determines whether the strategy uses Kaufman's predefined trade sizes ("Auto") or allows user-defined sizes from the "Settings/Properties" tab ("Manual"). The default is "Auto".
Long trades only : If selected, the strategy does not allow short positions. It is deselected by default.
Trend filter : If selected, the strategy filters positions for rule 3 based on the linear regression slope, allowing long positions only when the slope is positive and short positions only when the slope is negative. It is deselected by default.
NOTE: Because of this strategy's trading rules, the simulated results for a specific symbol or channel configuration might have significantly fewer than 100 trades. For meaningful results, we recommend adjusting the start date and other parameters to achieve a reasonable number of closed trades for analysis.
Additionally, this strategy does not specify commission and slippage amounts by default, because these values can vary across market types. Therefore, we recommend setting realistic values for these properties in the "Cost simulation" section of the "Settings/Properties" tab.
Pullback SARPullback SAR - Parabolic SAR with Pullback Detection
Description: The "Pullback SAR" is an advanced indicator built on the classic Parabolic SAR but with additional functionality for detecting pullbacks. It helps identify moments when the price pulls back from the main trend, offering potential entry signals. Perfect for traders looking to enter the market after a correction.
Key Features:
SAR (Parabolic SAR): The Parabolic SAR indicator is used to determine potential trend reversal points. It marks levels where the price could reverse its direction.
Pullback Detection: The indicator catches periods when the price moves away from the main trend and then returns, which may suggest a re-entry opportunity.
Long and Short Signals: Once a pullback in the direction of the main trend is identified, the indicator generates signals that could be used to open positions.
Simple and Clear Construction: The indicator is based on the classic SAR, with added pullback detection logic to enhance the accuracy of the signals.
Parameters:
Start (SAR Step): Determines the initial step for the SAR calculation, which controls the rate of change in the indicator at the beginning.
Increment (SAR Increment): Defines the maximum step size for SAR, allowing traders to adjust the indicator’s sensitivity to market volatility.
Max Value (SAR Max): Sets the upper limit for the SAR value, controlling its volatility.
Usage:
Swing Trading: Ideal for swing strategies, aiming to capture larger price moves while maintaining a safe margin.
Scalping: Due to its precise pullback detection, it can also be used in scalping, especially when the price quickly returns to the main trend.
Risk Management: The combination of SAR and pullback detection allows traders to adjust their positions according to changing market conditions.
Special Notes:
Adjusting Parameters: Depending on the market and trading style, users can adjust the SAR parameters (Start, Increment, Max Value) to fit their needs.
Combination with Other Indicators: It's recommended to use the indicator alongside other technical analysis tools (e.g., EMA, RSI) to enhance the accuracy of the signals.
Link to the script: This open-source version of the indicator is available on TradingView, enabling full customization and adjustments to meet your personal trading strategy. Share your experiences and suggestions!
ML Deep Regression Pro (TechnoBlooms)ML Deep Regression Pro is a machine-learning-inspired trading indicator that integrates Polynomial Regression, Linear Regression and Statistical Deviation models to provide a powerful, data-driven approach to market trend analysis.
Designed for traders, quantitative analysts and developers, this tool transforms raw market data into predictive trend insights, allowing for better decision-making and trend validation.
By leveraging statistical regression techniques, ML Deep Regression Pro eliminates market noise and identifies key trend shifts, making it a valuable addition to both manual and algorithmic trading strategies.
REGRESSION ANALYSIS
Regression is a statistical modeling technique used in machine learning and data science to identify patterns and relationships between variables. In trading, it helps detect price trends, reversals and volatility changes by fitting price data into a predictive model.
1. Linear Regression -
The most widely used regression model in trading, providing a best-fit plotted line to track price trends.
2. Polynomial Regression -
A more advanced form of regression that fits curved price structures, capturing complex market cycles and improving trend forecasting accuracy.
3. Standard Deviation Bands -
Based on regression calculations, these bands measure price dispersion and identify overbought/ oversold conditions, similar to Bollinger Bands. By default, these lines are hidden and user can make it visible through Settings.
KEY FEATURES :-
✅ Hybrid Regression Engine – Combines Linear and Polynomial Regression to detect market trends with greater accuracy.
✅ Dynamic Trend Bias Analysis – Identifies bullish & bearish market conditions using real-time regression models.
✅ Standard Deviation Bands – Measures price volatility and potential reversals with an advanced deviation model.
✅ Adaptive EMA Crossover Signals – Generates buy/sell signals when price momentum shifts relative to the regression trend.
Adaptive Trend FinderAdaptive Trend Finder - The Ultimate Trend Detection Tool
Introducing Adaptive Trend Finder, the next evolution of trend analysis on TradingView. This powerful indicator is an enhanced and refined version of Adaptive Trend Finder (Log), designed to offer even greater flexibility, accuracy, and ease of use.
What’s New?
Unlike the previous version, Adaptive Trend Finder allows users to fully configure and adjust settings directly within the indicator menu, eliminating the need to modify chart settings manually. A major improvement is that users no longer need to adjust the chart's logarithmic scale manually in the chart settings; this can now be done directly within the indicator options, ensuring a smoother and more efficient experience. This makes it easier to switch between linear and logarithmic scaling without disrupting the analysis. This provides a seamless user experience where traders can instantly adapt the indicator to their needs without extra steps.
One of the most significant improvements is the complete code overhaul, which now enables simultaneous visualization of both long-term and short-term trend channels without needing to add the indicator twice. This not only improves workflow efficiency but also enhances chart readability by allowing traders to monitor multiple trend perspectives at once.
The interface has been entirely redesigned for a more intuitive user experience. Menus are now clearer, better structured, and offer more customization options, making it easier than ever to fine-tune the indicator to fit any trading strategy.
Key Features & Benefits
Automatic Trend Period Selection: The indicator dynamically identifies and applies the strongest trend period, ensuring optimal trend detection with no manual adjustments required. By analyzing historical price correlations, it selects the most statistically relevant trend duration automatically.
Dual Channel Display: Traders can view both long-term and short-term trend channels simultaneously, offering a broader perspective of market movements. This feature eliminates the need to apply the indicator twice, reducing screen clutter and improving efficiency.
Fully Adjustable Settings: Users can customize trend detection parameters directly within the indicator settings. No more switching chart settings – everything is accessible in one place.
Trend Strength & Confidence Metrics: The indicator calculates and displays a confidence score for each detected trend using Pearson correlation values. This helps traders gauge the reliability of a given trend before making decisions.
Midline & Channel Transparency Options: Users can fine-tune the visibility of trend channels, adjusting transparency levels to fit their personal charting style without overwhelming the price chart.
Annualized Return Calculation: For daily and weekly timeframes, the indicator provides an estimate of the trend’s performance over a year, helping traders evaluate potential long-term profitability.
Logarithmic Adjustment Support: Adaptive Trend Finder is compatible with both logarithmic and linear charts. Traders who analyze assets like cryptocurrencies, where log scaling is common, can enable this feature to refine trend calculations.
Intuitive & User-Friendly Interface: The updated menu structure is designed for ease of use, allowing quick and efficient modifications to settings, reducing the learning curve for new users.
Why is this the Best Trend Indicator?
Adaptive Trend Finder stands out as one of the most advanced trend analysis tools available on TradingView. Unlike conventional trend indicators, which rely on fixed parameters or lagging signals, Adaptive Trend Finder dynamically adjusts its settings based on real-time market conditions. By combining automatic trend detection, dual-channel visualization, real-time performance metrics, and an intuitive user interface, this indicator offers an unparalleled edge in trend identification and trading decision-making.
Traders no longer have to rely on guesswork or manually tweak settings to identify trends. Adaptive Trend Finder does the heavy lifting, ensuring that users are always working with the strongest and most reliable trends. The ability to simultaneously display both short-term and long-term trends allows for a more comprehensive market overview, making it ideal for scalpers, swing traders, and long-term investors alike.
With its state-of-the-art algorithms, fully customizable interface, and professional-grade accuracy, Adaptive Trend Finder is undoubtedly one of the most powerful trend indicators available.
Try it today and experience the future of trend analysis.
This indicator is a technical analysis tool designed to assist traders in identifying trends. It does not guarantee future performance or profitability. Users should conduct their own research and apply proper risk management before making trading decisions.
// Created by Julien Eche - @Julien_Eche
CAPM Alpha & BetaThe CAPM Alpha & Beta indicator is a crucial tool in finance and investment analysis derived from the Capital Asset Pricing Model (CAPM) . It provides insights into an asset's risk-adjusted performance (Alpha) and its relationship to broader market movements (Beta). Here’s a breakdown:
1. How Does It Work?
Alpha:
Definition: Alpha measures the portion of an investment's return that is not explained by market movements, i.e., the excess return over and above what the market is expected to deliver.
Purpose: It represents the value a fund manager or strategy adds (or subtracts) from an investment’s performance, adjusting for market risk.
Calculation:
Alpha is derived from comparing actual returns to expected returns predicted by CAPM:
Alpha = Actual Return − (Risk-Free Rate + β × (Market Return − Risk-Free Rate))
Alpha = Actual Return − (Risk-Free Rate + β × (Market Return − Risk-Free Rate))
Interpretation:
Positive Alpha: The investment outperformed its CAPM prediction (good performance for additional value/risk).
Negative Alpha: The investment underperformed its CAPM prediction.
Beta:
Definition: Beta measures the sensitivity of an asset's returns relative to the overall market's returns. It quantifies systematic risk.
Purpose: Indicates how volatile or correlated an investment is relative to the market benchmark (e.g., S&P 500).
Calculation:
Beta is computed as the ratio of the covariance of the asset and market returns to the variance of the market returns:
β = Covariance (Asset Return, Market Return) / Variance (Market Return)
β = Variance (Market Return) Covariance (Asset Return, Market Return)
Interpretation:
Beta = 1: The asset’s price moves in line with the market.
Beta > 1: The asset is more volatile than the market (higher risk/higher potential reward).
Beta < 1: The asset is less volatile than the market (lower risk/lower reward).
Beta < 0: The asset moves inversely to the market.
2. How to Use It?
Using Alpha:
Portfolio Evaluation: Investors use Alpha to gauge whether a portfolio manager or a strategy has successfully outperformed the market on a risk-adjusted basis.
If Alpha is consistently positive, the portfolio may deliver higher-than-expected returns for the given level of risk.
Stock/Asset Selection: Compare Alpha across multiple securities. Positive Alpha signals that the asset may be a good addition to your portfolio for excess returns.
Adjusting Investment Strategy: If Alpha is negative, reassess the asset's role in the portfolio and refine strategies.
Using Beta:
Risk Management:
A high Beta (e.g., 1.5) indicates higher sensitivity to market movements. Use such assets if you want to take on more risk during bullish market phases or expect higher returns.
A low Beta (e.g., 0.7) indicates stability and is useful in diversifying risk in volatile or bearish markets.
Portfolio Diversification: Combine assets with varying Betas to achieve the desired level of market responsiveness and smooth out portfolio volatility.
Monitoring Systematic Risk: Beta helps identify whether an investment aligns with your risk tolerance. For example, high-Beta stocks may not be suitable for conservative investors.
Practical Application:
Use both Alpha and Beta together:
Assess performance with Alpha (excess returns).
Assess risk exposure with Beta (market sensitivity).
Example: A stock with a Beta of 1.2 and a highly positive Alpha might suggest a solid performer that is slightly more volatile than the market, making it a suitable pick for risk-tolerant, return-maximizing investors.
In conclusion, the CAPM Alpha & Beta indicator gives a comprehensive view of an asset's performance and risk. Alpha enables performance evaluation on a risk-adjusted basis, while Beta reveals the level of market risk. Together, they help investors make informed decisions, build optimal portfolios, and align investments with their risk-return preferences.
Simple APF Strategy Backtesting [The Quant Science]Simple backtesting strategy for the quantitative indicator Autocorrelation Price Forecasting. This is a Buy & Sell strategy that operates exclusively with long orders. It opens long positions and generates profit based on the future price forecast provided by the indicator. It's particularly suitable for trend-following trading strategies or directional markets with an established trend.
Main functions
1. Cycle Detection: Utilize autocorrelation to identify repetitive market behaviors and cycles.
2. Forecasting for Backtesting: Simulate trades and assess the profitability of various strategies based on future price predictions.
Logic
The strategy works as follow:
Entry Condition: Go long if the hypothetical gain exceeds the threshold gain (configurable by user interface).
Position Management: Sets a take-profit level based on the future price.
Position Sizing: Automatically calculates the order size as a percentage of the equity.
No Stop-Loss: this strategy doesn't includes any stop loss.
Example Use Case
A trader analyzes a dayli period using 7 historical bars for autocorrelation.
Sets a threshold gain of 20 points using a 5% of the equity for each trade.
Evaluates the effectiveness of a long-only strategy in this period to assess its profitability and risk-adjusted performance.
User Interface
Length: Set the length of the data used in the autocorrelation price forecasting model.
Thresold Gain: Minimum value to be considered for opening trades based on future price forecast.
Order Size: percentage size of the equity used for each single trade.
Strategy Limit
This strategy does not use a stop loss. If the price continues to drop and the future price forecast is incorrect, the trader may incur a loss or have their capital locked in the losing trade.
Disclaimer!
This is a simple template. Use the code as a starting point rather than a finished solution. The script does not include important parameters, so use it solely for educational purposes or as a boilerplate.
Ethereum Logarithmic Regression Bands (Fine-Tuned)This indicator, "Ethereum Logarithmic Regression Bands (Fine-Tuned)," is my attempt to create a tool for estimating long-term trends in Ethereum (ETH/USD) price action using logarithmic regression bands. Please note that I am not an expert in financial modeling or coding—I developed this as a personal project to serve as a rough estimation rather than a precise or professional trading tool. The data was fitted to non-bubble periods of Ethereum's history to provide a general trendline, but it’s far from perfect.
I’m sharing this because I couldn’t find a similar indicator available, and I thought it might be useful for others who are also exploring ETH’s long-term behavior. The bands start from Ethereum’s launch price and are adjustable via input parameters, but they are based on my best effort to align with historical data. With some decent coding experience, I’m sure someone could refine this further—perhaps by optimizing the coefficients or incorporating more advanced fitting techniques. Feel free to tweak the code, suggest improvements, or use it as a starting point for your own projects!
How to Use:
** THIS CHART IS SPECIFICALLY CODED FOR ETH/USD (KRAKEN) ON THE WEEKLY TIMEFRAME IN LOG VIEW**
The main band (blue) represents the logarithmic regression line.
The upper (red) and lower (green) bands provide a range around the main trend, adjustable with multipliers.
Adjust the "Launch Price," "Base Coefficient," "Growth Coefficient," and other inputs to experiment with different fits.
Disclaimer:
This is not financial advice. Use at your own risk, and always conduct your own research before making trading decisions.
ICT Session by LasinsName: ICT Session by Lasins
Purpose: To visually identify and differentiate between the Asian, London, and New York trading sessions on the chart.
Features:
Highlights the background of the chart during each session.
Includes a mini dashboard in the top-right corner to show the active session.
Allows customization of time zones (exchange timezone or UTC).
Displays copyright and author information.
Key Components
Inputs:
useExchangeTimezone: A boolean input to toggle between using the exchange timezone or UTC for session times.
showDashboard: A boolean input to toggle the visibility of the mini dashboard.
Session Times:
The script defines three trading sessions:
Asian Session: 2000-0000 UTC (or adjusted for exchange timezone).
London Session: 0200-0500 UTC (or adjusted for exchange timezone).
New York Session: 0700-1000 UTC (or adjusted for exchange timezone).
Session Detection:
The is_session function checks if the current time falls within a specified session using the time function.
Background Coloring:
The bgcolor function is used to highlight the chart background during each session:
Asian Session: Red background.
London Session: Green background.
New York Session: Blue background.
Mini Dashboard:
A table is created in the top-right corner of the chart to display the active session and its corresponding color.
The dashboard includes:
A header row with "Session" and "Color".
Rows for each session (Asian, London, New York) with their respective colors.
Copyright and Author Information:
A label is added to the chart to display the copyright and author information ("© ICT Session by Lasins Raj").
How It Works
The script checks the current time and compares it to the predefined session times.
If the current time falls within a session, the chart background is highlighted with the corresponding color.
The mini dashboard updates to reflect the active session.
The copyright and author information is displayed at the bottom of the chart.
Customization
You can adjust the session times in the script to match your preferred timezone or trading hours.
The useExchangeTimezone input allows you to switch between UTC and the exchange timezone.
The showDashboard input lets you toggle the visibility of the mini dashboard.
Example Use Case
Traders who follow the ICT (Inner Circle Trader) methodology can use this indicator to identify key trading sessions and plan their trades accordingly.
The visual representation of sessions helps traders quickly recognize when major markets are open and active.
TASC 2025.03 A New Solution, Removing Moving Average Lag█ OVERVIEW
This script implements a novel technique for removing lag from a moving average, as introduced by John Ehlers in the "A New Solution, Removing Moving Average Lag" article featured in the March 2025 edition of TASC's Traders' Tips .
█ CONCEPTS
In his article, Ehlers explains that the average price in a time series represents a statistical estimate for a block of price values, where the estimate is positioned at the block's center on the time axis. In the case of a simple moving average (SMA), the calculation moves the analyzed block along the time axis and computes an average after each new sample. Because the average's position is at the center of each block, the SMA inherently lags behind price changes by half the data length.
As a solution to removing moving average lag, Ehlers proposes a new projected moving average (PMA) . The PMA smooths price data while maintaining responsiveness by calculating a projection of the average using the data's linear regression slope.
The slope of linear regression on a block of financial time series data can be expressed as the covariance between prices and sample points divided by the variance of the sample points. Ehlers derives the PMA by adding this slope across half the data length to the SMA, creating a first-order prediction that substantially reduces lag:
PMA = SMA + Slope * Length / 2
In addition, the article includes methods for calculating predictions of the PMA and the slope based on second-order and fourth-order differences. The formulas for these predictions are as follows:
PredictPMA = PMA + 0.5 * (Slope - Slope ) * Length
PredictSlope = 1.5 * Slope - 0.5 * Slope
Ehlers suggests that crossings between the predictions and the original values can help traders identify timely buy and sell signals.
█ USAGE
This indicator displays the SMA, PMA, and PMA prediction for a specified series in the main chart pane, and it shows the linear regression slope and prediction in a separate pane. Analyzing the difference between the PMA and SMA can help to identify trends. The differences between PMA or slope and its corresponding prediction can indicate turning points and potential trade opportunities.
The SMA plot uses the chart's foreground color, and the PMA and slope plots are blue by default. The plots of the predictions have a green or red hue to signify direction. Additionally, the indicator fills the space between the SMA and PMA with a green or red color gradient based on their differences:
Users can customize the source series, data length, and plot colors via the inputs in the "Settings/Inputs" tab.
█ NOTES FOR Pine Script® CODERS
The article's code implementation uses a loop to calculate all necessary sums for the slope and SMA calculations. Ported into Pine, the implementation is as follows:
pma(float src, int length) =>
float PMA = 0., float SMA = 0., float Slope = 0.
float Sx = 0.0 , float Sy = 0.0
float Sxx = 0.0 , float Syy = 0.0 , float Sxy = 0.0
for count = 1 to length
float src1 = src
Sx += count
Sy += src
Sxx += count * count
Syy += src1 * src1
Sxy += count * src1
Slope := -(length * Sxy - Sx * Sy) / (length * Sxx - Sx * Sx)
SMA := Sy / length
PMA := SMA + Slope * length / 2
However, loops in Pine can be computationally expensive, and the above loop's runtime scales directly with the specified length. Fortunately, Pine's built-in functions often eliminate the need for loops. This indicator implements the following function, which simplifies the process by using the ta.linreg() and ta.sma() functions to calculate equivalent slope and SMA values efficiently:
pma(float src, int length) =>
float Slope = ta.linreg(src, length, 0) - ta.linreg(src, length, 1)
float SMA = ta.sma(src, length)
float PMA = SMA + Slope * length * 0.5
To learn more about loop elimination in Pine, refer to this section of the User Manual's Profiling and optimization page.
UM-Optimized Linear Regression ChannelDESCRIPTION
This indicator was inspired by Dr. Stoxx at drstoxx.com. Shout out to him and his services for introducing me to this idea. This indicator is a slightly different take on the standard linear regression indicator.
It uses two standard deviations to draw bands and dynamically attempts to best-fit the data lookback period using an R-squared statistical measure. The R-squared value ranges between zero and one with zero being no fit to the data at all and 1 being a 100% match of the data to linear regression line. The R-squared calculation is weighted exponentially to give more weight to the most recent data.
The label provides the number of periods identified as the optimal best-fit period, the type of loopback period determination (Manual or Auto) and the R-squared value (0-100, 100% being a perfect fit). >=90% is a great fit of the data to the regression line. <50% is a difficult fit and more or less considered random data.
The lookback mode can also be set manually and defaults to a value of 100 periods.
DEFAULTS
The defaults are 1.5 and 2.0 for standard deviation. This creates 2 bands above and below the regression line. The default mode for best-fit determination with "Auto" selected in the dropdown. When manual mode is selected, the default is 100. The modes, manual lookback periods, colors, and standard deviations are user-configurable.
HOW TO USE
Overlay this indicator on any chart of any timeframe. Look for turning points at extremes in the upper and lower bands. Look for crossovers of the centerline. Look at the Auto-determination for best fit. Compare this to your favorite Manual mode setting (Manual Mode is set to 100 by default lookback periods.)
When price is at an extreme, look for turnarounds or reversals. Use your favorite indicators, in addition to this indicator, to determine reversals. Try this indicator against your favorite securities and timeframes.
CHART EXAMPLE
The chart I used for an example is the daily chart of IWM. I illustrated the extremes with white text. This is where I consider proactively exiting an existing position and/or begin looking for a reversal.
CandelaCharts - Fib Retracement (OTE) 📝 Overview
The CandelaCharts Fib Retracement (OTE) indicator is a precision tool designed to help traders identify Optimal Trade Entry (OTE) levels based on Fibonacci retracement principles, as taught in ICT (Inner Circle Trader) methodology.
This indicator automatically plots Fibonacci retracement levels between a selected swing high and swing low, highlighting the key OTE zone between the 61.8% and 78.6% retracement levels—a prime area for potential reversals in trending markets.
📦 Features
Automatic & Custom lookback modes
Customizable fib levels
Dynamic coloring
Reverse & extend
⚙️ Settings
Lookback: Controls the number of bars to look back. You can choose between **Automatic** or **Custom** mode.
Line Style: Sets the line style for the Fibonacci levels.
Levels: 0, 0.236, 0.0.382, 0.500, 0.620, 0.705, 0.790, 0.886, 1.000. Allows you to toggle the visibility of Fibonacci levels.
Dynamic Coloring: Colors Fibonacci levels according to trend direction.
Show Labels: Shows the price value at each Fibonacci level.
Reverse: Flips the Fibonacci levels in the opposite direction.
Extend Left: Extends the Fibonacci levels to the left.
⚡️ Showcase
Dynamic Coloring
Manual Coloring
Fib Retracement
Extended
Custom Length
📒 Usage
Using the CandelaCharts Fib Retracement (OTE) is pretty straightforward—just follow these steps to spot high-probability trade setups and refine your entries.
Identify the Trend – Determine whether the market is in an uptrend or downtrend.
Select Swing Points – The indicator automatically plots from the most recent swing high to swing low (or vice versa).
Wait for Price to Enter OTE Zone – Look for price action confirmation within the optimal entry zone (61.8%-78.6%).
Enter the Trade – Consider longs in an uptrend at the OTE zone, and shorts in a downtrend.
Set Stop & Target – Place stops below/above the swing low/high and target extension levels (127.2%, 161.8%).
🎯 Key takeways
The CandelaCharts Fib Retracement (OTE) is a must-have tool for traders looking to refine their entries and maximize risk-reward potential with precision-based ICT trading strategies. 🚀
🚨 Alerts
The indicator does not provide any alerts!
⚠️ 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.
MOKI V1The "MOKI V1" script is a trading strategy on the TradingView platform that uses a combination of two key indicators to identify buy and sell signals:
EMA200 (Exponential Moving Average 200): Used to determine the overall market trend. This line helps ensure that trades are made in the direction of the primary market trend.
RSI (Relative Strength Index): Used to measure the strength or weakness of a trend. In this strategy, a reading above 50 for the RSI indicates stronger buy signals.
Engulfing Pattern: This candlestick pattern occurs when a green (bullish) candle completely engulfs the previous red (bearish) candle. It is used as a buy signal when combined with the other indicators.
Pearson Correlation CoefficientDescription: The Pearson Correlation Coefficient measures the strength and direction of the linear relationship between two data series. Its value ranges from -1 to +1, where:
+1 indicates a perfect positive linear correlation: as one asset increases, the other asset increases proportionally.
0 indicates no linear correlation: variations in one asset have no relation to variations in the other asset.
-1 indicates a perfect negative linear correlation: as one asset increases, the other asset decreases proportionally.
This measure is widely used in technical analysis to assess the degree of correlation between two financial assets. The "Pearson Correlation (Manual Compare)" indicator allows users to manually select two assets and visually display their correlation relationship on a chart.
Features:
Correlation Period: The time period used for calculating the correlation can be adjusted (default: 50).
Comparison Asset: Users can select a secondary asset for comparison.
Visual Plots: The chart includes reference lines for perfect correlations (+1 and -1) and strong correlations (+0.7 and -0.7).
Alerts: Set alerts for when the correlation exceeds certain threshold values (e.g., +0.7 for strong positive correlation).
How to Select the Second Asset:
Primary Asset Selection: The primary asset is the one you select for viewing on the chart. This can be done by simply opening the chart for the desired asset.
Secondary Asset Selection: To select the secondary asset for comparison, use the input field labeled "Comparison Asset" in the script settings. You can manually enter the ticker symbol of the secondary asset you want to compare with the primary asset.
This indicator is ideal for traders looking to identify relationships and correlations between different financial assets to make informed trading decisions.
Statistical Arbitrage Pairs Trading - Long-Side OnlyThis strategy implements a simplified statistical arbitrage (" stat arb ") approach focused on mean reversion between two correlated instruments. It identifies opportunities where the spread between their normalized price series (Z-scores) deviates significantly from historical norms, then executes long-only trades anticipating reversion to the mean.
Key Mechanics:
1. Spread Calculation: The strategy computes Z-scores for both instruments to normalize price movements, then tracks the spread between these Z-scores.
2. Modified Z-Score: Uses a robust measure combining the median and Median Absolute Deviation (MAD) to reduce outlier sensitivity.
3. Entry Signal: A long position is triggered when the spread’s modified Z-score falls below a user-defined threshold (e.g., -1.0), indicating extreme undervaluation of the main instrument relative to its pair.
4. Exit Signal: The position closes automatically when the spread reverts to its historical mean (Z-score ≥ 0).
Risk management:
Trades are sized as a percentage of equity (default: 10%).
Includes commissions and slippage for realistic backtesting.
VFV Correction Levels
This Pine Script, "VFV Correction Levels," identifies significant daily price corrections and calculates corresponding investments based on fixed thresholds (paliers). Key features include:
Six predefined correction levels trigger investments between $150 and $600 based on the percentage drop.
Larger corrections correspond to higher investment amounts.
Graphical Indicators:
Visual labels mark correction levels and display investment amounts directly on the chart.
Investment Tracking:
Calculates total invested and tracks performance (yield percentage) relative to the initial correction price.
Smoothed Gaussian Trend Filter [AlgoAlpha]Experience seamless trend detection and market analysis with the Smoothed Gaussian Trend Filter by AlgoAlpha! This cutting-edge indicator combines advanced Gaussian filtering with linear regression smoothing to identify and enhance market trends, making it an essential tool for traders seeking precise and actionable signals.
Key Features :
🔍 Gaussian Trend Filtering: Utilizes a customizable Gaussian filter with adjustable length and pole settings for tailored smoothing and trend identification.
📊 Linear Regression Smoothing: Reduces noise and further refines the Gaussian output with user-defined smoothing length and offset, ensuring clarity in trend representation.
✨ Dynamic Visual Highlights: Highlights trends and signals based on volume intensity, allowing for real-time insights into market behavior.
📉 Choppy Market Detection: Identifies ranging or choppy markets, helping traders avoid false signals.
🔔 Custom Alerts: Set alerts for bullish and bearish signals, trend reversals, or choppy market conditions to stay on top of trading opportunities.
🎨 Color-Coded Visuals: Fully customizable colors for bullish and bearish signals, ensuring clear and intuitive chart analysis.
How to Use :
Add the Indicator: Add it to your favorites and apply it to your TradingView chart.
Interpret the Chart: Observe the trend line for directional changes and use the accompanying buy/sell signals for entry and exit opportunities. Choppy market conditions are flagged for additional caution.
Set Alerts: Enable alerts for trend signals or choppy market detections to act promptly without constant chart monitoring.
How It Works :
The Smoothed Gaussian Trend Filter uses a combination of advanced smoothing techniques to identify trends and enhance market clarity. First, a Gaussian filter is applied to price data, using a user-defined length (Gaussian length) and poles (smoothness level) to calculate an alpha value that determines the degree of smoothing. This creates a refined trend line that minimizes noise while preserving key market movements. The output is then further processed using linear regression smoothing, allowing traders to adjust the length and offset to flatten minor oscillations and emphasize the dominant trend. To incorporate market activity, volume intensity is analyzed through a normalized Hull Moving Average (HMA), dynamically adjusting the trend line's color transparency based on trading activity. The indicator also identifies trend direction by comparing the smoothed trend line with a calculated SuperTrend-style level, generating clear trend regimes and highlighting ranging or choppy conditions where trends are less reliable and avoiding false signals. This seamless integration of Gaussian smoothing, regression analysis, and volume dynamics provides traders with a powerful and intuitive tool for market analysis.