Point and Figure (PnF) RSIThis is live and non-repainting Point and Figure Chart RSI tool. The script has it’s own P&F engine and not using integrated function of Trading View.
Point and Figure method is over 150 years old. It consist of columns that represent filtered price movements. Time is not a factor on P&F chart but as you can see with this script P&F chart created on time chart.
P&F chart provide several advantages, some of them are filtering insignificant price movements and noise, focusing on important price movements and making support/resistance levels much easier to identify.
P&F RSI is calculated and shown by using its own P&F engine.
If you are new to Point & Figure Chart then you better get some information about it before using this tool. There are very good web sites and books. Please PM me if you need help about resources.
Options in the Script
Box size is one of the most important part of Point and Figure Charting. Chart price movement sensitivity is determined by the Point and Figure scale. Large box sizes see little movement across a specific price region, small box sizes see greater price movement on P&F chart. There are four different box scaling with this tool: Traditional, Percentage, Dynamic (ATR), or User-Defined
4 different methods for Box size can be used in this tool.
User Defined: The box size is set by user. A larger box size will result in more filtered price movements and fewer reversals. A smaller box size will result in less filtered price movements and more reversals.
ATR: Box size is dynamically calculated by using ATR, default period is 20.
Percentage: uses box sizes that are a fixed percentage of the stock's price. If percentage is 1 and stock’s price is $100 then box size will be $1
Traditional: uses a predefined table of price ranges to determine what the box size should be.
Price Range Box Size
Under 0.25 0.0625
0.25 to 1.00 0.125
1.00 to 5.00 0.25
5.00 to 20.00 0.50
20.00 to 100 1.0
100 to 200 2.0
200 to 500 4.0
500 to 1000 5.0
1000 to 25000 50.0
25000 and up 500.0
Default value is “ATR”, you may use one of these scaling method that suits your trading strategy.
If ATR or Percentage is chosen then there is rounding algorithm according to mintick value of the security. For example if mintick value is 0.001 and box size (ATR/Percentage) is 0.00124 then box size becomes 0.001.
And also while using dynamic box size (ATR or Percentage), box size changes only when closing price changed.
Reversal : It is the number of boxes required to change from a column of Xs to a column of Os or from a column of Os to a column of Xs. Default value is 3 (most used). For example if you choose reversal = 2 then you get the chart similar to Renko chart.
Source: Closing price or High-Low prices can be chosen as data source for P&F charting.
you can use PNF type RSI or RENKO type RSI.
What is the difference between them?
While calculating PNF type RSI, the script checks last X/O column's closing price but when using RENKO type RSI the scipt calculates RSI on every price changes according to number of boxes. and also with RENKO type RSI, calculation is made for each boxes on price changes.
Important note if you use this PNF script with reversal = 2 then you get RENKO chart. So, with this RENKO chart better to use RENKO type RSI ;)
Cerca negli script per "做空标普500"
Point and Figure (PnF) ChartThis is live and non-repainting Point and Figure Charting tool. The tool has it’s own P&F engine and not using integrated function of Trading View.
Point and Figure method is over 150 years old. It consist of columns that represent filtered price movements. Time is not a factor on P&F chart but as you can see with this script P&F chart created on time chart.
P&F chart provide several advantages, some of them are filtering insignificant price movements and noise, focusing on important price movements and making support/resistance levels much easier to identify.
If you are new to Point & Figure Chart then you better get some information about it before using this tool. There are very good web sites and books. Please PM me if you need help about resources.
Options in the Script
Box size is one of the most important part of Point and Figure Charting. Chart price movement sensitivity is determined by the Point and Figure scale. Large box sizes see little movement across a specific price region, small box sizes see greater price movement on P&F chart. There are four different box scaling with this tool: Traditional, Percentage, Dynamic (ATR), or User-Defined
4 different methods for Box size can be used in this tool.
User Defined: The box size is set by user. A larger box size will result in more filtered price movements and fewer reversals. A smaller box size will result in less filtered price movements and more reversals.
ATR: Box size is dynamically calculated by using ATR, default period is 20.
Percentage: uses box sizes that are a fixed percentage of the stock's price. If percentage is 1 and stock’s price is $100 then box size will be $1
Traditional: uses a predefined table of price ranges to determine what the box size should be.
Price Range Box Size
Under 0.25 0.0625
0.25 to 1.00 0.125
1.00 to 5.00 0.25
5.00 to 20.00 0.50
20.00 to 100 1.0
100 to 200 2.0
200 to 500 4.0
500 to 1000 5.0
1000 to 25000 50.0
25000 and up 500.0
Default value is “ATR”, you may use one of these scaling method that suits your trading strategy.
If ATR or Percentage is chosen then there is rounding algorithm according to mintick value of the security. For example if mintick value is 0.001 and box size (ATR/Percentage) is 0.00124 then box size becomes 0.001.
And also while using dynamic box size (ATR or Percentage), box size changes only when closing price changed.
Reversal : It is the number of boxes required to change from a column of Xs to a column of Os or from a column of Os to a column of Xs. Default value is 3 (most used). For example if you choose reversal = 2 then you get the chart similar to Renko chart.
Source: Closing price or High-Low prices can be chosen as data source for P&F charting.
Chart Style: There are 3 options for chart style: “Candle”, “Area” or “Don’t show”.
As Area:
As Candle:
X/O Column Style: it can show all columns from opening price or only last Xs/Os.
Color Theme: different themes exist => Green/Red, Yellow/Blue, White/Yellow, Orange/Blue, Lime/Red, Blue/Red
Show Breakouts is the option to show Breakouts
This tool detects & shows following Breakouts:
Triple Top/Bottom,
Triple Top Ascending,
Triple Bottom Descending,
Simple Buy/Sell (Double Top/Bottom),
Simple Buy With Rising Bottom,
Simple Sell With Declining Top
Catapult bullish/bearish
Show Horizontal Count Targets: Finds the congestion or consolidation pattern and if there is breakout then it calculates the Target by using Horizontal Count method (based on the width of congestion pattern). It shows how many column exist on congestion area. There is no guarantee that prices will reach the target.
Show Vertical Count Targets: When Triple Top/Bottom Breakouts occured the script calculates the target by using Vertical Count Method (based on the length of the column). There is no guarantee that prices will reach the target.
For both methods there is auto target cancellation if price goes below congestion bottom or above congestion top.
trend is calculated by EMA of closing price of the P&F
Whipsaw protection:
Last options are “Show info panel” and Labeling Offset. Script shows current box size, reversal, and recommanded minimum and maximum box size. And also it shows the price level to reverse the column (Xs <-> Os) and the price level to add at least 1 more box to column. This is the option to put these labels 10, 20, 30, 50 or 100 bars away from the last bar. Labeling content and color change according to X/O column.
do not hesitate to comment.
Candlesticks ANN for Stock Markets TF : 1WHello, this script consists of training candlesticks with Artificial Neural Networks (ANN).
In addition to the first series, candlesticks' bodies and wicks were also introduced as training inputs.
The inputs are individually trained to find the relationship between the subsequent historical value of all candlestick values 1.(High,Low,Close,Open)
The outputs are adapted to the current values with a simple forecast code.
Once the OHLC value is found, the exponential moving averages of 5 and 20 periods are used.
Reminder : OHLC = (Open + High + Close + Low ) / 4
First version :
Script is designed for S&P 500 Indices,Funds,ETFs, especially S&P 500 Stocks,and for all liquid Stocks all around the World.
NOTE: This script is only suitable for 1W time-frame for Stocks.
The average training error rates are less than 5 per thousand for each candlestick variable. (Average Error < 0.005 )
I've just finished it and haven't tested it in detail.
So let's use it carefully as a supporter.
Best regards !
TNZ - Index above MA Use this indicator to filter stock selection based on the relevant index value being above the selected simple moving average.
For example, only buying the S+P 500 stock if the S+P 500 index value is above the 10 period moving average.
The time frame used is that displayed
Macroeconomic Artificial Neural Networks
This script was created by training 20 selected macroeconomic data to construct artificial neural networks on the S&P 500 index.
No technical analysis data were used.
The average error rate is 0.01.
In this respect, there is a strong relationship between the index and macroeconomic data.
Although it affects the whole world,I personally recommend using it under the following conditions: S&P 500 and related ETFs in 1W time-frame (TF = 1W SPX500USD, SP1!, SPY, SPX etc. )
Macroeconomic Parameters
Effective Federal Funds Rate (FEDFUNDS)
Initial Claims (ICSA)
Civilian Unemployment Rate (UNRATE)
10 Year Treasury Constant Maturity Rate (DGS10)
Gross Domestic Product , 1 Decimal (GDP)
Trade Weighted US Dollar Index : Major Currencies (DTWEXM)
Consumer Price Index For All Urban Consumers (CPIAUCSL)
M1 Money Stock (M1)
M2 Money Stock (M2)
2 - Year Treasury Constant Maturity Rate (DGS2)
30 Year Treasury Constant Maturity Rate (DGS30)
Industrial Production Index (INDPRO)
5-Year Treasury Constant Maturity Rate (FRED : DGS5)
Light Weight Vehicle Sales: Autos and Light Trucks (ALTSALES)
Civilian Employment Population Ratio (EMRATIO)
Capacity Utilization (TOTAL INDUSTRY) (TCU)
Average (Mean) Duration Of Unemployment (UEMPMEAN)
Manufacturing Employment Index (MAN_EMPL)
Manufacturers' New Orders (NEWORDER)
ISM Manufacturing Index (MAN : PMI)
Artificial Neural Network (ANN) Training Details :
Learning cycles: 16231
AutoSave cycles: 100
Grid
Input columns: 19
Output columns: 1
Excluded columns: 0
Training example rows: 998
Validating example rows: 0
Querying example rows: 0
Excluded example rows: 0
Duplicated example rows: 0
Network
Input nodes connected: 19
Hidden layer 1 nodes: 2
Hidden layer 2 nodes: 0
Hidden layer 3 nodes: 0
Output nodes: 1
Controls
Learning rate: 0.1000
Momentum: 0.8000 (Optimized)
Target error: 0.0100
Training error: 0.010000
NOTE : Alerts added . The red histogram represents the bear market and the green histogram represents the bull market.
Bars subject to region changes are shown as background colors. (Teal = Bull , Maroon = Bear Market )
I hope it will be useful in your studies and analysis, regards.
Damped Sine Wave Weighted FilterIntroduction
Remember that we can make filters by using convolution, that is summing the product between the input and the filter coefficients, the set of filter coefficients is sometime denoted "kernel", those coefficients can be a same value (simple moving average), a linear function (linearly weighted moving average), a gaussian function (gaussian filter), a polynomial function (lsma of degree p with p = order of the polynomial), you can make many types of kernels, note however that it is easy to fall into the redundancy trap.
Today a low-lag filter who weight the price with a damped sine wave is proposed, the filter characteristics are discussed below.
A Damped Sine Wave
A damped sine wave is a like a sine wave with the difference that the sine wave peak amplitude decay over time.
A damped sine wave
Used Kernel
We use a damped sine wave of period length as kernel.
The coefficients underweight older values which allow the filter to reduce lag.
Step Response
Because the filter has overshoot in the step response we can conclude that there are frequencies amplified in the passband, we could have reached to this conclusion by simply seeing the negative values in the kernel or the "zero-lag" effect on the closing price.
Enough ! We Want To See The Filter !
I should indeed stop bothering you with transient responses but its always good to see how the filter act on simpler signals before seeing it on the closing price. The filter has low-lag and can be used as input for other indicators
Filter with length = 100 as input for the rsi.
The bands trailing stop utility using rolling squared mean average error with length 500 using the filter of length 500 as input.
Approximating A Least Squares Moving Average
A least squares moving average has a linear kernel with certain values under 0, a lsma of length k can be approximated using the proposed filter using period p where p = k + k/4 .
Proposed filter (red) with length = 250 and lsma (blue) with length = 200.
Conclusions
The use of damping in filter design can provide extremely useful filters, in fact the ideal kernel, the sinc function, is also a damped sine wave.
VIX reversion-Buschi
English:
A significant intraday reversion (commonly used: 3 points) on a high (over 20 points) S&P 500 Volatility Index (VIX) can be a sign of a market bottom, because there is the assumption that some of the "big guys" liquidated their options / insurances because the worst is over.
This indicator shows these reversions (3 points as default) when the VIX was over 20 points. The character "R" is then shown directly over the daily column, the VIX need not to be loaded explicitly.
Deutsch:
Eine deutliche Intraday-Umkehr (3 Punkte im Normalfall) bei einem hohen (über 20 Punkte) S&P 500 Volatility Index (VIX) kann ein Zeichen für eine Bodenbildung im Markt sein, weil möglicherweise einige "große Jungs" ihre Optionen / Versicherungen auflösen, weil das schlimmste vorbei ist.
Dieser Indikator zeigt diese Umkehr (Standardwert: 3 Punkte), wenn der VIX vorher über 20 Punkte lag. Der Buchstabe "R" wird dabei direkt über dem Tagesbalken angezeigt, wobei der VIX nicht explizit geladen werden muss.
Relative Price StrengthThe strength of a stock relative to the S&P 500 is key part of most traders decision making process. Hence the default reference security is SPY, the most commonly trades S&P 500 ETF.
Most profitable traders buy stocks that are showing persistence intermediate strength verses the S&P as this has been shown to work. Hence the default period is 63 days or 3 months.
TICK Extremes IndicatorSimple TICK indicator, plots candles and HL2 line
Conditional green/red coloring for highs above 500, 900 and lows above 0, and for lows below -500, -900, and highs above 0
Probably best used for 1 - 5 min timeframes
Always open to suggestions if criteria needs tweaking or if something else would make it more useful or user-friendly!
Market direction and pullback based on S&P 500.A simple indicator based on www.swing-trade-stocks.com The link is also the guide for how to use it.
0 - nothing. If the indicator is showing 0 for a prolonged amount of time, it is likely the market is in "momentum mode" (referred to in the link above).
1 - indicates an uptrend based on SMA and EMA and also a place where a reversal to the upside is likely to occur. You should look only for long trades in the stock market when you see a spike upwards and S&P 500 is showing an obvious uptrend.
-1 - indicates a downtrend based on SMA and EMA and also a place where a reversal to the downside is likely to occur. You should look only for short trades in the stock market when you see a spike upwards and S&P 500 is showing an obvious uptrend.
Net XRP Margin PositionTotal XRP Longs minus XRP Shorts in order to give you the total outstanding XRP margin debt.
ie: If 500,000 XRP has been longed, and 400,000 XRP has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 XRP (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
Net DASH Margin PositionTotal DASH Longs minus DASH Shorts in order to give you the total outstanding DASH margin debt.
ie: If 500,000 DASH has been longed, and 400,000 DASH has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 DASH (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
(Anyone know what category this script should be in?)
Net NEO Margin PositionTotal NEO Longs minus NEO Shorts in order to give you the total outstanding NEO margin debt.
ie: If 500,000 NEO has been longed, and 400,000 NEO has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 NEO (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
(Anyone know what category this script should be in?)
Everyday 0002 _ MAC 1st Trading Hour WalkoverThis is the second strategy for my Everyday project.
Like I wrote the last time - my goal is to create a new strategy everyday
for the rest of 2016 and post it here on TradingView.
I'm a complete beginner so this is my way of learning about coding strategies.
I'll give myself between 15 minutes and 2 hours to complete each creation.
This is basically a repetition of the first strategy I wrote - a Moving Average Crossover,
but I added a tiny thing.
I read that "Statistics have proven that the daily high or low is established within the first hour of trading on more than 70% of the time."
(source: )
My first Moving Average Crossover strategy, tested on VOLVB daily, got stoped out by the volatility
and because of this missed one nice bull run and a very nice bear run.
So I added this single line: if time("60", "1000-1600") regarding when to take exits:
if time("60", "1000-1600")
strategy.exit("Close Long", "Long", profit=2000, loss=500)
strategy.exit("Close Short", "Short", profit=2000, loss=500)
Sweden is UTC+2 so I guess UTC 1000 equals 12.00 in Stockholm. Not sure if this is correct, actually.
Anyway, I hope this means the strategy will only take exits based on price action which occur in the afternoon, when there is a higher probability of a lower volatility.
When I ran the new modified strategy on the same VOLVB daily it didn't get stoped out so easily.
On the other hand I'll have to test this on various stocks .
Reading and learning about how to properly test strategies is on my todo list - all tips on youtube videos or blogs
to read on this topic is very welcome!
Like I said the last time, I'm posting these strategies hoping to learn from the community - so any feedback, advice, or corrections is very much welcome and appreciated!
/pbergden
Average True Range (ATR)Strategy Name: ATR Trend-Following System with Volatility Filter & Dynamic Risk Management
Short Name: ATR Pro Trend System
Current Version: 2025 Edition (fully tested and optimized)Core ConceptA clean, robust, and highly profitable trend-following strategy that only trades when three strict conditions are met simultaneously:Clear trend direction (price above/below EMA 50)
Confirmed trend strength and trailing stop (SuperTrend)
Sufficient market volatility (current ATR(14) > its 50-period average)
This combination ensures the strategy stays out of choppy, low-volatility ranges and only enters during high-probability, trending moves with real momentum.Key Features & ComponentsComponent
Function
Default Settings
EMA 50
Primary trend filter
50-period exponential
SuperTrend
Dynamic trailing stop + secondary trend confirmation
Period 10, Multiplier 3.0
ATR(14) with RMA
True volatility measurement (Wilder’s original method)
Length 14
50-period SMA of ATR
Volatility filter – only trade when current ATR > average ATR
Length 50
Background coloring
Visual position status: light green = long, light red = short, white = flat
–
Entry markers
Green/red triangles at the exact entry bar
–
Dynamic position sizing
Fixed-fractional risk: exactly 1% of equity per trade
1.00% risk
Stop distance
2.5 × ATR(14) – fully adaptive to current volatility
Multiplier 2.5
Entry RulesLong: Close > EMA 50 AND SuperTrend bullish AND ATR(14) > SMA(ATR,50)
Short: Close < EMA 50 AND SuperTrend bearish AND ATR(14) > SMA(ATR,50)
Exit RulesPosition is closed automatically when SuperTrend flips direction (acts as volatility-adjusted trailing stop).
Money ManagementRisk per trade: exactly 1% of current account equity
Position size is recalculated on every new entry based on current ATR
Automatically scales up in strong trends, scales down in low-volatility regimes
Performance Highlights (2015–Nov 2025, real backtests)CAGR: 22–50% depending on market
Max Drawdown: 18–28%
Profit Factor: 1.89–2.44
Win Rate: 57–62%
Average holding time: 10–25 days (daily timeframe)
Best Markets & TimeframesExcellent on: Bitcoin, S&P 500, Nasdaq-100, DAX, Gold, major Forex pairs
Recommended timeframes: 4H, Daily, Weekly (Daily is the sweet spot)
NQUSB Sector Industry Stocks Strength
A Comprehensive Multi-Industry Performance Comparison Tool
The complete Pine Script code and supporting Python automation scripts are available on GitHub:
GitHub Repository: github.com
Original idea from by www.tradingview.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ WHAT'S NEW ═══
4-Level Hierarchical Navigation:
Primary: All 11 NQUSB sectors (NQUSB10, NQUSB15, NQUSB20, etc.)
Secondary (Default): Broad sectors like Technology, Energy
Tertiary: Industry groups within sectors
Quaternary: Individual stocks within industries (37 semiconductors)
Enhanced Stock Coverage:
1,176 total stocks across 129 industries
37 semiconductor stocks
Market-cap weighted selection: 60% tech / 35% others
Range: 1-37 stocks per industry
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ CORE FEATURES ═══
1. Drill-Down/Drill-Up Navigation
View NVDA at different granularity levels:
Quaternary: ● NVDA ranks #3 of 37 semiconductors
Tertiary: ✓ Semiconductors at 85% (strongest in tech hardware)
Secondary: ✓ Tech Hardware at 82% (stronger than software)
Primary: ✓ Technology at 78% (#1 sector overall)
Insight: One indicator, one stock, four perspectives - instantly see if strength is stock-specific, industry-specific, or sector-wide.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2. Visual Current Stock Identification
Violet Markers - Instant Recognition:
● (dot) marker when current stock is in top N performers
✕ (cross) marker when current stock is below top N
Violet color (#9C27B0) on both symbol and value labels
Example: "NVDA ● ranks #3 of 37"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3. Rank Display in Title
Dynamic title shows performance context:
"Semiconductors (RS Rating - 3 Months) | NVDA ranks #3 of 37"
#1 = Best performer, higher number = lower rank
Total adjusts if current stock auto-added
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4. Auto-Add Current Stock
Always Included:
Current stock automatically added if not in predefined list
Example: Viewing PRSO → "PRSO ranks #37 of 39 ✕"
Works for any stock - from NVDA to obscure small-caps
Violet markers ensure visibility even when ranked low
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ DUAL PERFORMANCE METRICS ═══
RS Rating (Relative Strength):
Normalized strength score 1-99
Compare stocks across different price ranges
Default benchmark: SPX
% Return:
Simple percentage price change
Direct performance comparison
11 Time Periods:
1 Week, 2 Weeks, 1 Month, 2 Months, 3 Months (Default) , 6 Months, 1 Year, YTD, MTD, QTD, Custom (1-500 days)
Result: 22 analytical combinations (2 metrics × 11 periods)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ USE CASES ═══
Sector Rotation Analysis:
Is NVDA's strength semiconductors-specific or tech-wide?
Drill through all 4 levels to find answer
Identify which industry groups are leading/lagging
Finding Hidden Gems:
JPM ranks #3 of 13 in Major Banks
But Financials sector weak overall (68%)
= Relative strength play in weak sector
Cross-Industry Comparison:
129 industries covered
Market-wide scan capability
Find strongest performers across all sectors
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ TECHNICAL SPECIFICATIONS ═══
V32 Stats:
Total Industries: 129
Total Stocks: 1,176
File Size: 82,032 bytes (80.1 KB)
Request Limit: 39 max (Semiconductors), 10-16 typical
Granularity Levels: 4 (Primary → Quaternary)
Smart Stock Allocation:
Technology industries: 60% coverage
Other industries: 35% coverage
Market-cap weighted selection
Formula: MIN(39, MAX(5, CEILING(total × percentage)))
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
═══ KEY ADVANTAGES ═══
vs. Single Industry Tools:
✓ 129 industries vs 1
✓ Market-wide perspective
✓ Hierarchical navigation
✓ Sector rotation detection
vs. Manual Comparison:
✓ No ETF research needed
✓ Instant visual markers
✓ Automatic ranking
✓ One-click drill-down
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
For complete documentation, Python automation scripts, and CSV data files:
github.com
Version: V32
Last Updated: 2025-11-30
Pine Script Version: v5
Viprasol Elite Flow Pro - Premium Order Flow & Trend System═══════════════════════════════════════════════════════════════
🔥 VIPRASOL ELITE FLOW PRO
Professional Order Flow & Trend Detection System
═══════════════════════════════════════════════════════════════
📊 WHAT IS THIS INDICATOR?
Viprasol Elite Flow Pro is a comprehensive trading system that combines institutional order flow analysis with adaptive trend detection. Unlike basic indicators, this tool identifies high-probability setups by analyzing where smart money is likely positioning, while filtering signals through multiple confirmation layers.
This indicator is designed for traders who want to:
✓ Identify premium (supply) and discount (demand) zones automatically
✓ Detect trend direction with adaptive cloud technology
✓ Spot high-volume rejection points before major moves
✓ Filter low-quality signals with intelligent confirmation logic
✓ Track market strength in real-time via elite dashboard
═══════════════════════════════════════════════════════════════
🎯 CORE FEATURES
═══════════════════════════════════════════════════════════════
1️⃣ ELITE TREND ENGINE
• Adaptive Moving Average system (Fast/Adaptive/Smooth modes)
• Dynamic trend cloud that expands/contracts with volatility
• Real-time trend state tracking (Bullish/Bearish/Ranging)
• Trend strength meter (0-10 scale)
• ATR-based volatility adjustments
2️⃣ ORDER FLOW DETECTION
• Automatic Premium Zone (Supply) identification
• Automatic Discount Zone (Demand) identification
• Smart zone extension - zones remain valid until broken
• Zone rejection detection with price action confirmation
• Customizable zone strength (5-30 bars lookback)
3️⃣ VOLUME INTELLIGENCE
• Volume spike detection (configurable threshold)
• Climax bar identification (exhaustion signals)
• Volume filter for signal validation
• Institutional activity detection
4️⃣ SMART SIGNAL SYSTEM
• 3 Signal Modes: Aggressive, Balanced, Conservative
• Multi-layer confirmation logic
• Automatic profit targets (2:1 risk-reward)
• Stop loss suggestions based on ATR
• Prevents overtrading with bars-since-signal filter
5️⃣ ELITE DASHBOARD (HUD)
• Real-time trend direction and strength
• Volume status monitoring
• Active zones counter
• Market volatility gauge
• Current signal status
• 4 positioning options, compact mode available
6️⃣ PREMIUM STYLING
• 4 Professional color themes (Cyber/Gold/Ocean/Fire)
• Adjustable transparency and label sizes
• Clean, institutional-grade visuals
• Optimized for all chart types
═══════════════════════════════════════════════════════════════
📖 HOW TO USE THIS INDICATOR
═══════════════════════════════════════════════════════════════
STEP 1: TREND IDENTIFICATION
→ Green Cloud = Bullish trend - look for LONG opportunities
→ Red Cloud = Bearish trend - look for SHORT opportunities
→ Purple Cloud = Ranging - wait for breakout or fade extremes
STEP 2: ZONE ANALYSIS
→ PREMIUM (Red) zones = Potential resistance/supply areas
→ DISCOUNT (Green) zones = Potential support/demand areas
→ Price rejecting from zones = high-probability setups
STEP 3: SIGNAL CONFIRMATION
→ Wait for "LONG" or "SHORT" labels to appear
→ Check dashboard for trend strength (Moderate/Strong preferred)
→ Confirm volume status is "HIGH" or "CLIMAX"
→ Entry: Enter when label appears
→ Stop Loss: Use dotted line (1 ATR away)
→ Take Profit: Use dashed line (2 ATR away)
STEP 4: RISK MANAGEMENT
→ Never risk more than 1-2% per trade
→ Use the provided stop loss levels
→ Trail stops as price moves in your favor
→ Avoid trading during low volatility periods
═══════════════════════════════════════════════════════════════
⚙️ RECOMMENDED SETTINGS
═══════════════════════════════════════════════════════════════
FOR SCALPING (1M - 5M):
- Trend Type: Fast
- Sensitivity: 15
- Signal Mode: Aggressive
- Zone Strength: 8
FOR DAY TRADING (15M - 1H):
- Trend Type: Adaptive
- Sensitivity: 21 (default)
- Signal Mode: Balanced
- Zone Strength: 12 (default)
FOR SWING TRADING (4H - Daily):
- Trend Type: Smooth
- Sensitivity: 34
- Signal Mode: Conservative
- Zone Strength: 20
BEST MARKETS:
✓ Crypto (BTC, ETH, major altcoins)
✓ Forex (Major pairs: EUR/USD, GBP/USD)
✓ Indices (S&P 500, NASDAQ, DAX)
✓ High-liquidity stocks
═══════════════════════════════════════════════════════════════
🎓 UNDERSTANDING THE METHODOLOGY
═══════════════════════════════════════════════════════════════
This indicator is built on three core concepts:
1. ORDER FLOW THEORY
Markets move between premium (expensive) and discount (cheap) zones. Smart money accumulates in discount zones and distributes in premium zones. This indicator identifies these zones automatically.
2. ADAPTIVE TREND FOLLOWING
Unlike fixed-period moving averages, the Elite Trend Engine adjusts to current market volatility, providing more accurate trend signals in both trending and ranging conditions.
3. CONFLUENCE-BASED ENTRIES
Signals only trigger when multiple conditions align:
- Price in correct zone (premium for shorts, discount for longs)
- Trend confirmation (cloud color matches direction)
- Volume validation (spike or climax present)
- Price action strength (strong rejection candles)
This multi-layer approach dramatically reduces false signals.
═══════════════════════════════════════════════════════════════
🔔 ALERT SETUP
═══════════════════════════════════════════════════════════════
This indicator includes 5 alert types:
1. Long Signal → Triggers when buy conditions met
2. Short Signal → Triggers when sell conditions met
3. Volume Climax → Warns of pot
Trendshift [CHE] StrategyTrendshift Strategy — First-Shift Structural Regime Trading
Profitfactor 2,603
Summary
Trendshift Strategy implements a structural regime-shift trading model built around the earliest confirmed change in directional structure. It identifies major swing highs and lows, validates breakouts through optional ATR-based conviction, and reacts only to the first confirmed shift in each direction. After a regime reversal, the strategy constructs a premium and discount band between the breakout candle and the previous opposite swing. This band is used as contextual bias and may optionally inform stop placement and position sizing.
The strategy focuses on clear, interpretable structural events rather than continuous signal generation. By limiting entries to the first valid shift, it reduces false recycles and allows the structural state to stabilize before a new trade occurs. All signals operate on closed-bar logic, and the strategy avoids higher-timeframe calls to stabilize execution behavior.
Motivation: Why this design?
Many structure-based systems repeatedly trigger as price fluctuates around prior highs and lows. This often leads to multiple flips during volatile or choppy conditions. Trendshift Strategy addresses this problem by restricting execution to the first confirmed structural event in each direction. ATR-based filters help differentiate genuine structural breaks from noise, while the contextual band ensures that the breakout is meaningful in relation to recent volatility.
The design aims to represent a minimalistic structural trading framework focused on regime turns rather than continuous trend signaling. This reduces chart noise and clarifies where the market transitions from one regime to another.
What’s different vs. standard approaches?
Baseline reference
Typical swing-based structure indicators report every break above or below recent swing points.
Architecture differences
First-shift-only regime logic that blocks repeated signals until direction reverses
ATR-filtered validation to avoid weak or momentum-less breaks
Premium and discount bands derived from breakout structure
Optional band-driven stop placement
Optional band-dependent position-sizing factor
Regime timeout system to neutralize structure after extended inactivity
Persistent-state architecture to prevent re-triggering
Practical effect
Only the earliest actionable structure change is traded
Fewer but higher-quality signals
Premium/discount tint assists contextual evaluation
Stops and sizing can be aligned with structural context rather than arbitrary volatility measures
Improved chart interpretability due to reduced marker frequency
How it works (technical)
The algorithm evaluates symmetric swing points using a fixed bar window. When a swing forms, its value and bar index are stored as persistent state. A structural shift occurs when price closes beyond the most recent major swing on the opposite side. If ATR filtering is enabled, the breakout must exceed a volatility-scaled distance to prevent micro-breaks from firing.
Once a valid shift is confirmed, the regime is updated to bullish or bearish. The script records the breakout level, the opposite swing, and derives a band between them. This band is checked for minimum size relative to ATR to avoid unrealistic contexts.
The first shift in a new direction generates both the strategy entry and a visual marker. Additional shifts in the same direction are suppressed until a reversal occurs. If a timeout is enabled, the regime resets after a specified number of bars without structural change, optionally clearing the band.
Stop placement, if enabled, uses either the opposite or same band edge depending on configuration. Position size is computed from account percentage and may optionally scale with the price-span-to-ATR relationship.
Parameter Guide
Market Structure
Swing length (default 5): Controls swing sensitivity. Lower values increase responsiveness.
Use ATR filter (default true): Requires breakouts to show momentum relative to ATR. Reduces false shifts.
ATR length (default 14): Volatility estimation for breakout and band validation.
Break ATR multiplier (default 1.0): Required breakout strength relative to ATR.
Premium/Discount Framework
Enable framework (default true): Activates premium/discount evaluation.
Persist band on timeout (default true): Keeps structural band after timeout.
Min band ATR mult (default 0.5): Rejects narrow bands.
Regime timeout bars (default 500): Neutralizes regime after inactivity.
Invert colors (default false): Color scheme toggle.
Visuals
Show zone tint (default true): Background shade in premium or discount region.
Show shift markers (default true): Display first-shift markers.
Execution and Risk
Risk per trade percent (default 1.0): Determines position size as account percentage.
Use band for size (default false): Scales size relative to band width behavior.
Flat on opposite shift (default true): Forces reversal behavior.
Use stop at band (default false): Stop anchored to band edges.
Stop band side: Chooses which band edge is used for stop generation.
Reading & Interpretation
A green background indicates discount conditions within the structural band; red indicates premium conditions. A green triangle below price marks the first bullish structural shift after a bearish regime. A red triangle above price marks the first bearish structural shift after a bullish regime.
When stops are active, the opposite band edge typically defines the protective level. Band width relative to ATR indicates how significant a structural change is: wider bands imply stronger volatility structure, while narrow bands may be suppressed by the minimum-size filter.
Practical Workflows & Combinations
Trend following: Use first-shift entries as initial regime confirmation. Add higher-timeframe trend filters for additional context.
Swing trading: Combine with simple liquidity or fair-value-gap concepts to refine entries.
Bias mapping: Use higher timeframes for structural regime and lower timeframes for execution within the premium/discount context.
Exit management: When using stops, consider ATR-scaling or multi-stage profit targets. When not using stops, reversals become the primary exit.
Behavior, Constraints & Performance
The strategy uses only confirmed swings and closed-bar logic, avoiding intrabar repaint. Pivot-based swings inherently appear after the pivot window completes, which is standard behavior. No higher-timeframe calls are used, preventing HTF-related repaint issues.
Persistent variables track regime and structural levels, minimizing recomputation. The maximum bars back setting is five-thousand. The design avoids loops and arrays, keeping performance stable.
Known limitations include limited signal density during consolidations, delayed swing confirmation, and sensitivity to extreme gaps that stretch band logic. ATR filtering mitigates some of these effects but does not eliminate them entirely.
Sensible Defaults & Quick Tuning
Fewer but stronger entries: Increase swing length or ATR breakout multiplier.
More responsive entries: Reduce swing length to capture earlier shifts.
More active band behavior: Lower the minimum band ATR threshold.
Stricter stop logic: Use the opposite band edge for stop placement.
Volatile markets: Increase ATR length slightly to stabilize behavior.
What this indicator is—and isn’t
Trendshift Strategy is a structural-regime trading engine that evaluates major directional shifts. It is not a complete trading system and does not include take-profit logic or prediction features. It does not attempt to forecast future price movement and should be used alongside broader market structure, volatility context, and disciplined risk management.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
Trendshift [CHE]Trendshift — First-Shift Regime Turns with Premium/Discount Context
Summary
Trendshift highlights the first confirmed directional structure shift in price and overlays a premium or discount context based on the most recent structural range. It identifies the major swing levels, detects a regime transition when price closes beyond these levels with optional ATR-based conviction, and marks only the first shift per direction to reduce repetition and noise. The indicator then establishes a premium or discount band around the break and tints the background when price operates in either region. This produces a clean regime-aware view that emphasizes only the earliest actionable turn while maintaining contextual bias information.
Motivation: Why this design?
Conventional swing-based structure tools often fire repeated signals after each minor break, especially in volatile environments. This leads to cluttered charts and little informational value. Trendshift focuses on the core trading need: isolating the first confirmed change in directional structure and providing a premium or discount context after the break. By limiting signals to the initial flip and suppressing further markers until direction reverses again, the script reduces noise and highlights only the structural event that materially matters. The band logic further addresses the challenge of distinguishing contextual extremes and avoiding trades taken too late after a shift.
What’s different vs. standard approaches?
Baseline reference: Most structure indicators repeatedly plot every new break of a swing high or swing low.
Differences:
Only the first confirmed bullish or bearish shift is plotted until the opposite direction occurs.
ATR-filtered breakout validation to reduce false breaks during volatility spikes.
A reduced premium and discount band derived from the breakout candle and prior swing structure.
Tinted background for contextual positioning rather than explicit entry signals.
Practical effect:
Fewer but more meaningful shift markers.
Clear visual context of where price operates relative to the structural band.
Cleaner regime transitions and less chart clutter.
How it works (technical)
The indicator continuously evaluates major swing highs and lows using a symmetric window length. When a swing is confirmed, the script stores its price and bar index. A structure shift occurs when price closes beyond the most recent major swing in the opposite direction. Optional ATR filtering requires the breakout distance to exceed an ATR-scaled threshold.
Upon a confirmed shift, the script sets a regime state that remains active until a new shift or an optional timeout. It also establishes a structural band anchored between the breakout candle extremum and the prior opposite swing. The band informs the premium and discount boundaries, each representing a quarter subdivision.
Only the first shift event per direction generates a visual triangle marker. The band is validated by comparing its height to ATR to avoid extremely narrow structures. Background tinting activates whenever price resides within the premium or discount zones. Persistent variables maintain previous structural states and prevent re-triggering until direction reverses.
Parameter Guide
Swing length (default 5): Controls the number of bars used on each side of a swing. Smaller values are more reactive; larger values reduce noise.
Use ATR filter (default true): Requires breakout strength beyond the swing to exceed an ATR-scaled threshold. Disabling increases signal frequency.
ATR length (default 14): Controls volatility estimation for breakout filtering and band validation.
Break ATR multiplier (default 1.0): Higher values require stronger breakouts, reducing false shifts.
Enable framework (default true): Activates the premium and discount context logic.
Persist band on timeout (default true): Retains the current band after a regime timeout.
Min band size ATR mult (default 0.5): Rejects extremely small bands and prevents unrealistic tinting.
Regime timeout bars (default 500): Resets the regime after extended inactivity.
Invert colors (default false): Swaps premium and discount tint color assignments.
Show zone tint (default true): Toggles background shading.
Show shift markers (default true): Enables or disables the first-shift triangles.
Reading & Interpretation
A green or red tint signals that price is operating in the discount or premium region of the most recent structural band. These regions are derived from the breakout event and the prior swing. A green triangle below a bar indicates the first bullish structure shift after a bearish regime. A red triangle above a bar indicates the first bearish shift after a bullish regime. No further markers appear until direction reverses. When tint is active, price location within the band offers simple contextual bias without providing explicit entries.
Practical Workflows & Combinations
Trend following: Treat the first bullish marker as the earliest confirmation of a potential up-regime and the first bearish marker for a potential down-regime. Use price location relative to the premium and discount zones as context for continuation or mean-reversion setups.
Structure-based execution: Combine with simple swing highs and lows to refine entry points within discount after a bullish shift or within premium after a bearish shift.
Higher-timeframe overlays: Apply the indicator on higher timeframes to define macro structure, then trade on lower timeframes using the band as a contextual anchor.
Risk management: When price stays in premium during a bearish regime or in discount during a bullish regime, consider protective actions or position management adjustments.
Behavior, Constraints & Performance
The script uses only confirmed swing points and closed-bar conditions, so repainting from future bars does not occur except the inherent delay of pivot confirmation. No higher-timeframe security calls are used, avoiding HTF repaint paths.
Performance impact is minimal because the script uses no loops or arrays and relies on persistent variables. The maximum bars back setting is five-thousand, required for swing lookback. Known limitations include quiet behavior during long consolidations, occasional delayed recognition of shifts due to swing confirmation, and limited effectiveness during large market gaps where extremum logic may be distorted.
Sensible Defaults & Quick Tunin g
Increase the swing length for smoother trend shifts and fewer signals.
Decrease the swing length for more sensitivity.
Raise the ATR breakout multiplier to reduce noise in volatile markets.
Lower the band size requirement to make premium and discount zones more active on slower markets.
Extend the regime timeout for slow-moving assets.
What this indicator is—and isn’t
This tool is a structural regime-shift detector with contextual premium and discount shading. It is not a complete trading system and does not include entries, exits, or risk models. It does not predict future price movement. It should be combined with broader structure analysis, liquidity considerations, and risk management practices.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)//@version=5
indicator("SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)", overlay=true, max_labels_count=500)
// ---------------- INPUTS ----------------
emaFastLen = input.int(9, "EMA Fast")
emaSlowLen = input.int(21, "EMA Slow")
atrLen = input.int(14, "ATR Length")
atrMultSL = input.float(1.2, "SL = ATR *")
tp1mult = input.float(1.0, "TP1 = ATR *")
tp2mult = input.float(1.5, "TP2 = ATR *")
tp3mult = input.float(2.0, "TP3 = ATR *")
minBars = input.int(3, "Min bars between signals")
showDashboard = input.bool(true, "Show Dashboard")
// ---------------- INDICATORS ----------------
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
atr = ta.atr(atrLen)
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow
crossUp = ta.crossover(emaFast, emaSlow) and bullTrend
crossDown = ta.crossunder(emaFast, emaSlow) and bearTrend
var int lastSignal = na
okSignal = na(lastSignal) or (bar_index - lastSignal > minBars)
buySignal = crossUp and okSignal
sellSignal = crossDown and okSignal
if buySignal or sellSignal
lastSignal := bar_index
// ---------------- TP & SL ----------------
var float sl = na
var float tp1 = na
var float tp2 = na
var float tp3 = na
if buySignal
sl := close - atr * atrMultSL
tp1 := close + atr * tp1mult
tp2 := close + atr * tp2mult
tp3 := close + atr * tp3mult
if sellSignal
sl := close + atr * atrMultSL
tp1 := close - atr * tp1mult
tp2 := close - atr * tp2mult
tp3 := close - atr * tp3mult
// ---------------- ALERTS ----------------
alertcondition(buySignal, title="BUY", message="BUY Signal")
alertcondition(sellSignal, title="SELL", message="SELL Signal")
alertcondition(ta.cross(close, tp1), title="TP1", message="TP1 Hit")
alertcondition(ta.cross(close, tp2), title="TP2", message="TP2 Hit")
alertcondition(ta.cross(close, tp3), title="TP3", message="TP3 Hit")
alertcondition(ta.cross(close, sl), title="SL", message="Stop Loss Hit")
// ---------------- DASHBOARD ----------------
if showDashboard
var table dash = table.new(position.top_right, 1, 5)
if barstate.islast
table.cell(dash, 0, 0, "SCALPING PRO V2", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 0, 1, "Trend: " + (bullTrend ? "Bull" : bearTrend ? "Bear" : "Neutral"))
table.cell(dash, 0, 2, "ATR: " + str.tostring(atr, format.mintick))
table.cell(dash, 0, 3, "Last Signal: " + (buySignal ? "BUY" : sellSignal ? "SELL" : "NONE"))
table.cell(dash, 0, 4, "EMA Fast/Slow OK")
均线变色K线系统 with 转折箭头//@version=6
indicator("均线变色K线系统 with 转折箭头", overlay=true, max_lines_count=500, max_labels_count=200)
// 输入参数
ma_length = input.int(20, title="均线周期", minval=1)
atr_filter = input.bool(true, title="启用ATR波动过滤")
atr_length = input.int(14, title="ATR周期", minval=1)
atr_multiplier = input.float(1.5, title="ATR波动阈值", minval=0.1, step=0.1)
show_arrows = input.bool(true, title="显示转折箭头")
candle_coloring = input.bool(true, title="启用K线变色")
// 计算均线和ATR
ma = ta.sma(close, ma_length)
atr_value = ta.atr(atr_length)
avg_atr = ta.sma(atr_value, atr_length)
// 判断均线方向和趋势转折点
ma_rising = ta.rising(ma, 1)
ma_falling = ta.falling(ma, 1)
// 使用更严格的趋势转折检测(避免repainting)
ma_rising_prev = ta.rising(ma, 2)
ma_falling_prev = ta.falling(ma, 2)
// 检测趋势转折点(确保只在K线收盘确认时检测)
trend_change_up = ma_rising and not ma_rising_prev and (not atr_filter or atr_value >= avg_atr * atr_multiplier)
trend_change_down = ma_falling and not ma_falling_prev and (not atr_filter or atr_value >= avg_atr * atr_multiplier)
// 设置颜色
ma_color = ma_rising ? color.rgb(255, 0, 0) : color.rgb(0, 0, 255) // 红/蓝
candle_color = ma_rising ? color.rgb(255, 0, 0) : color.rgb(0, 0, 255)
border_color = ma_rising ? color.rgb(255, 0, 0) : color.rgb(0, 0, 255)
wick_color = ma_rising ? color.rgb(255, 0, 0) : color.rgb(0, 0, 255)
// 绘制彩色均线
plot(ma, color=ma_color, linewidth=2, title="变色均线")
// 使用plotcandle绘制彩色K线
plotcandle(candle_coloring ? open : na,
candle_coloring ? high : na,
candle_coloring ? low : na,
candle_coloring ? close : na,
title="变色K线",
color = candle_color,
wickcolor = wick_color,
bordercolor = border_color,
editable = true)
// 绘制趋势转折箭头(只在K线确认时显示)
if show_arrows and barstate.isconfirmed
if trend_change_up
label.new(bar_index, low * 0.998, "▲",
color=color.rgb(0, 255, 0),
textcolor=color.white,
style=label.style_label_up,
yloc=yloc.price,
size=size.normal)
else if trend_change_down
label.new(bar_index, high * 1.002, "▼",
color=color.rgb(255, 0, 0),
textcolor=color.white,
style=label.style_label_down,
yloc=yloc.price,
size=size.normal)
// 背景色轻微提示(可选)
bgcolor(ma_rising ? color.new(color.red, 95) : color.new(color.blue, 95), title="趋势背景提示")
P&F Label Overlay🧙 The Wizard's Challenge: P&F Label Overlay on Your Chart
This is a custom Pine Script indicator designed to overlay the classic Point & Figure (P&F) pattern directly onto your standard candlestick or bar chart. While Pine Script offers built-in, dedicated P&F charts, this indicator was created as a challenging and experimental project to satisfy the goal of visualizing the P&F X's and O's directly on the price bars.
❶. How to Use This Code on TradingView
1. Copy the Code: Copy the entire Pine Script code provided above.
2. Open Pine Editor: On TradingView, click the "Pine Editor" tab at the bottom of your chart.
3. Replace Content: Delete any existing code in the editor and paste this P&F script.
4. Add to Chart: Click the "Add to Chart" button (usually located near the top right of the Pine Editor).
5. Access Settings: The indicator, named "P&F Label Overlay: The Wizard's Challenge," will appear on your chart. You can click the gear icon ( ) next to its name on the chart to adjust the inputs.
❷. 🎛️ Key Settings & Customization (Inputs)
The indicator provides core P&F settings that you can customize to fit your analysis style:
✅ Enable Auto Box Size (Default: True): When enabled, the box size is automatically calculated as a percentage of the current price, making it dynamic.
・Auto Box Size Basis (%): Sets the percentage used to calculate the dynamic box size. (e.g., 2% of the price).
・Fixed Box Size (Price Units): When "Enable Auto Box Size" is disabled, this value is used as the static box size (e.g., a value of 5.0 for a $5 box).
・Reversal Count (Default: 3): This is the crucial P&F parameter (the Reversal Factor). It determines how many boxes the price must move in the opposite direction to trigger a column reversal (e.g., 3 means price must reverse by 3 \times \text{BOX\_SIZE}).
Calculation Source: Allows you to choose the price data used for calculations (e.g., close, hl2 (High/Low/2), etc.).
❸. 🎯 The Challenge: Why an Overlay?
This indicator represents an experimental and challenging endeavor made in collaboration with an AI. It stems from the strong desire to visualize P&F patterns overlaid on a conventional chart, which is not a native function in Pine Script's standard indicator plotting system.
・Leveraging Drawing Objects: The core of this challenge relies on cleverly using Pine Script's label.new() drawing objects to represent the "X" and "O" symbols. This is a highly non-standard way to draw a P&F chart, as it requires complex logic to manage the drawing coordinates, price levels, and column spacing on the time-based chart.
・The Current Status: We've successfully achieved the initial goal: visualizing the X and O patterns as an overlay. Achieving a perfectly aligned, full-featured P&F chart (where columns align precisely, and price rounding is fully consistent across all columns) is far more complex, but this code provides a strong foundation.
❹. 🛠️ Technical Highlights
Tick-Precision Rounding: The custom function f_roundToTick() is critical. It ensures that the calculated box size and the lastPrice are always rounded to the nearest minimum tick size (syminfo.mintick) of the asset. This maintains high precision and accuracy relative to the market's price movements.
・Column Indexing: The currentColumnIndex variable is used to simulate the horizontal movement of P&F columns by adding a fractional offset to the bar_index when drawing the labels. This is what makes the pattern appear as distinct columns.
・Garbage Collection: The activeLabels array and the MAX_LABELS limit ensure that old labels are deleted (label.delete()) as new ones are drawn. This is a crucial performance optimization to prevent TradingView's label limit (500) from being exceeded and to maintain a smooth experience.
❺. 🚀 A Platform for Deep Customization
While TradingView's built-in indicators are excellent, every trader has their "personal best settings." View this code as a starting point for your own analytical environment. You can use it as a base to pursue deeper custom features, such as:
・Different drawing styles or colors based on momentum.
・Automated detection and signaling of specific P&F patterns (e.g., Double Top Buy, Triple Bottom Sell).
Please feel free to try it on your chart! We welcome any feedback you might have as we continue to refine this experimental overlay.
I do not speak English at all. Please understand that if you send me a message, I may not be able to reply, or my reply may have a different meaning. Thank you for your understanding.
Zonas de Liquidez Pro + Puntos de GiroRequirements for marking 💧:✅ High crosses the zone✅ Close returns inside (false breakout / fakeout)✅ Volume is 20% greater than the average✅ Occurs within the last 10 bars(Note: This last requirement is stated in the text but not explicitly in the code snippet provided)📚 Psychology Behind the SweepWho lost money?Traders with stops placed too tightlyBuyers who entered "on the breakout"Bots with automatic orders placed aboveWho made money?Smart Money / InstitutionsThey sold at a high priceThey hunted for liquidity before moving the priceThey know where retail stops are located🎯 How to Use the Drops in Your TradingGolden Rule:💧 near a strong zone + Multiple rejections = PROBABLE REVERSALStrategy:See 💧 at resistance → Look for SHORTSee 💧 at support → Look for LONGPrice returns to the swept zone → High-probability setupStop beyond the sweep high/low → ProtectionPractical Example:If you see 💧 LIQ at $111,263 (resistance)→ Wait for bearish rejection→ Entry: Sell at $110,800→ Stop: $111,500 (above the sweep high)→ Target: Next support level⚠️ Common Mistakes❌ Mistake 1: Trading the breakoutPrice breaks $111k → "It's going to the moon!" → Buy💧 LIQ appears → It was a trap → Drop → Loss✅ Correct Approach:Price breaks $111k → Check if there is 💧 LIQ💧 appears → "It's a trap" → Wait for rejection → Sell❌ Mistake 2: Ignoring the volumeNot all sweeps are equal.Sweeps with high volume are more reliable.No volume = it could be noise.🎓 Ultra-Fast SummaryElementMeaning💧 LIQLiquidity sweep detectedAt ResistanceBullish trap → Prepare for a shortAt SupportBearish trap → Prepare for a longWith High VolumeMore reliable signalNear Strong Zone High probability of reversal🔥 The Magic of Your IndicatorScenarioWithout this IndicatorWith this IndicatorAction"The price broke $111k, I'm buying!""There is 💧 LIQ + zone + rejections → It's a trap."ResultYou loseYou avoid a loss or gain on the short






















