Effective FVG Indicator - ImranDescription:
The Effective FVG Indicator is a technical analysis tool designed to identify Fair Value Gaps (FVGs) in financial markets. FVGs occur when there is a significant gap between the closing price of one session and the opening price of the next session, often indicating a potential reversal point. This indicator uses volume and price movement criteria to confirm and mark these gaps effectively.
Key Features:
Fair Value Gap Detection : Identifies both bullish and bearish FVGs based on significant gaps in price.
Volume Confirmation : Confirms FVGs with high volume, ensuring that the gap is not due to a lack of liquidity.
Price Imbalance : Ensures that the gap is accompanied by a large price movement within the session, indicating strong market sentiment.
Buy/Sell Signals : Marks bullish FVGs with a green "BUY" label below the bar and bearish FVGs with a red "SELL" label above the bar.
Background Highlighting : Highlights the background with a semi-transparent green or red color when a valid FVG is detected, making it easy to spot significant gaps.
אינדיקטורים ואסטרטגיות
US 20Y Treasury YieldWhat This Indicator Does
This Pine Script creates a custom indicator for TradingView that displays the US 20-Year Treasury Yield (US20Y) on your chart. Here's what it does step by step:
1. What Is the US 20-Year Treasury Yield?
The US 20-Year Treasury Yield is a financial metric that shows the interest rate (or yield) investors earn when they buy US government bonds that mature in 20 years. It’s an important indicator of the economy and can influence other markets like stocks, bonds, and currencies.
2. How Does the Indicator Work?
The indicator fetches the latest data for the US 20-Year Treasury Yield from TradingView's database.
It then plots this data in a separate pane below your main chart, so you can easily monitor the yield without cluttering your price chart.
3. What Does the Indicator Show?
A blue line is drawn in the separate pane, showing the movement of the US 20-Year Treasury Yield over time.
A gray dashed line is added at the 4.0% level as a reference point. You can use this line to quickly see when the yield is above or below 4.0%.
5. Why Use This Indicator?
Monitor Economic Trends : The US 20-Year Treasury Yield is a key economic indicator. By plotting it on your chart, you can stay informed about changes in interest rates and their potential impact on other markets.
Ultimate Gold Correlation Matrix (Extended)This is a correlation matrix to help you visually understand the relationship between stocks. This is the correlation of the amount of change.
The color changes depending on the value of the correlation value.
By making a node diagram of this relationship, what has been difficult to understand may become clearer.
Good luck.
1. meaning of correlation coefficient
Correlation Coefficient ranges from -1 to +1.
Correlation Coefficient Value Interpretation
+1.00 Perfect positive correlation (when one goes up, the other always goes up)
+0.75 ~ +0.99 Strong positive correlation (fairly well linked)
+0.50 ~ +0.74 Moderate positive correlation
+0.30 ~ +0.49 Weak positive correlation
-0.30 ~ +0.30 No correlation (no or weak relationship)
-0.50 ~ -0.74 Moderate negative correlation
-0.75 ~ -0.99 Strong negative correlation (when one goes up, the other goes down)
-1.00 Perfect negative correlation (opposite moves)
Translated with www.DeepL.com (free version)
Ultimate Gold Correlation Matrix (Extended)This is a correlation matrix to help you visually understand the relationship between stocks. This is the correlation of the amount of change.
The color changes depending on the value of the correlation value.
By drawing a node diagram of this relationship, you may be able to clarify what has been difficult to understand so far.
Pivot Points DWMWhat Is a Pivot Point?
A pivot point is a price level calculated from previous prices. It's used to indicate potential areas of support or resistance that offer attractive reward-to-risk setups for trades. The pivot point itself is simply the average of the intraday high and low and the closing price from the previous trading day. Trading above the pivot point on the subsequent day is thought to indicate ongoing bullish sentiment. Trading below the pivot point indicates bearish sentiment.
Non-Repainting
Candlestick Pattern Detector - Vijay PrasadOverview:
This Pine Script v6 indicator is designed to detect and label key candlestick patterns on TradingView charts. It provides real-time visual markers for major bullish and bearish reversal signals, aiding traders in decision-making.
Usefulness:
✅ Saves time by automating candlestick pattern detection.
✅ Reduces manual chart analysis errors.
✅ Works across all markets & timeframes.
✅ Enhances trading strategies with accurate signals.
Candlestick Patterns Recognises:
Bullish Engulfing – A strong bullish reversal pattern.
Bearish Engulfing – Indicates a potential downtrend.
Hammer – Suggests a market bottom or reversal.
Shooting Star – A bearish reversal signal at the top of an uptrend.
Doji – Signals market indecision and possible trend change.
Key Functions:
Automated Pattern Visible
Identifies candlestick patterns dynamically and plots them on the chart.
Visual Labels for Patterns
Labels to indicate specific candlestick formations.
Labels appear only when a valid pattern is detected, avoiding unnecessary clutter.
Buy/Sell Signal
Plots buy signals at bullish patterns and sell signals at bearish patterns.
Helps traders recognize trend reversals and entry/exit points.
Bullish Engulfing Pattern (Green Label)
What it means: A bullish engulfing pattern typically signals a potential reversal from a downtrend to an uptrend. The current candle fully engulfs the previous candle, signaling strong buying interest.
Identifying Candlestick Patterns on the Chart
How to use it:
Entry: Look for a green label (bullish engulfing) at the bottom of the chart. When it appears, consider entering a long position (buy).
Confirmation: To increase reliability, wait for confirmation by observing if price moves above the high of the bullish engulfing candle.
Exit: Exit when the trend shows signs of reversing or take profit at predefined levels (e.g., resistance or a risk-to-reward ratio).
Bearish Engulfing Pattern (Red Label)
What it means: A bearish engulfing pattern is a signal of a potential reversal from an uptrend to a downtrend. The current candle fully engulfs the previous candle, signaling strong selling pressure.
How to use it:
Entry: Look for a red label (bearish engulfing) at the top of the chart. When it appears, consider entering a short position (sell).
Confirmation: Wait for the price to move below the low of the bearish engulfing candle to confirm the bearish trend.
Exit: Close the trade when the price reaches support levels or the trend shows signs of reversing.
Doji Pattern (Blue Circle)
What it means: A Doji candle signals market indecision. It represents a balance between buyers and sellers, often marking a potential reversal or consolidation point.
How to use it:
Entry: If the Doji appears after a strong trend (bullish or bearish), wait for the next candle to break above or below the Doji's high or low. This can signal a continuation or reversal.
Confirmation: You can look for additional indicators like moving averages, RSI, or MACD for confirmation before taking any action.
Exit: Exit when the price shows clear momentum in your entry direction.
Hammer Pattern (Orange Triangle)
What it means: The hammer pattern is a bullish reversal pattern that appears after a downtrend. It suggests that sellers pushed the price down during the session, but buyers managed to push the price back up.
How to use it:
Entry: When a hammer appears, consider entering a long position (buy). The price should move above the hammer's high for confirmation.
Confirmation: Look for strong volume and a follow-up bullish candle to confirm the reversal.
Exit: Set a target based on the next resistance level, or use a trailing stop to lock in profits.
Using Candlestick Patterns with Other Indicators
To increase your chances of success, combine candlestick patterns with other technical indicators.
Here are some ideas:
RSI (Relative Strength Index): Use RSI to check whether the market is overbought or oversold. A bullish engulfing in an oversold market could indicate a stronger buy signal, and a bearish engulfing in an overbought market could indicate a stronger sell signal.
Moving Averages (e.g., 50 EMA, 200 EMA): Confirm trend direction. If the candlestick pattern aligns with the direction of the moving averages, it can give a stronger signal.
MACD (Moving Average Convergence Divergence): Use MACD to confirm momentum and potential trend changes. If a candlestick pattern aligns with a MACD crossover, it strengthens the signal.
Volume: Look for higher-than-average volume when a pattern appears. This can give you additional confirmation that the market is reacting strongly.
Practice and Refine
It's important to practice using the candlestick patterns in a demo account or backtest them to see how they perform under different market conditions. Over time, you can adjust the settings and patterns to fit your trading style and preferences.
TradFi Fundamentals: Momentum Trading with Macroeconomic DataIntroduction
This indicator combines traditional price momentum with key macroeconomic data. By retrieving GDP, inflation, unemployment, and interest rates using security calls, the script automatically adapts to the latest economic data. The goal is to blend technical analysis with fundamental insights to generate a more robust momentum signal.
Original Research Paper by Mohit Apte, B. Tech Scholar, Department of Computer Science and Engineering, COEP Technological University, Pune, India
Link to paper
Explanation
Price Momentum Calculation:
The indicator computes price momentum as the percentage change in price over a configurable lookback period (default is 50 days). This raw momentum is then normalized using a rolling simple moving average and standard deviation over a defined period (default 200 days) to ensure comparability with the economic indicators.
Fetching and Normalizing Economic Data:
Instead of manually inputting economic values, the script uses TradingView’s security function to retrieve:
GDP from ticker "GDP"
Inflation (CPI) from ticker "USCCPI"
Unemployment rate from ticker "UNRATE"
Interest rates from ticker "USINTR"
Each series is normalized over a configurable normalization period (default 200 days) by subtracting its moving average and dividing by its standard deviation. This standardization converts each economic indicator into a z-score for direct integration into the momentum score.
Combined Momentum Score:
The normalized price momentum and economic indicators are each multiplied by user-defined weights (default: 50% price momentum, 20% GDP, and 10% each for inflation, unemployment, and interest rates). The weighted components are then summed to form a comprehensive momentum score. A horizontal zero line is plotted for reference.
Trading Signals:
Buy signals are generated when the combined momentum score crosses above zero, and sell signals occur when it crosses below zero. Visual markers are added to the chart to assist with trade timing, and alert conditions are provided for automated notifications.
Settings
Price Momentum Lookback: Defines the period (in days) used to compute the raw price momentum.
Normalization Period for Price Momentum: Sets the window over which the price momentum is normalized.
Normalization Period for Economic Data: Sets the window over which each macroeconomic series is normalized.
Weights: Adjust the influence of each component (price momentum, GDP, inflation, unemployment, and interest rate) on the overall momentum score.
Conclusion
This implementation leverages TradingView’s economic data feeds to integrate real-time macroeconomic data into a momentum trading strategy. By normalizing and weighting both technical and economic inputs, the indicator offers traders a more holistic view of market conditions. The enhanced momentum signal provides additional context to traditional momentum analysis, potentially leading to more informed trading decisions and improved risk management.
The next script I release will be an improved version of this that I have added my own flavor to, improving the signals.
Footprint IQ Pro [TradingIQ]Hello Traders!
Introducing "Footprint IQ Pro"!
Footprint IQ Pro is an all-in-one Footprint indicator with several unique features.
Features
Calculated delta at tick level
Calculated delta ratio at tick level
Calculated buy volume at tick level
Calculated sell volume at tick level
Imbalance detection
Stacked imbalance detection
Stacked imbalance alerts
Value area and POC detection
Highest +net delta levels detection
Lowest -net delta levels detection
CVD by tick levels
Customizable values area percentage
The image above thoroughly outlines what each metric in the delta boxes shows!
Metrics In Delta Boxes
"δ:", " δ%:", " ⧎: ", " ◭: ", " ⧩: "
δ Delta (Difference between buy and sell volume)
δ% Delta Ratio (Delta as a percentage of total volume)
⧎ Total Volume At Level (Total volume at the price area)
◭ Total Buy Volume At Level (Total buy volume at the price area)
⧩ Total Sell Volume At Level (total sell volume at the price area)
Each metric comes with a corresponding symbol.
That said, until you become comfortable with the symbol, you can also turn on the descriptive labels setting!
The image above exemplifies the feature.
The image above shows Footprint IQ's full power!
Additionally, traders with an upgraded TradingView plan can make use of the "1-Second" feature Footprint IQ offers!
The image above shows each footprint generated using 1-second volume data. 1-second data is highly granular compared to 1-minute data and, consequently, each footprint is exceptionally more accurate!
Imbalance Detection
Footprint IQ pro is capable of detecting user-defined delta imbalances.
The image above further explains how Footprint IQ detects imbalances!
The imbalance percentage is customizable in the settings, and is set to 70% by default.
Therefore,
When net delta is positive, and the positive net delta constitutes >=70% of the total volume, a buying imbalance will be detected (upwards triangle).
When net delta is negative, and the negative net delta constitutes >=70% of the total volume, a buying imbalance will be detected (downwards triangle).
Stacked Imbalance Detection
In addition to imbalance detection, Footprint IQ Pro can also detect stacked imbalances!
The image above shows Footprint IQ Pro detecting stacked imbalances!
Stacked imbalances occur when consecutive imbalances at sequential price areas occur. Stacked imbalances are generally interpreted as significant price moves that are supported by volume, rather than a significant result with disproportionate effort.
The criteria for stacked imbalance detection (how many imbalances must occur at sequential price areas) is customizable in the settings.
The default value is three. Therefore, when three imbalances occur at sequential price areas, golden triangles will begin to print to show a stacked imbalance.
Additionally, traders can set alerts for when stacked imbalances occur!
Highest +Delta and Highest -Delta Levels
In addition to being a fully-fledged Footprint indicator, Footprint IQ Pro goes one step further by detecting price areas where the greater +Delta and -Delta are!
The image above shows price behavior near highest +Delta price areas detected by Footprint IQ!
These +Delta levels are considered important as there has been strong interest from buyers at these price areas when they are traded at.
It's expected that these levels can function as support points that are supported by volume.
The image above shows a similar function for resistance points!
Blue lines = High +Delta Detected Price Areas
Red lines = High -Delta Detected Price Areas
Value Area Detection
Similar to traditional volume profile, Footprint IQ Pro displays the value area per bar.
Green lines next to each footprint show the value area for the bar. The value area % is customizable in the settings.
CVD Levels
Footprint IQ Pro is capable of storing historical volume delta information to provide CVD measurements at each price area!
The image above exemplifies this feature!
When this feature is enabled, you will see the CVD of each price area, rather than the net delta!
And that's it!
Thank you so much to TradingView for offering the greatest charting platform for everyone to create on!
If you have any feature requests you'd like to see for Footprint IQ, please feel free to share them with us!
Thank you!
Advanced Averaged Momentum Indicator (AAMI)Key Features of AAMI:
Combination of Momentum Indicators: It averages normalized values from RSI, MACD histogram, raw Momentum, and Stochastic oscillator to give a comprehensive view of momentum.
Normalization: Each component is normalized to a scale from -1 to 1 to ensure they contribute equally to the AMI calculation.
Visual Cues: The indicator includes visual levels for neutral, overbought, and oversold conditions to aid in quick decision-making.
Alerts: Basic alert conditions are included for when AMI moves into overbought or oversold territory, which traders can customize further.
Customizable: All parameters can be adjusted within TradingView to tailor the indicator to different market conditions or trading strategies.
Smoothing: Included an SMA for AMI to reduce noise and give smoother signals.
Divergence Detection: Implemented a basic divergence detection mechanism to spot potential reversals.
Usage Tips:
Overbought/Oversold: When AMI goes above 0.7, it might suggest an overbought condition, potentially signaling a sell or take profit. Below -0.7 might indicate oversold conditions, suggesting a buy opportunity.
Divergence: Watch for divergences between the AMI and price action for signals of potential trend reversals.
Crossing Zero: The AMI crossing from negative to positive might be used as a buy signal, and vice versa for a sell signal.
This script provides a new way to view momentum by consolidating multiple traditional indicators into one, potentially offering clearer signals in complex market environments.
Pivot Candles with MFI Opacity (No Plot)How to Use the Pivot Candles with MFI Opacity Indicator for Trade Entries and Position Management
Overview
This indicator is designed not only to display key pivot levels (support and resistance) and Money Flow Index (MFI) signals on your chart, but also to help you structure systematic order entries and position management. By combining pivot levels with dynamic MFI-based candle opacity, the indicator provides a visual framework that technical analysts and quants can use to time buy and sell stop orders as well as to pyramid positions or take profits.
Trade Entry with Pivot Levels
Buy Stop Orders Above R1:
Concept: In many technical setups, resistance levels such as R1 are viewed as potential breakout points. A buy stop order placed just above R1 allows you to enter a long position only when price decisively breaks the prior resistance, confirming bullish momentum.
How It Works:
The indicator calculates pivot levels based on the previous higher‑timeframe bar, so R1 is “locked in” for the current period.
When the current candle closes above R1, it may signal a breakout.
Technical analysts often place a buy stop order slightly above R1 (for example, a few ticks or pips above the level) to confirm the move.
Practical Application:
Quants and systematic traders can program their models to monitor when the current close exceeds R1.
Once this condition is met, a buy stop order is triggered to capture the breakout move, ensuring that you only participate if the price decisively moves upward.
Sell Stop Orders Below S1:
Concept: Conversely, S1 acts as a support level. A sell stop order placed just below S1 is designed to capture a breakdown. This order is activated when price closes below S1, indicating that selling pressure may be overwhelming.
How It Works:
With pivot levels fixed from the previous higher‑timeframe bar, S1 provides a reference for potential support.
A close below S1 can be interpreted as a sign of a bearish reversal or a continuation of a downtrend.
Practical Application:
Quants set up their systems to watch for a break below S1.
A sell stop order is positioned just below S1 to ensure that if the support level fails, the system can quickly initiate a short position to capture the downward move.
Using MFI for Position Management
Pyramiding and Profit Taking:
Dynamic Candle Opacity:
The Money Flow Index (MFI) in this indicator not only provides overbought/oversold alerts but also controls the opacity of your candlesticks. When MFI readings are high, the candles become more opaque, indicating strong buying pressure. Conversely, lower MFI values lead to more transparent candles, suggesting reduced momentum.
Pyramiding Long Positions:
Strategy:
In a strong trend, technical analysts might choose to add to a winning position gradually—a process known as pyramiding.
Implementation:
As long as the price remains above R1 and MFI readings are supportive (high and consistent), you may consider adding to your long position incrementally.
Each new buy stop order can be set above R1 with slightly adjusted trigger levels to capture further breakout strength.
Risk Management:
Quants use the MFI reading as a risk filter; if MFI begins to drop or the candles become significantly more transparent, it may be a cue to stop pyramiding or even begin taking profits.
Taking Profit Using MFI and Pivot Reversals:
Profit Targeting:
When price reaches higher resistance levels (e.g., R2 or R3) or shows signs of overextension in conjunction with extreme MFI levels (for instance, a sudden drop in MFI after a strong rally), you can begin taking partial profits.
Systematic Exit:
A systematic strategy might include scaling out of the position as the price approaches the next resistance level or when the MFI indicates that buying momentum is waning.
Similarly, for short positions entered below S1, profit targets might be set near subsequent support levels, with exits triggered if MFI suggests a reversal.
Summary
Entry Orders:
Place buy stop orders just above R1 to capture breakouts.
Place sell stop orders just below S1 to capture breakdowns.
Position Management with MFI:
Use MFI-based candle opacity as a visual indicator of momentum.
Pyramid positions in the direction of the trend when MFI confirms strength.
Consider partial exits if MFI readings start to reverse or if the price nears the next pivot level.
By following this systematic approach, technical analysts and quants can use the indicator not only as a visual tool but as an integral part of an automated or semi-automated trading system that emphasizes disciplined entries, pyramiding, and profit-taking.
BPR [TakingProphets]The BPR (Balanced Price Range) Indicator by Taking Prophets is built for traders who follow ICT (Inner Circle Trader) concepts and smart money strategies. In ICT methodology, a Balanced Price Range (BPR) occurs when price rapidly moves in one direction, creating an imbalance that often gets revisited before price continues its trend. These areas represent inefficiencies in the market where liquidity was not properly distributed, making them key zones for potential retracements and trade setups.
How the Indicator Works:
🔹 Automatically Detects BPRs – No need to manually mark imbalances; the indicator highlights them for you.
🔹 Helps Identify Smart Money Footprints – Spot areas where price is likely to retrace and rebalance liquidity.
🔹 Customizable Sensitivity – Adjust detection parameters based on your preferred trading style.
🔹 Works Across All Markets – Apply it to Forex, Futures, Crypto, and Stocks on TradingView.
🔹 Clean and Intuitive Interface – Designed to be simple yet powerful for both new and experienced traders.
Midnight Range Standard DeviationsCredit to Lex Fx for the basic framework of this script
This indicator is designed to assist traders in identifying potential trading opportunities based on the Intraday Concurrency Technique (ICT) concepts, specifically the midnight range deviations and their relationship to Fibonacci levels. It builds upon the work of Lex-FX, whom we gratefully acknowledge for the original concept and inspiration for this indicator.
Core Concept: ICT Midnight Range
The core of this indicator revolves around the concept of the midnight range. According to ICT, the high and low formed in a specific time window (typically the first 30 minutes after midnight, New York Time) can serve as a key reference point for intraday price action. The indicator identifies this range and projects potential support and resistance levels based on deviations from this range, combined with Fibonacci ratios.
How ICT Uses Midnight Range Deviations
ICT methodology often involves looking for price to move away from the initial midnight range, then return to it, or deviate beyond it, as key areas for potential entries.
Range Identification: The indicator automatically identifies the high and low of the midnight range (00:00 - 00:30 NY Time).
Deviation Levels: The indicator calculates and displays deviation levels based on multiples of the initial midnight range. These levels are often used to identify potential areas of support and resistance, as well as potential targets for price movement. These levels can be set in the additional fib levels section, which can be configured in increments of .5 deviations all the way up to 12 deviations.
Fibonacci Confluence: ICT often emphasizes the confluence of multiple factors. This indicator adds Fibonacci levels to the midnight range deviations. This allows traders to identify areas where Fibonacci retracements or extensions align with the deviation levels, potentially creating stronger areas of support or resistance.
Looking for Sweeps: ICT often uses these levels to look for times that the high and low are swept as potential areas of liquidity, indicating the start of potential continuations.
Time-Based Analysis: The time at which price interacts with these levels can also be significant in ICT. The indicator provides options to extend the range lines to specific times (e.g., 3 hours, 6 hours, 10 hours, 12 hours, or a custom defined time) after midnight, allowing traders to focus on specific periods of the trading day.
Indicator Settings Explained:
Time Zone (TZ): Defines the time zone used for calculating the midnight range. The default is "America/New_York".
Range High Color, Range Low Color, Range Mid Color: Customize the colors of the high, low, and mid-range lines.
Range Fill Color: Sets the fill color for the area between the range high and low.
Line Style: Choose the style of the range lines (solid, dashed, dotted).
Range Line Thickness: Adjust the thickness of the range lines for better visibility.
Show Fibonacci Levels: Enable or disable the display of Fibonacci deviation levels.
Fib Up Color, Fib Down Color: Customize the colors of the Fibonacci levels above (up) and below (down) the midnight range.
Show Trendline: Enables a trendline that plots the close price, colored according to whether the price is above the high, below the low, or within the midnight range.
Show Range Lines, Show Range Labels: Toggles the visibility of the range lines and their associated labels.
Label Size: Adjust the size of the labels for better readability.
Hide Prices: Option to display only the deviation values on labels, hiding price values.
Place Fibonacci Labels on Left Side: Option to switch label position from right side to left side.
Extend Range To (Hours from Midnight): This section gives you a wide variety of options on how far you want to extend the range to, you can do 3,6,10,12, and 23 hours. Alternatively, you can select the "Use Custom Length" and set a specific time in hours.
Additional Fib Levels: This section allows the trader to set additional deviation points in increments of .5 deviations from .5 all the way up to 12 deviations
TradingView Community Guidelines Compliance:
This indicator description adheres to the TradingView community guidelines by:
Being educational: It explains the ICT methodology and how the indicator can be used in trading.
Being transparent: It clearly describes all the indicator's settings and their purpose.
Providing credit: It acknowledges Lex-FX as the original author of the concept.
Avoiding misleading claims: It does not guarantee profits or imply that the indicator is a "holy grail."
Disclaimer: Usage of this indicator and the information provided is at your own risk. The author is not responsible for any losses incurred as a result of using this indicator.
Important Considerations:
This indicator is intended for educational purposes and to assist in applying the ICT methodology.
It should not be used as a standalone trading system.
Always combine this indicator with other forms of technical analysis and risk management techniques.
Backtest thoroughly on your chosen market and timeframe before using in live trading.
Trading involves risk. Only trade with capital you can afford to lose.
Half Candle RetraceThis custom indicator draws a horizontal line at the 50% retracement level of each candlestick on the chart. It calculates the midpoint between the high and low of each candle, which is often used by traders to identify potential entry, exit and take-profit levels. Once price action returns to an untouched level, the line will be removed, leaving only the levels where price action is still missing.
Key Features:
Timeframe: Works on all timeframes.
Line Color: Customize the line color to suit your charting preferences.
Line Width: Adjust the thickness of the retracement line for better visibility.
Line Style: Choose between solid, dotted, or dashed lines.
Up/Down Candle Selection: Option to only display retracement lines for up (bullish) candles, down (bearish) candles, or both.
Full Customization: Control the transparency (opacity) of the line for enhanced visual clarity.
Simple Setup: No complicated settings – simply choose your preferred color, line style, and visibility options.
This indicator is perfect for traders who prefer to use price action and retracement levels to identify potential trade opportunities.
How It Works:
The indicator automatically calculates the 50% level (midpoint) for each candlestick, drawing a line at this level. It will only draw lines for candles that match your chosen criteria (up or down candles), ensuring the chart remains clean and relevant to your trading strategy. Lines are automatically removed as soon as price crosses them.
Candle Partition Statistics with IQV and Chi2NOTE: THE FORMULA IN THE CHART IS NOT PART OF THE CODE
This Pine Script calculates statistical measures for candle partitions based on whether a candle is bullish or bearish and whether the price is above or below an EMA. It evaluates statistical properties such as the Index of Qualitative Variation (IQV) and the Chi-Square (χ²) statistic to assess variations in price action.
Concept of Index of Qualitative Variation (IQV)
IQV is a statistical measure used to quantify the diversity or dispersion of categorical variables. In this script, it is used to measure how evenly the four categories of candles (green above EMA, red above EMA, green below EMA, red below EMA) are distributed.
Purpose of IQV in the Script:
IQV ranges from 0 to 1, where 0 indicates no variation (one category dominates) and 1 indicates maximum variation (categories are equally distributed).
A high IQV suggests balanced distributions of bullish/bearish candles above/below the EMA, indicating market uncertainty or mixed sentiment.
A low IQV suggests dominance of a particular candle type, indicating a strong trend.
Concept of Chi-Square (χ²) Test
Chi-square (χ²) is a statistical test that measures the difference between expected and observed frequencies of categorical data. It assesses whether short-term price behavior significantly deviates from historical trends.
Purpose of Chi-Square in the Script:
A high χ² value means that short-term candle distributions are significantly different from historical patterns, indicating potential trend shifts.
If χ² exceeds a predefined significance threshold (chi_threshold), an alert (Chi² Alert!) is triggered.
It helps traders identify periods where recent price behavior deviates from historical norms, possibly signaling trend reversals or market regime changes.
Key Takeaways:
IQV helps measure the diversity of price action, detecting whether the market is balanced or trending.
Chi-square (χ²) identifies significant deviations in short-term price behavior compared to long-term trends.
Both metrics together provide insights into whether the market is stable, trending, or shifting.
The Nasan C-score enhances trend strength by incorporating volatility. It is calculated as:
enhanced_t_s =(𝑡𝑠 × avg_movement x 100)/SMA(𝑐lose)
Key Components:
𝑡𝑠 : Measures trend strength based on price movements relative to EMA.
ts=green_EMAup_a+0.5×red_EMAup_a−(0.5×green_EMAdown_a+red_EMAdown_a)
avg_movement: The SMA of absolute close-open differences, capturing volatility.
Normalization: The division by SMA(close) adjusts the score relative to price levels.
Purpose of the Nasan C-score
Enhanced Trend Strength
It amplifies the trend strength value by factoring in volatility (price movement).
If price volatility is high, trend strength variations have a greater impact.
Volatility-Adjusted Momentum
By scaling 𝑡𝑠 with average movement, the score adjusts to changing price dynamics.
Higher price fluctuations lead to a higher score, making trend shifts more prominent.
How It Can Be Used in Trading
Higher values of Nasan C-score indicate strong bullish or bearish trends.
Comparing it with past values helps determine whether momentum is increasing or fading.
Thresholds can be set to identify significant trend shifts based on historical highs and lows.
PumpC CBC EMAs + VWAPPumpC CBC EMAs + VWAP Indicator for Tradingview
Introduction
This is an indicator for the Candle By Candle (CBC) Flip strategy , based on the CBC Flip concept taught by MapleStax and inspired by the original CBC Flip indicator by AsiaRoo . The CBC Flip strategy is a simple yet effective approach to gauge if bulls or bears are in control for any given candle.
The logic behind the CBC Flip is as follows:
Bullish Flip : If the most recent candle’s close is above the previous candle’s high, bulls have taken control.
Bearish Flip : If the most recent candle’s close is below the previous candle’s low, bears are now in control.
No Flip : If neither condition is met, the previously dominant side (bulls or bears) remains in control until one of these conditions is satisfied, flipping the market sentiment—hence the name CBC Flip .
The PumpC CBC EMAs + VWAP Indicator enhances this simple strategy by adding trend confirmation filters using EMAs and VWAP , along with time-restricted signal generation and fully customizable alerts.
What Does This Indicator Do?
The PumpC CBC EMAs + VWAP Indicator helps traders identify CBC Flips to spot potential trend continuations or reversals. It combines candlestick logic , trend filters , and time-based restrictions to provide high-probability trade signals.
CBC Flip Detection
Bullish Flip : Current close is above the previous candle’s high.
Bearish Flip : Current close is below the previous candle’s low.
Strict Flips : Require a liquidity sweep for higher accuracy.
All Flips : Looser conditions that generate more frequent signals.
EMA and VWAP Trend Confirmation (Optional)
This filter ensures that long signals only trigger when the Slow EMA is above the VWAP , confirming an upward trend. For short signals, the Slow EMA must be below the VWAP.
Time-Based Filtering
The indicator allows you to set a specific trading window (e.g., 9:00 AM to 3:00 PM), helping you avoid low-volume or high-risk periods.
Visual Labels and Alerts
Labels : Arrows (▲ for long and ▼ for short) mark CBC Flip points on the chart.
Alerts : Fully customizable notifications for each signal type, based on your chosen filters.
Key Features
CBC Flip Detection : Identify potential reversals and trend continuations.
Strict vs. All Flips : Choose between higher-accuracy strict flips or more frequent all flips.
EMA-to-VWAP Filter : Optional trend confirmation filter to reduce false signals.
Customizable EMAs and VWAP : Configure lengths and colors for visual clarity.
Time-Restricted Signals : Focus on your preferred trading session.
Custom Alerts : Notifications for long and short signals based on filter settings.
Credits and Inspiration
The CBC Flip strategy was created by MapleStax .
This indicator is inspired by the original CBC Flip indicator by AsiaRoo .
Additional enhancements include EMA-to-VWAP filtering , custom alerts , and time-restricted signal generation for a more comprehensive trading experience.
Risks and Disclaimer
This indicator is for educational purposes only and does not constitute financial advice.
Trading involves significant risk, and past performance does not guarantee future results. Always test this indicator in a simulated environment before live trading.
Multi-Indicator Signals with Selectable Options by DiGetMulti-Indicator Signals with Selectable Options
Script Overview
This Pine Script is a multi-indicator trading strategy designed to generate buy/sell signals based on combinations of popular technical indicators: RSI (Relative Strength Index) , CCI (Commodity Channel Index) , and Stochastic Oscillator . The script allows you to select which combination of signals to display, making it highly customizable and adaptable to different trading styles.
The primary goal of this script is to provide clear and actionable entry/exit points by visualizing buy/sell signals with arrows , labels , and vertical lines directly on the chart. It also includes input validation, dynamic signal plotting, and clutter-free line management to ensure a clean and professional user experience.
Key Features
1. Customizable Signal Types
You can choose from five signal types:
RSI & CCI : Combines RSI and CCI signals for confirmation.
RSI & Stochastic : Combines RSI and Stochastic signals.
CCI & Stochastic : Combines CCI and Stochastic signals.
RSI & CCI & Stochastic : Requires all three indicators to align for a signal.
All Signals : Displays individual signals from each indicator separately.
This flexibility allows you to test and use the combination that works best for your trading strategy.
2. Clear Buy/Sell Indicators
Arrows : Buy signals are marked with upward arrows (green/lime/yellow) below the candles, while sell signals are marked with downward arrows (red/fuchsia/gray) above the candles.
Labels : Each signal is accompanied by a label ("BUY" or "SELL") near the arrow for clarity.
Vertical Lines : A vertical line is drawn at the exact bar where the signal occurs, extending from the low to the high of the candle. This ensures you can pinpoint the exact entry point without ambiguity.
3. Dynamic Overbought/Oversold Levels
You can customize the overbought and oversold levels for each indicator:
RSI: Default values are 70 (overbought) and 30 (oversold).
CCI: Default values are +100 (overbought) and -100 (oversold).
Stochastic: Default values are 80 (overbought) and 20 (oversold).
These levels can be adjusted to suit your trading preferences or market conditions.
4. Input Validation
The script includes built-in validation to ensure that oversold levels are always lower than overbought levels for each indicator. If the inputs are invalid, an error message will appear, preventing incorrect configurations.
5. Clean Chart Design
To avoid clutter, the script dynamically manages vertical lines:
Only the most recent 50 buy/sell lines are displayed. Older lines are automatically deleted to keep the chart clean.
Labels and arrows are placed strategically to avoid overlapping with candles.
6. ATR-Based Offset
The vertical lines and labels are offset using the Average True Range (ATR) to ensure they don’t overlap with the price action. This makes the signals easier to see, especially during volatile market conditions.
7. Scalable and Professional
The script uses arrays to manage multiple vertical lines, ensuring scalability and performance even when many signals are generated.
It adheres to Pine Script v6 standards, ensuring compatibility and reliability.
How It Works
Indicator Calculations :
The script calculates the values of RSI, CCI, and Stochastic Oscillator based on user-defined lengths and smoothing parameters.
It then checks for crossover/crossunder conditions relative to the overbought/oversold levels to generate individual signals.
Combined Signals :
Depending on the selected signal type, the script combines the individual signals logically:
For example, a "RSI & CCI" buy signal requires both RSI and CCI to cross into their respective oversold zones simultaneously.
Signal Plotting :
When a signal is generated, the script:
Plots an arrow (upward for buy, downward for sell) at the corresponding bar.
Adds a label ("BUY" or "SELL") near the arrow for clarity.
Draws a vertical line extending from the low to the high of the candle to mark the exact entry point.
Line Management :
To prevent clutter, the script stores up to 50 vertical lines in arrays (buy_lines and sell_lines). Older lines are automatically deleted when the limit is exceeded.
Why Use This Script?
Versatility : Whether you're a scalper, swing trader, or long-term investor, this script can be tailored to your needs by selecting the appropriate signal type and adjusting the indicator parameters.
Clarity : The combination of arrows, labels, and vertical lines ensures that signals are easy to spot and interpret, even in fast-moving markets.
Customization : With adjustable overbought/oversold levels and multiple signal options, you can fine-tune the script to match your trading strategy.
Professional Design : The script avoids clutter by limiting the number of lines displayed and using ATR-based offsets for better visibility.
How to Use This Script
Add the Script to Your Chart :
Copy and paste the script into the Pine Editor in TradingView.
Save and add it to your chart.
Select Signal Type :
Use the "Signal Type" dropdown menu to choose the combination of indicators you want to use.
Adjust Parameters :
Customize the lengths of RSI, CCI, and Stochastic, as well as their overbought/oversold levels, to match your trading preferences.
Interpret Signals :
Look for green arrows and "BUY" labels for buy signals, and red arrows and "SELL" labels for sell signals.
Vertical lines will help you identify the exact bar where the signal occurred.
Tips for Traders
Backtest Thoroughly : Before using this script in live trading, backtest it on historical data to ensure it aligns with your strategy.
Combine with Other Tools : While this script provides reliable signals, consider combining it with other tools like support/resistance levels or volume analysis for additional confirmation.
Avoid Overloading the Chart : If you notice too many signals, try tightening the overbought/oversold levels or switching to a combined signal type (e.g., "RSI & CCI & Stochastic") for fewer but higher-confidence signals.
The Ultimate Lot Size Calculator Backstory
I created this Pine Script tool to calculate lot sizes with precision. While there are many lot size calculators available on TradingView, I found that most had significant flaws. I started teaching myself Pine Script over three and a half years ago with the sole purpose of building this tool. My first version was messy and lacked accuracy, so I never published it. I wanted it to be better than any other available tool, but my limited knowledge back then held me back.
Recently, I received a request to create a similar tool, as the current options still fail to deliver the precision and reliability traders need. This inspired me to revisit my original idea. With improved skills and a better understanding of Pine Script, I redesigned the tool from scratch, making it as precise, reliable, and efficient as possible.
This tool features built-in error detection to minimize mistakes and ensure accuracy in lot size calculations. I've spent more time on this project than on any other, focusing on delivering a solution that stands out on TradingView. While I plan to add more features based on user feedback, the current version is already a powerful, dependable, and easy-to-use tool for traders who value precision and efficiency in their lot size calculations.
How to use the tool ?
At first it might seem complicated, but it is quite easy to use the tool. There are two modes: auto and manual. By default, the tool is set on manual mode. When you apply the tool on the chart, it will ask you to choose the entry price, then the stop-loss price, and at last the take-profit price. Select all of them one by one. These values can be changed later.
Settings
There are various setting given for making the tool as flexible as possible. Here is the explanation for some of most important settings. Play with them and make yourself comfortable.
General settings
Auto mode : Use this mode if you want the the risk reward to be fixed and stop loss to be based on ATR. However the stop loss can be changed to be based on user input.
Manual mode : Use this mode if you want full control over entry, stop loss and take profit.
Contract Size : The tool works perfectly for all forex pairs including gold and silver but as the contract size is different for different assets it is difficult to add every single asset into the script manually so i have provided this option. In case you want to calculate lot size for a asset other then forex, gold or silver make sure to change this. Contract size = Quantity of the asset in 1 standerd lot.
Account settings
Automatic mode settings and ATR stop settings
Manual mode settings
Table and risk-reward box settings are pretty much self-explanatory i guess.
Error handling
A lot size calculator is a complex program. There are numerous points where it may fail and produce incorrect results. To make it robust and accurate, these issues must be addressed and managed properly, which practically all existing lot size calculator scripts fail to do.
Golden tip
When the symbol is changed it will display a symbol change warning as the entry, stop loss and take profit price won't change.
There are 2 ways to get fix this. Either manually enter all three values which i hate the most or remove the script from the chart and re-apply the script on chart again.
So to re-apply the indicator in most easy way follow the following instructions:
Note : If you encounter any other error then read the instruction to fix it and if it is an unknow error pleas report it to me in comments or DM.
Boilerplate Configurable Strategy [Yosiet]This is a Boilerplate Code!
Hello! First of all, let me introduce myself a little bit. I don't come from the world of finance, but from the world of information and communication technologies (ICT) where we specialize in data processing with the aim of automating it and eliminating all human factors and actors in the processes. You could say that I am an algotrader.
That said, in my journey through trading in recent years I have understood that this world is often shown to be incomplete. All those who want to learn about trading only end up learning a small part of what it really entails, they only seek to learn how to read candlesticks. Therefore, I want to share with the entire community a fraction of what I have really understood it to be.
As a computer scientist, the most important thing is the data, it is the raw material of our work and without data you simply cannot do anything. Entropy is simple: Data in -> Data is transformed -> Data out.
The quality of the outgoing data will directly depend on the incoming data, there is no greater mystery or magic in the process. In trading it is no different, because at the end of the day it is nothing more than data. As we often say, if garbage comes in, garbage comes out.
Most people focus on the results only, on the outgoing data, because in the end we all want the same thing, to make easy money. Very few pay attention to the input data, much less to the process.
Now, I am not here to delude you, because there is no bigger lie than easy money, but I am here to give you a boilerplate code that will help you create strategies where you only have to concentrate on the quality of the incoming data.
To the Point
The code is a strategy boilerplate that applies the technique that you decide to customize for the criteria for opening a position. It already has the other factors involved in trading programmed and automated.
1. The Entry
This section of the boilerplate is the one that each individual must customize according to their needs and knowledge. The code is offered with two simple, well-known strategies to exemplify how the code can be reused for your own benefits.
For the purposes of this post on tradingview, I am going to use the simplest of the known strategies in trading for entries: SMA Crossing
// SMA Cross Settings
maFast = ta.sma(close, length)
maSlow = ta.sma(open, length)
The Strategy Properties for all cases published here:
For Stock TSLA H1 From 01/01/2025 To 02/15/2025
For Crypto XMR-USDT 30m From 01/01/2025 To 02/15/2025
For Forex EUR-USD 5m From 01/01/2025 To 02/15/2025
But the goal of this post is not to sell you a dream, else to show you that the same Entry decision works very well for some and does not for others and with this boilerplate code you only have to think of entries, not exits.
2. Schedules, Days, Sessions
As you know, there are an infinite number of markets that are susceptible to the sessions of each country and the news that they announce during those sessions, so the code already offers parameters so that you can condition the days and hours of operation, filter the best time parameters for a specific market and time frame.
3. Data Filtering
The data offered in trading are numerical series presented in vectors on a time axis where an endless number of mathematical equations can be applied to process them, with matrix calculation and non-linear regressions being the best, in my humble opinion.
4. Read Fundamental Macroeconomic Events, News
The boilerplate has integration with the tradingview SDK to detect when news will occur and offers parameters so that you can enable an exclusion time margin to not operate anything during that time window.
5. Direction and Sense
In my experience I have found the peculiarity that the same algorithm works very well for a market in a time frame, but for the same market in another time frame it is only a waste of time and money. So now you can easily decide if you only want to open LONG, SHORT or both side positions and know how effective your strategy really is.
6. Reading the money, THE PURPOSE OF EVERYTHING
The most important section in trading and the reason why many clients usually hire me as a financial programmer, is reading and controlling the money, because in the end everyone wants to win and no one wants to lose. Now they can easily parameterize how the money should flow and this is the genius of this boilerplate, because it is what will really decide if an algorithm (Indicator: A bunch of math equations) for entries will really leave you good money over time.
7. Managing the Risk, The Ego Destroyer
Many trades, little money. Most traders focus on making money and none of them know about statistics and the few who do know something about it, only focus on the winrate. Well, with this code you can unlock what really matters, the true success criteria to be able to live off of trading: Profit Factor, Sortino Ratio, Sharpe Ratio and most importantly, will you really make money?
8. Managing Emotions
Finally, the main reason why many lose money is because they are very bad at managing their emotions, because with this they will no longer need to do so because the boilerplate has already programmed criteria to chase the price in a position, cut losses and maximize profits.
In short, this is a boilerplate code that already has the data processing and data output ready, you only have to worry about the data input.
“And so the trader learned: the greatest edge was not in predicting the storm, but in building a boat that could not sink.”
DISCLAIMER
This post is intended for programmers and quantitative traders who already have a certain level of knowledge and experience. It is not intended to be financial advice or to sell you any money-making script, if you use it, you do so at your own risk.
[COG]StochRSI Zenith📊 StochRSI Zenith
This indicator combines the traditional Stochastic RSI with enhanced visualization features and multi-timeframe analysis capabilities. It's designed to provide traders with a comprehensive view of market conditions through various technical components.
🔑 Key Features:
• Advanced StochRSI Implementation
- Customizable RSI and Stochastic calculation periods
- Multiple moving average type options (SMA, EMA, SMMA, LWMA)
- Adjustable signal line parameters
• Visual Enhancement System
- Dynamic wave effect visualization
- Energy field display for momentum visualization
- Customizable color schemes for bullish and bearish signals
- Adaptive transparency settings
• Multi-Timeframe Analysis
- Higher timeframe confirmation
- Synchronized market structure analysis
- Cross-timeframe signal validation
• Divergence Detection
- Automated bullish and bearish divergence identification
- Customizable lookback period
- Clear visual signals for confirmed divergences
• Signal Generation Framework
- Price action confirmation
- SMA-based trend filtering
- Multiple confirmation levels for reduced noise
- Clear entry signals with customizable display options
📈 Technical Components:
1. Core Oscillator
- Base calculation: 13-period RSI (adjustable)
- Stochastic calculation: 8-period (adjustable)
- Signal lines: 5,3 smoothing (adjustable)
2. Visual Systems
- Wave effect with three layers of visualization
- Energy field display with dynamic intensity
- Reference bands at 20/30/50/70/80 levels
3. Confirmation Mechanisms
- SMA trend filter
- Higher timeframe alignment
- Price action validation
- Divergence confirmation
⚙️ Customization Options:
• Visual Parameters
- Wave effect intensity and speed
- Energy field sensitivity
- Color schemes for bullish/bearish signals
- Signal display preferences
• Technical Parameters
- All core calculation periods
- Moving average types
- Divergence detection settings
- Signal confirmation criteria
• Display Settings
- Chart and indicator signal placement
- SMA line visualization
- Background highlighting options
- Label positioning and size
🔍 Technical Implementation:
The indicator combines several advanced techniques to generate signals. Here are key components with code examples:
1. Core StochRSI Calculation:
// Base RSI calculation
rsi = ta.rsi(close, rsi_length)
// StochRSI transformation
stochRSI = ((ta.highest(rsi, stoch_length) - ta.lowest(rsi, stoch_length)) != 0) ?
(100 * (rsi - ta.lowest(rsi, stoch_length))) /
(ta.highest(rsi, stoch_length) - ta.lowest(rsi, stoch_length)) : 0
2. Signal Generation System:
// Core signal conditions
crossover_buy = crossOver(sk, sd, cross_threshold)
valid_buy_zone = sk < 30 and sd < 30
price_within_sma_bands = close <= sma_high and close >= sma_low
// Enhanced signal generation
if crossover_buy and valid_buy_zone and price_within_sma_bands and htf_allows_long
if is_bullish_candle
long_signal := true
else
awaiting_bull_confirmation := true
3. Multi-Timeframe Analysis:
= request.security(syminfo.tickerid, mtf_period,
)
The HTF filter looks at a higher timeframe (default: 4H) to confirm the trend
It only allows:
Long trades when the higher timeframe is bullish
Short trades when the higher timeframe is bearish
📈 Trading Application Guide:
1. Signal Identification
• Oversold Opportunities (< 30 level)
- Look for bullish crosses of K-line above D-line
- Confirm with higher timeframe alignment
- Wait for price action confirmation (bullish candle)
• Overbought Conditions (> 70 level)
- Watch for bearish crosses of K-line below D-line
- Verify higher timeframe condition
- Confirm with bearish price action
2. Divergence Trading
• Bullish Divergence
- Price makes lower lows while indicator makes higher lows
- Most effective when occurring in oversold territory
- Use with support levels for entry timing
• Bearish Divergence
- Price makes higher highs while indicator shows lower highs
- Most reliable in overbought conditions
- Combine with resistance levels
3. Wave Effect Analysis
• Strong Waves
- Multiple wave lines moving in same direction indicate momentum
- Wider wave spread suggests increased volatility
- Use for trend strength confirmation
• Energy Field
- Higher intensity in trading zones suggests stronger moves
- Use for momentum confirmation
- Watch for energy field convergence with price action
The energy field is like a heat map that shows momentum strength
It gets stronger (more visible) when:
Price is in oversold (<30) or overbought (>70) zones
The indicator lines are moving apart quickly
A strong signal is forming
Think of it as a "strength meter" - the more visible the energy field, the stronger the potential move
4. Risk Management Integration
• Entry Confirmation
- Wait for all signal components to align
- Use higher timeframe for trend direction
- Confirm with price action and SMA positions
• Stop Loss Placement
- Consider placing stops beyond recent swing points
- Use ATR for dynamic stop calculation
- Account for market volatility
5. Position Management
• Partial Profit Taking
- Consider scaling out at overbought/oversold levels
- Use wave effect intensity for exit timing
- Monitor energy field for momentum shifts
• Trade Duration
- Short-term: Use primary signals in trading zones
- Swing trades: Focus on divergence signals
- Position trades: Utilize higher timeframe signals
⚠️ Important Usage Notes:
• Avoid:
- Trading against strong trends
- Relying solely on single signals
- Ignoring higher timeframe context
- Over-leveraging based on signals
Remember: This tool is designed to assist in analysis but should never be used as the sole decision-maker for trades. Always maintain proper risk management and combine with other forms of analysis.
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.
[SHORT ONLY] 10 Bar Low Pullback█ STRATEGY DESCRIPTION
The "10 Bar Low Pullback" strategy is a contrarian short trading system designed to capture pullbacks after a new 10‐bar low is made. it identifies a potential short opportunity when the current bar’s low breaks below the lowest low of the previous 10 bars, provided that the bar exhibits strong internal momentum as measured by its IBS value. An optional trend filter further refines entries by requiring that the close is below a 200-period EMA.
█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) measures where the closing price falls within the high-low range of a bar. It is calculated as:
ibs = (close - low) / (high - low)
- Low IBS (≤ 0.2): Indicates the close is near the bar's low, suggesting oversold conditions.
- High IBS (≥ 0.8): Indicates the close is near the bar's high, suggesting overbought conditions.
█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
The current bar’s low is below the lowest low of the past X bars (default: 10).
The bar’s IBS is greater than the specified threshold (default: 0.85).
The signal occurs within the defined trading window (between Start Time and End Time).
If the EMA Filter is enabled, the close must be below the 200-period EMA.
2. EXIT CONDITION
An exit Signal is generated when the current close falls below the previous bar’s low (close < low ), indicating a potential bearish reversal and prompting the strategy to close its short position.
█ ADDITIONAL SETTINGS
Lookback Period: Defines the number of bars (default is 10) over which the lowest low is calculated.
IBS Threshold: Sets the minimum required IBS value (default is 0.85) to qualify as a pullback.
Trading Window: Trades are only executed between the user-defined Start Time and End Time.
EMA Filter (Optional): When enabled, short entries are only considered if the current close is below the 200-period EMA, with the EMA period being adjustable (default is 200).
█ PERFORMANCE OVERVIEW
Designed for shorting opportunities, this strategy aims to capture pullbacks following an aggressive 10-bar low break.
It leverages a combination of a lookback low and IBS measurement to identify overextended bullish moves that may revert.
The optional EMA filter helps confirm a bearish market environment by ensuring the price remains under the trend line.
Suitable for use on various assets, including stocks and ETFs, on daily or similar timeframes.
Backtesting and parameter optimization are recommended to tailor the strategy to specific market conditions.
[SHORT ONLY] ATR Sell the Rip Mean Reversion Strategy█ STRATEGY DESCRIPTION
The "ATR Sell the Rip Mean Reversion Strategy" is a contrarian system that targets overextended price moves on stocks and ETFs. It calculates an ATR‐based trigger level to identify shorting opportunities. When the current close exceeds this smoothed ATR trigger, and if the close is below a 200-period EMA (if enabled), the strategy initiates a short entry, aiming to profit from an anticipated corrective pullback.
█ HOW IS THE ATR SIGNAL BAND CALCULATED?
This strategy computes an ATR-based signal trigger as follows:
Calculate the ATR
The strategy computes the Average True Range (ATR) using a configurable period provided by the user:
atrValue = ta.atr(atrPeriod)
Determine the Threshold
Multiply the ATR by a predefined multiplier and add it to the current close:
atrThreshold = close + atrValue * atrMultInput
Smooth the Threshold
Apply a Simple Moving Average over a specified period to smooth out the threshold, reducing noise:
signalTrigger = ta.sma(atrThreshold, smoothPeriodInput)
█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
The current close is above the smoothed ATR signal trigger.
The trade occurs within the specified trading window (between Start Time and End Time).
If the EMA filter is enabled, the close must also be below the 200-period EMA.
2. EXIT CONDITION
An exit Signal is generated when the current close falls below the previous bar’s low (close < low ), indicating a potential bearish reversal and prompting the strategy to close its short position.
█ ADDITIONAL SETTINGS
ATR Period: The period used to calculate the ATR, allowing for adaptability to different volatility conditions (default is 20).
ATR Multiplier: The multiplier applied to the ATR to determine the raw threshold (default is 1.0).
Smoothing Period: The period over which the raw ATR threshold is smoothed using an SMA (default is 10).
Start Time and End Time: Defines the time window during which trades are allowed.
EMA Filter (Optional): When enabled, short entries are only executed if the current close is below the 200-period EMA, confirming a bearish trend.
█ PERFORMANCE OVERVIEW
This strategy is designed for use on the Daily timeframe, targeting stocks and ETFs by capitalizing on overextended price moves.
It utilizes a dynamic, ATR-based trigger to identify when prices have potentially peaked, setting the stage for a mean reversion short entry.
The optional EMA filter helps align trades with broader market trends, potentially reducing false signals.
Backtesting is recommended to fine-tune the ATR multiplier, smoothing period, and EMA settings to match the volatility and behavior of specific markets.
TSI Long/Short for BTC 2HThe TSI Long/Short for BTC 2H strategy is an advanced trend-following system designed specifically for trading Bitcoin (BTC) on a 2-hour timeframe. It leverages the True Strength Index (TSI) to identify momentum shifts and executes both long and short trades in response to dynamic market conditions.
Unlike traditional moving average-based strategies, this script uses a double-smoothed momentum calculation, enhancing signal accuracy and reducing noise. It incorporates automated position sizing, customizable leverage, and real-time performance tracking, ensuring a structured and adaptable trading approach.
🔹 What Makes This Strategy Unique?
Unlike simple crossover strategies or generic trend-following approaches, this system utilizes a customized True Strength Index (TSI) methodology that dynamically adjusts to market conditions.
🔸 True Strength Index (TSI) Filtering – The script refines the TSI by applying double exponential smoothing, filtering out weak signals and capturing high-confidence momentum shifts.
🔸 Adaptive Entry & Exit Logic – Instead of fixed thresholds, it compares the TSI value against a dynamically determined high/low range from the past 100 bars to confirm trade signals.
🔸 Leverage & Risk Optimization – Position sizing is dynamically adjusted based on account equity and leverage settings, ensuring controlled risk exposure.
🔸 Performance Monitoring System – A built-in performance tracking table allows traders to evaluate monthly and yearly results directly on the chart.
📊 Core Strategy Components
1️⃣ Momentum-Based Trade Execution
The strategy generates long and short trade signals based on the following conditions:
✅ Long Entry Condition – A buy signal is triggered when the TSI crosses above its 100-bar highest value (previously set), confirming bullish momentum.
✅ Short Entry Condition – A sell signal is generated when the TSI crosses below its 100-bar lowest value (previously set), indicating bearish pressure.
Each trade execution is fully automated, reducing emotional decision-making and improving trading discipline.
2️⃣ Position Sizing & Leverage Control
Risk management is a key focus of this strategy:
🔹 Dynamic Position Sizing – The script calculates position size based on:
Account Equity – Ensuring trade sizes adjust dynamically with capital fluctuations.
Leverage Multiplier – Allows traders to customize risk exposure via an adjustable leverage setting.
🔹 No Fixed Stop-Loss – The strategy relies on reversals to exit trades, meaning each position is closed when the opposite signal appears.
This design ensures maximum capital efficiency while adapting to market conditions in real time.
3️⃣ Performance Visualization & Tracking
Understanding historical performance is crucial for refining strategies. The script includes:
📌 Real-Time Trade Markers – Buy and sell signals are visually displayed on the chart for easy reference.
📌 Performance Metrics Table – Tracks monthly and yearly returns in percentage form, helping traders assess profitability over time.
📌 Trade History Visualization – Completed trades are displayed with color-coded boxes (green for long trades, red for short trades), visually representing profit/loss dynamics.
📢 Why Use This Strategy?
✔ Advanced Momentum Detection – Uses a double-smoothed TSI for more accurate trend signals.
✔ Fully Automated Trading – Removes emotional bias and enforces discipline.
✔ Customizable Risk Management – Adjust leverage and position sizing to suit your risk profile.
✔ Comprehensive Performance Tracking – Integrated reporting system provides clear insights into past trades.
This strategy is ideal for Bitcoin traders looking for a structured, high-probability system that adapts to both bullish and bearish trends on the 2-hour timeframe.
📌 How to Use: Simply add the script to your 2H BTC chart, configure your leverage settings, and let the system handle trade execution and tracking! 🚀