[blackcat] L1 Old Duck HeadLevel 1
Background
The old duck head is a classic form formed by a series of behaviors such as bankers opening positions, washing dishes, and pulling over the top of the duck head.
Function
A form of stock candles:
(1) Moving averages using 5, 10 and 60 parameters. When the 5-day and 10-day moving averages crossed the 60-day moving average, a duck neck was formed.
(2) The high point when the stock price fell back formed a duck head.
(3) When the stock price fell back soon, the 5-day and 10-day moving averages again turned up to form a duckbill.
(4) Duck nose refers to the hole formed when the 5-day moving average crosses the 10-day moving average and the two lines cross again.
Market significance:
(1) When the dealer starts to collect chips, the stock price rises slowly, and the 5-day and 10-day moving averages cross the 60-day moving average, forming a duck neck.
(2) When the stock price of the banker shakes the position and starts to pull back, the high point of the stock price forms the top of the duck's head.
(3) When the dealer builds a position again to collect chips, the stock price rises again, forming a duck bill.
Operation method:
(1) Buy when the 5-day and 10-day moving averages cross the 60-day moving average and form a duck neck.
(2) Buy on dips near the sesame point of trading volume near the duckbill.
(3) Intervene when the stock price crosses the top of the duck's head in heavy volume.
The top of the duck’s head should be a little far away from the 60-day moving average, otherwise it means that the dealer is not willing to open a position at this old duck’s head, and the bottom of the old duck’s head must be heavy. Small is better, nothing is the strongest! There must be a lot of sesame dots under the nostrils of the duck, otherwise it means that the dealer has poor control. There must be ventilation under the duck bill, the higher the ventilation, the better!
Remarks
Feedbacks are appreciated.
Cari dalam skrip untuk "A股+股票筛选器+10元以下"
Variety N-Tuple Moving Averages w/ Variety Stepping [Loxx]Variety N-Tuple Moving Averages w/ Variety Stepping    is a moving average indicator that allows you to create 1- 30 tuple moving average types; i.e., Double-MA, Triple-MA, Quadruple-MA, Quintuple-MA, ... N-tuple-MA. This version contains 2 different moving average types. For example, using "50" as the depth will give you Quinquagintuple Moving Average. If you'd like to find the name of the moving average type you create with the depth input with this indicator, you can find a list of tuples here:  Tuples extrapolated 
Due to the coding required to adapt a moving average to fit into this indicator, additional moving average types will be added as they are created to fit into this unique use case. Since this is a work in process, there will be many future updates of this indicator. For now, you can choose from either EMA or RMA.
This indicator is also considered one of the top 10 forex indicators. See details here:  forex-station.com 
Additionally, this indicator is a computationally faster, more streamlined version of the following indicators with the addition of 6 stepping functions and 6 different bands/channels types.
STD-Stepped, Variety N-Tuple Moving Averages  
  
STD-Stepped, Variety N-Tuple Moving Averages is the standard deviation stepped/filtered indicator of the following indicator
Last but not least, a big shoutout to @lejmer for his help in formulating a looping solution for this streamlined version. this indicator is speedy even at 50 orders deep. You can find his scripts here:  www.tradingview.com 
 How this works 
Step 1: Run factorial calculation on the depth value,
Step 2: Calculate weights of nested moving averages
factorial(depth) / (factorial(depth - k) * factorial(k); where depth is the depth and k is the weight position
Examples of coefficient outputs:
6 Depth: 6 15 20 15 6
7 Depth: 7 21 35 35 21 7
8 Depth: 8 28 56 70 56 28 8
9 Depth: 9 36 34 84 126 126 84 36 9
10 Depth: 10 45 120 210 252 210 120 45 10
11 Depth: 11 55 165 330 462 462 330 165 55 11
12 Depth: 12 66 220 495 792 924 792 495 220 66 12
13 Depth: 13 78 286 715 1287 1716 1716 1287 715 286 78 13
Step 3: Apply coefficient to each moving average
For QEMA, which is 5 depth EMA , the calculation is as follows
ema1 = ta. ema ( src , length)
ema2 = ta. ema (ema1, length)
ema3 = ta. ema (ema2, length)
ema4 = ta. ema (ema3, length)
ema5 = ta. ema (ema4, length)
In this new streamlined version, these MA calculations are packed into an array inside loop so Pine doesn't have to keep all possible series information in memory. This is handled with the following code:
temp = array.get(workarr, k + 1) + alpha * (array.get(workarr, k) - array.get(workarr, k + 1))
array.set(workarr, k + 1, temp)
After we pack the array, we apply the coefficients to derive the NTMA:
qema = 5 * ema1 - 10 * ema2 + 10 * ema3 - 5 * ema4 + ema5
 Stepping calculations 
First off, you can filter by both price and/or MA output. Both price and MA output can be filtered/stepped in their own way. You'll see two selectors in the input settings. Default is ATR ATR. Here's how stepping works in simple terms: if the price/MA output doesn't move by X deviations, then revert to the price/MA output one bar back. 
 ATR 
The average true range (ATR) is a technical analysis indicator, introduced by market technician J. Welles Wilder Jr. in his book New Concepts in Technical Trading Systems, that measures market volatility by decomposing the entire range of an asset price for that period.
 Standard Deviation 
Standard deviation is a statistic that measures the dispersion of a dataset relative to its mean and is calculated as the square root of the variance. The standard deviation is calculated as the square root of variance by determining each data point's deviation relative to the mean. If the data points are further from the mean, there is a higher deviation within the data set; thus, the more spread out the data, the higher the standard deviation.
 Adaptive Deviation 
By definition, the Standard Deviation (STD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. In technical analysis we usually use it to measure the level of current volatility .
Standard Deviation is based on Simple Moving Average calculation for mean value. This version of standard deviation uses the properties of EMA to calculate what can be called a new type of deviation, and since it is based on EMA , we can call it EMA deviation. And added to that, Perry Kaufman's efficiency ratio is used to make it adaptive (since all EMA type calculations are nearly perfect for adapting).
The difference when compared to standard is significant--not just because of EMA usage, but the efficiency ratio makes it a "bit more logical" in very volatile market conditions.
See how this compares to Standard Devaition here:
Adaptive Deviation
  
 Median Absolute Deviation 
The median absolute deviation is a measure of statistical dispersion. Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant.
Because the MAD is a more robust estimator of scale than the sample variance or standard deviation, it works better with distributions without a mean or variance, such as the Cauchy distribution.
For this indicator, I used a manual recreation of the quantile function in Pine Script. This is so users have a full inside view into how this is calculated.
 Efficiency-Ratio Adaptive ATR 
Average True Range (ATR) is widely used indicator in many occasions for technical analysis . It is calculated as the RMA of true range. This version adds a "twist": it uses Perry Kaufman's Efficiency Ratio to calculate adaptive true range
See how this compares to ATR here:
ER-Adaptive ATR  
  
 Mean Absolute Deviation 
The mean absolute deviation (MAD) is a measure of variability that indicates the average distance between observations and their mean. MAD uses the original units of the data, which simplifies interpretation. Larger values signify that the data points spread out further from the average. Conversely, lower values correspond to data points bunching closer to it. The mean absolute deviation is also known as the mean deviation and average absolute deviation.
This definition of the mean absolute deviation sounds similar to the standard deviation (SD). While both measure variability, they have different calculations. In recent years, some proponents of MAD have suggested that it replace the SD as the primary measure because it is a simpler concept that better fits real life.
For Pine Coders, this is equivalent of using ta.dev()
 Bands/Channels 
See the information above for how bands/channels are calculated. After the one of the above deviations is calculated, the channels are calculated as output +/- deviation * multiplier 
 Signals 
Green is uptrend, red is downtrend, yellow "L" signal is Long, fuchsia "S" signal is short.
 Included: 
 
 Alerts
 Loxx's Expanded Source Types
 Bar coloring
 Signals
 6 bands/channels types
 6 stepping types
 
 Related indicators 
 3-Pole Super Smoother w/ EMA-Deviation-Corrected Stepping  
  
 STD-Stepped Fast Cosine Transform Moving Average  
  
 ATR-Stepped PDF MA    
 
Tendies Heist Auto Compounding ExampleThis is an example of how we can use compounding to control our position size. This example shows how we can automatically add and reduce position size based on account equity. The "initial capital" in properties is the starting account equity. At default its set to 100,000. If our max position size is set to 25 then the very first position that's taken has a position size of 10, IF our leverage is set to 10,000. Account equity divided by leverage equals position size. So in that example 100,000 divided by 10,000 in leverage gives us a max position size of 10. However the max position size was set to 25 meaning we would need 250k in equity for it to open a position size of 25 with the leverage set at 10k. Now if the initial capital was set to 100,000 and the max position size was set to 5 and leverage remained at 10,000, all though 100,000 divided by 10,000 equals 10 it will ONLY open a position size of 5, because the max position size in this example was set at 5. Since this works for strategies you may look through the trade log on the posted back test and check out the position size, you can see in this back test the default 100k is used for the initial capital and the default 10k was used for the leverage. You will be able to see as this logic loses money it takes contracts away and as it gains money it adds contracts. I'm using trading view's basic strategy logic example to provide an example of how the compounding logic works.  
Note, don't forget to add the syntax below to your strategy.entry call for this logic to work.
qty = size
Tendies Heist LLC 2021
Combo Backtest 123 Reversal & D_Three Ten OscThis is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 TradeStation does not allow the user to make a Multi Data Chart with 
 a Tick Bar Chart and any other type a chart. This indicator allows the 
 user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
 Walter Bressert's 3-10 Oscillator is a detrending oscillator derived 
 from subtracting a 10 day moving average from a 3 day moving average. 
 The second plot is an 16 day simple moving average of the 3-10 Oscillator. 
 The 16 period moving average is the slow line and the 3/10 oscillator is 
 the fast line.
 For more information on the 3-10 Oscillator see Walter Bressert's book 
 "The Power of Oscillator/Cycle Combinations" 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & D_Three Ten Osc This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 TradeStation does not allow the user to make a Multi Data Chart with 
 a Tick Bar Chart and any other type a chart. This indicator allows the 
 user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
 Walter Bressert's 3-10 Oscillator is a detrending oscillator derived 
 from subtracting a 10 day moving average from a 3 day moving average. 
 The second plot is an 16 day simple moving average of the 3-10 Oscillator. 
 The 16 period moving average is the slow line and the 3/10 oscillator is 
 the fast line.
 For more information on the 3-10 Oscillator see Walter Bressert's book 
 "The Power of Oscillator/Cycle Combinations" 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
D_Three Ten Osc Strategy Backtest This indicator allows the user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
 Walter Bressert's 3-10 Oscillator is a detrending oscillator derived 
 from subtracting a 10 day moving average from a 3 day moving average. 
 The second plot is an 16 day simple moving average of the 3-10 Oscillator. 
 The 16 period moving average is the slow line and the 3/10 oscillator is 
 the fast line.
 For more information on the 3-10 Oscillator see Walter Bressert's book 
 "The Power of Oscillator/Cycle Combinations" 
 You can change long to short in the Input Settings
 Please, use it only for learning or paper trading. Do not for real trading.
D_Three Ten Osc Strategy This indicator allows the  user to plot a daily 3-10 Oscillator on a Tick Bar 
 Chart or any intraday interval.
 Walter Bressert's 3-10 Oscillator is a detrending oscillator derived 
 from subtracting a 10 day moving average from a 3 day moving average. 
 The second plot is an 16 day simple moving average of the 3-10 Oscillator. 
 The 16 period moving average is the slow line and the 3/10 oscillator is 
 the fast line.
 For more information on the 3-10 Oscillator see Walter Bressert's book 
 "The Power of Oscillator/Cycle Combinations"
Sladkaya BulochkaAccording to the statistics of Thomas Bulkovski collected over several years on the 1-minute chart (21 million candles), there is a statistically significant periods, where the higher the probability of reversal rates on short-term timeframe.
By reversal, on average, had in mind the movement to 5 candles.
This three periods, they remain unchanged, depending on the hour:
- the first minute of each hour (10:01, 11:01, etc.)
- the first minute after the hour (10:31, 11:31)
- 51 minutes each hour (10:51, 11:51)
------------------------------------------------------
По статистике Томаса Булковски, собранной за несколько лет на 1-минутном графике (21 миллион свечей), есть статистически значимые периоды, где более высока вероятность разворота цены на краткосрочных ТФ.
Под разворотом, в среднем, имелось в виду движение на 5 свечей.
Это три периода, они неизменны в зависимости от часа:
- первая минута каждого часа (10:01, 11:01 и т.д.)
- первая минута после получаса (10:31, 11:31)
- каждая 51 минута часа (10:51, 11:51)
HL BREAKOUTThe base of the indicator is the breakout of historic High and lows.
There are 3 basic configurations
1° The High length that measure the latest 10 bars and make the "higher high"
2° The Low length taht measure the latest 10 bars and make the "lower low"
3° The Breakout PIPs administrator that defines how much pips are needed from the latest higher high to be defined as a level breakout.
So the strategy is super easy. The indicators show you the 10...20.. or whatever you need old bars high and lows.
When a breakout of that levels occurs and the candle "close" above or below and the close are more than "X" amount of PIPs a marker show up. The marker are the signals of buy and sell
I test some configurations, and work in all timeframes but.
I suggest
10, 10, 0.0003 for timeframes from 1m to 15m
and 10, 10, 0.0005 for timeframes higher than 15m
Maybe you need to test other configurations for 4h 1 day, etc the basics are the same in all timeframes, the main difference is the amount of pips that will be considered as "breakout" the higher timeframe the higher amount you need  to prevent false positives.
Last words: 0.000X are for the PIPs for currencies that have 4 or 5 decimals like euro and other, if you use in YEN change it to a configuration of 2 digits decimal. Just that.
Have "fun" !
D_Three Ten Osc on the IntradayHi
Let me introduce my D_Three Ten Osc script.
This indicator allows the
user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
Walter Bressert's 3-10 Oscillator is a detrending oscillator derived
from subtracting a 10 day moving average from a 3 day moving average.
The second plot is an 16 day simple moving average of the 3-10 Oscillator.
The 16 period moving average is the slow line and the 3/10 oscillator is
the fast line.
For more information on the 3-10 Oscillator see Walter Bressert's book
"The Power of Oscillator/Cycle Combinations" 
D_Three Ten Osc on the DailyHi
Let me introduce my D_Three Ten Osc script.
   This indicator allows the 
    user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
    Walter Bressert's 3-10 Oscillator is a detrending oscillator derived 
    from subtracting a 10 day moving average from a 3 day moving average. 
    The second plot is an 16 day simple moving average of the 3-10 Oscillator. 
    The 16 period moving average is the slow line and the 3/10 oscillator is 
    the fast line.
    For more information on the 3-10 Oscillator see Walter Bressert's book 
    "The Power of Oscillator/Cycle Combinations" 
Fib OscillatorWhat is Fib Oscillator and How to Use it?
🔶 1. Conceptual Overview
The Fib Oscillator is a Fibonacci-based relative position oscillator.
Instead of measuring momentum (like RSI or MACD), it measures where price currently sits between the recent swing high and swing low, expressed as a percentage within the Fibonacci range.
In other words:
It answers: “Where is price right now within its most recent dynamic range?”
It visualizes retracement and extension zones numerically, providing continuous feedback between 0% and 100% (and beyond if extended).
🔶 2. What the Script Does
The indicator:
Automatically detects recent high and low levels using an adaptive lookback window, which depends on ATR volatility.
Calculates the current price’s position between those levels as a percentage (0–100).
Plots that percentage as an oscillator — showing visually whether price is near the top, middle, or bottom of its recent range.
Overlays Fibonacci retracement levels (23.6%, 38.2%, 50%, 61.8%, 78.6%) as reference zones.
Generates alerts when the oscillator crosses key Fib thresholds — which can signal retracement completion, breakout potential, or pullback exhaustion.
🔶 3. Technical Flow Breakdown
(a) Inputs
Input	Description	Default	Notes
atrLength	ATR period used for volatility estimation	14	Used to dynamically tune lookback sensitivity
minLookback	Minimum lookback window (candles)	20	Ensures stability even in low volatility
maxLookback	Maximum lookback window	100	Limits over-expansion during high volatility
isInverse	Inverts chart orientation	false	Useful for inverse markets (e.g. shorts or inverse BTC view)
(b) Volatility-Adaptive Lookback
Instead of using a fixed lookback, it calculates:
lookback
=
SMA(ATR,10)
/
SMA(Close,10)
×
500
lookback=SMA(ATR,10)/SMA(Close,10)×500
Then it clamps this between minLookback and maxLookback.
This makes the oscillator:
More reactive during high volatility (shorter lookback)
More stable during calm markets (longer lookback)
Essentially, it self-adjusts to market rhythm — you don’t have to constantly tweak lookback manually.
(c) High-Low Reference Points
It takes the highest and lowest points within the dynamic lookback window.
If isInverse = true, it flips the candle logic (useful if viewing inverse instruments like stablecoin pairs or when analyzing bearish setups invertedly).
(d) Oscillator Core
The main oscillator line:
osc
=
(
close
−
low
)
(
high
−
low
)
×
100
osc=
(high−low)
(close−low)
	
×100
0% = Price is at the lookback low.
100% = Price is at the lookback high.
50% = Midpoint (balanced).
Between Fibonacci percentages (23.6%, 38.2%, 61.8%, etc.), the oscillator indicates retracement stages.
(e) Fibonacci Levels as Reference
It overlays horizontal reference lines at:
0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
These act as support/resistance bands in oscillator space.
You can read it similar to how traders use Fibonacci retracements on charts, but compressed into a single line oscillator.
(f) Alerts
The script includes built-in alert conditions for crossovers at each major Fibonacci level.
You can set TradingView alerts such as:
“Oscillator crossed above 61.8%” → possible bullish continuation or breakout.
“Oscillator crossed below 38.2%” → possible pullback or correction starting.
This allows automated monitoring of fib retracement completions without manually drawing fib levels.
🔶 4. How to Use It
🔸 Visual Interpretation
Oscillator Value	Zone	Market Context
0–23.6%	Deep Retracement	Potential exhaustion of a down-move / early reversal
23.6–38.2%	Shallow retracement zone	Possible continuation phase
38.2–50%	Mid retracement	Neutral or indecisive structure
50–61.8%	Key pivot region	Common trend resumption zone
61.8–78.6%	Late retracement	Often “last pullback” area
78.6–100%	Near high range	Possible overextension / profit-taking
>100%	Range breakout	New leg formation / expansion
🔸 Practical Application Steps
Load the indicator on your chart (set overlay = false, so it’s below the main price chart).
Observe oscillator position relative to fib bands:
Use it to determine retracement depth.
Combine with structure tools:
Trend lines, swing points, or HTF market structure.
Use crossovers for timing:
Crossing above 61.8% in an uptrend often confirms breakout continuation.
Crossing below 38.2% in a downtrend signals renewed downside momentum.
For range markets, oscillator swings between 23.6% and 78.6% can define accumulation/distribution boundaries.
🔶 5. When to Use It
During Retracements: To gauge how deep the pullback has gone.
During Range Markets: To identify relative overbought/oversold positions.
Before Breakouts: Crossovers of 61.8% or 78.6% often precede impulsive moves.
In Multi-Timeframe Contexts:
LTF (15M–1H): Detect intraday retracement exhaustion.
HTF (4H–1D): Confirm major range expansions or key reversal zones.
🔶 6. Ideal Companion Indicators
The Fib Oscillator works best when contextualized with structure, volatility, and trend bias indicators.
Below are optimal pairings:
Companion Indicator	Purpose	Integration Insight
Market Structure MTF Tool	Identify active trend direction	Use Fib Oscillator only in trend direction for cleaner signals
EMA Ribbon / Supertrend	Trend confirmation	Align oscillator crossovers with EMA bias
ATR Bands / Volatility Envelope	Validate breakout strength	If oscillator >78.6% & ATR rising → valid breakout
Volume Oscillator	Confirm retracement strength	Volume contraction + oscillator under 38.2% → potential reversal
HTF Fib Retracement Tool	Combine LTF oscillator with HTF fib confluence	Powerful multi-timeframe setups
RSI or Stochastic	Measure momentum relative to position	RSI divergence while oscillator near 78.6% → exhaustion clue
🔶 7. Understanding the Settings
Setting	Function	Practical Impact
ATR Period (14)	Controls volatility sampling	Higher = smoother lookback adaptation
Min Lookback (20)	Smallest window allowed	Lower = more reactive but noisier
Max Lookback (100)	Largest window allowed	Higher = smoother but slower to react
Inverse Candle Chart	Flips oscillator vertically	Useful when analyzing bearish or inverse scenarios (e.g. short-side fib mapping)
Recommended Configs:
For scalping/intraday: ATR 10–14, lookback 20–50
For swing/position trading: ATR 14–21, lookback 50–100
🔶 8. Example Trade Logic (Practical Use)
Scenario: Uptrend on 4H chart
Oscillator drops to below 38.2% → retracement zone
Price consolidates → oscillator stabilizes
Oscillator crosses above 50% → pullback ending
Entry: Long when oscillator crosses above 61.8%
Exit: Near 78.6–100% zone or upon divergence with RSI
For Short Bias (Inverse Setup):
Enable isInverse = true to visually flip the oscillator (so lows become highs).
Use the same thresholds inversely.
🔶 9. Strengths & Limitations
✅ Strengths
Dynamic, self-adapting to volatility
Quantifies Fib retracement as a continuous function
Compact oscillator view (no clutter on chart)
Works well across all timeframes
Compatible with both trending and ranging markets
⚠️ Limitations
Doesn’t define trend direction — must be used with structure filters
Can whipsaw during choppy consolidations
The “lookback auto-adjust” may lag in sudden volatility shifts
Shouldn’t be used standalone for entries without structural confluence
🔶 10. Summary
The “Fib Oscillator” is a dynamic Fibonacci-relative positioning tool that merges retracement theory with adaptive volatility logic.
It gives traders an intuitive, quantified view of where price sits within its recent fib range, allowing anticipation of pullbacks, reversals, or breakout momentum.
Think of it as a "Fibonacci RSI", but instead of momentum strength, it shows positional depth — the vibrational location of price within its natural swing cycle.
Buying Climax + Spring [Darwinian]Buying Climax + Spring Indicator  
 Overview 
Advanced Wyckoff-based indicator that identifies potential market reversals through **Buying Climax** patterns (exhaustion tops) and **Spring** patterns (accumulation bottoms). Designed for traders seeking high-probability reversal signals with strict uptrend validation.
---
 Method 
 🔴 Buying Climax Detection 
Identifies exhaustion patterns at market tops using multi-condition analysis:
**Base Buying Climax (Red Triangle)**
- Volume spike > 1.8x average
- Range expansion > 1.8x average
- New 20-bar high reached
- Close finishes in lower 30% of bar range
- **Strict uptrend validation**: Price must be 30%+ above 20-day low
**Enhanced Buying Climax (Maroon Triangle)**
- All Base BC conditions PLUS:
- Gap up from previous high
- Intraday fade (close < open and below midpoint)
- **Higher confidence reversal signal**
 🟢 Wyckoff Spring Detection 
Identifies accumulation patterns at support levels:
- Price breaks below recent pivot low (false breakdown)
- Close recovers above pivot level (rejection)
- Occurs at trading range low
- Optional volume confirmation (1.5x+ average)
- Limited to 3 attempts per pivot (prevents over-signaling)
 ✅ Uptrend Validation Filter 
**Four-condition composite filter** prevents false signals in sideways/downtrending markets:
1. Close-to-close rise ≥ 5% over lookback period
2. Price structure: Close > MA(10) > MA(20)
3. Swing low significantly below current price
4. **Primary requirement**: Current high ≥ 30% above 20-day low
---
 Input Tuning Guide 
 Buying Climax Settings: 
**Volume & Range Thresholds**
- `Volume Spike Threshold`: Default 1.8x
  - Lower (1.5x) = More signals, more noise
  - Higher (2.0-2.5x) = Fewer but stronger exhaustion signals
- `Range Spike Threshold`: Default 1.8x
  - Adjust parallel to volume threshold
  - Higher values = extreme volatility required
**Pattern Detection**
- `New High Lookback`: Default 20 bars
  - Shorter (10-15) = Recent highs only
  - Longer (30-50) = Major breakout detection
- `Close Off High Fraction`: Default 0.3 (30%)
  - Lower (0.2) = Stricter rejection requirement
  - Higher (0.4-0.5) = Allow weaker intraday fades
- `Gap Threshold`: Default 0.002 (0.2%)
  - Increase (0.005-0.01) for stocks with wider spreads
  - Decrease (0.001) for tight-spread instruments
- `Confirmation Window`: Default 5 bars
  - Shorter (3) = Faster confirmation, more false positives
  - Longer (7-10) = Wait for deeper automatic reaction
 Uptrend Filter Settings 
**Critical for Signal Quality**
- `Minimum Rise from 20-day Low`: Default 0.30 (30%)
  - **Most important parameter**
  - Lower (0.20-0.25) = More signals in moderate uptrends
  - Higher (0.40-0.50) = Only extreme parabolic moves
- `Pole Lookback`: Default 30 bars
  - Shorter (20) = Recent momentum focus
  - Longer (40-50) = Longer-term trend validation
- `Minimum Rise % for Pole`: Default 0.05 (5%)
  - Adjust based on market volatility
  - Higher in strong bull markets (7-10%)
 Wyckoff Spring Settings 
- `Pivot Length`: Default 6 bars
  - Shorter (3-4) = More frequent pivots, more signals
  - Longer (8-10) = Major support/resistance only
- `Volume Threshold`: Default 1.5x
  - Higher (1.8-2.0x) = Stronger conviction required
  - Disable volume requirement for low-volume stocks
- `Trading Range Period`: Default 20 bars
  - Match to consolidation timeframe being traded
  - Shorter (10-15) for intraday patterns
  - Longer (30-40) for weekly consolidations
---
 Recommended Workflow 
1. **Start with defaults** on daily timeframe
2. **Adjust uptrend filter** first (30% rise parameter)
   - Too many signals? Increase to 35-40%
   - Too few? Decrease to 25%
3. **Fine-tune volume/range multipliers** based on instrument volatility
4. **Enable alerts** for real-time monitoring:
   - Base BC → Initial warning
   - Enhanced BC → High-priority reversal
   - Confirmed BC (AR) → Strong follow-through
   - Spring → Accumulation opportunity
---
 Alert System 
- **Base Buying Climax**: Standard exhaustion pattern detected
- **Enhanced BC (Gap+Fade)**: Higher confidence reversal setup
- **Confirmed BC (AR)**: Automatic reaction validated (price drops below BC midline)
- **Wyckoff Spring**: Accumulation pattern at support
---
 Best Practices 
- Combine with support/resistance analysis
- Watch for BC clusters (multiple timeframes)
- Spring patterns work best after Buying Climax distribution
- Backtest parameters on your specific instruments
- Higher timeframes (daily/weekly) = higher reliability
---
 Technical Notes 
- Built with Pine Script v6
- No repainting (signals finalize on bar close)
- Minimal CPU usage (optimized calculations)
- Works on all timeframes and instruments
- Overlay indicator (displays on price chart)
---
*Indicator follows classical Wyckoff methodology with modern volatility filters*
Smart Breadth [smartcanvas]Overview 
This indicator is a market breadth analysis tool focused on the S&P 500 index. It visualizes the percentage of S&P 500 constituents trading above their 50-day and 200-day moving averages, integrates the McClellan Oscillator for advance-decline analysis, and detects various breadth-based signals such as thrusts, divergences, and trend changes. The indicator is displayed in a separate pane and provides visual cues, a summary label with tooltip, and alert conditions to highlight potential market conditions.
The tool uses data symbols like S5FI (percentage above 50-day MA), S5TH (percentage above 200-day MA), ADVN/DECN (S&P advances/declines), and optionally NYSE advances/declines for certain calculations. If primary data is unavailable, it falls back to calculated breadth from advance-decline ratios.
This indicator is intended for educational and analytical purposes to help users observe market internals. My intention was to pack in one indicator things you will only find in a few. It does not provide trading signals as financial advice, and users are encouraged to use it in conjunction with their own research and risk management strategies. No performance guarantees are implied, and historical patterns may not predict future market behavior.
Key Components and Visuals
 Plotted Lines: 
 
 Aqua line: Percentage of S&P 500 stocks above their 50-day MA.
 Purple line: Percentage of S&P 500 stocks above their 200-day MA.
 Optional orange line (enabled via "Show Momentum Line"): 10-day momentum of the 50-day MA breadth, shifted by +50 for scaling.
 Optional line plot (enabled via "Show McClellan Oscillator"): McClellan Oscillator, colored green when positive and red when negative. Can use actual scale or normalized to fit breadth percentages (0-100).
 
 Horizontal Levels: 
 
 Dotted green at 70%: "Strong" level.
 Dashed green at user-defined green threshold (default 60%): "Buy Zone".
 Dashed yellow at user-defined yellow threshold (default 50%): "Neutral".
 Dotted red at 30%: "Oversold" level.
 Optional dotted lines for McClellan (when shown and not using actual scale): Overbought (red), Oversold (green), and Zero (gray), scaled to fit.
 
 Background Coloring: 
 
 Green shades for bullish/strong bullish states.
 Yellow for neutral.
 Orange for caution.
 Red for bearish.
 
 Signal Shapes: 
 
 Rocket emoji (🚀) at bottom for Zweig Breadth Thrust trigger.
 Green circle at bottom for recovery signal.
 Red triangle down at top for negative divergence warning.
 Green triangle up at bottom for positive divergence.
 Light green triangle up at bottom for McClellan oversold bounce.
 Green diamond at bottom for capitulation signal.
 
 Summary Label (Right Side): 
Displays current action (e.g., "BUY", "HOLD") with emoji, breadth percentages with colored circles, McClellan value with emoji, market state, risk/reward stars, and active signals.
Hover tooltip provides detailed breakdown: action priority, breadth metrics, McClellan status, momentum/trend, market state, active signals, data quality, thresholds, recent changes, and a general recommendation category.
 Calculations and Logic 
 
 Breadth Percentages: Derived from S5FI/S5TH or calculated from advances/(advances + declines) * 100, with fallback adjustments.
 McClellan Oscillator: Difference between fast (default 19) and slow (default 39) EMAs of net advances (advances - declines).
 Momentum: 10-day change in 50-day MA breadth percentage.
 Trend Analysis: Counts consecutive rising days in breadth to detect upward trends.
 Breadth Thrust (Zweig): 10-day EMA of advances/total issues crossing from below a bottom level (default 40) to above a top level (default 61.5). Can use S&P or NYSE data.
 Divergences: Compares S&P 500 price highs/lows with breadth or McClellan over a lookback period (default 20) to detect positive (bullish) or negative (bearish) divergences.
 Market States: Determined by breadth levels relative to thresholds, trend direction, and McClellan conditions (e.g., strong bullish if above green threshold, rising, and McClellan supportive).
 Actions: Prioritized logic (0-10) selects an action like "BUY" or "AVOID LONGS" based on signals, states, and conditions. Higher priority (e.g., capitulation at 10) overrides lower ones.
 Alerts: Triggered on new occurrences of key conditions, such as breadth thrust, divergences, state changes, etc.
 
 Input Parameters 
The indicator offers customization through grouped inputs, but the use of defaults is encouraged.
 Usage Notes 
Add the indicator to a chart of any symbol (though designed around S&P 500 data; works best on daily or higher timeframes). Monitor the label and tooltip for a consolidated view of conditions. Set up alerts for specific events.
This script relies on external security requests, which may have data availability issues on certain exchanges or timeframes. The fallback mechanism ensures continuity but may differ slightly from primary sources.
 Disclaimer 
This indicator is provided for informational and educational purposes only. It does not constitute investment advice, financial recommendations, or an endorsement of any trading strategy. Market conditions can change rapidly, and users should not rely solely on this tool for decision-making. Always perform your own due diligence, consult with qualified professionals if needed, and be aware of the risks involved in trading. The author and TradingView are not responsible for any losses incurred from using this script.
VWAP For Loop [BackQuant]VWAP For Loop  
 What this tool does—in one sentence 
A volume-weighted trend gauge that anchors VWAP to a calendar period (day/week/month/quarter/year) and then scores the persistence of that VWAP trend with a simple for-loop “breadth” count; the result is a clean, threshold-driven oscillator plus an optional VWAP overlay and alerts.
 Plain-English overview 
Instead of judging raw price alone, this indicator focuses on  anchored VWAP —the market’s average price paid during your chosen institutional period. It then asks a simple question across a configurable set of lookback steps:  “Is the current anchored VWAP higher than it was i bars ago—or lower?”  Each “yes” adds +1, each “no” adds −1. Summing those answers creates a score that reflects how consistently the volume-weighted trend has been rising or falling. Extreme positive scores imply persistent, broad strength; deeply negative scores imply persistent weakness. Crossing predefined thresholds produces objective long/short events and color-coded context.
 Under the hood 
•  Anchoring  — VWAP using  hlc3 × volume  resets exactly when the selected period rolls:
  Day → session change, Week → new week, Month → new month, Quarter/Year → calendar quarter/year.
•  For-loop scoring  —  For lag steps i =  , compare today’s VWAP to VWAP .
  – If VWAP > VWAP , add +1.
  – Else, add −1. 
  The final  score  ∈  , where N = (end − start + 1). With defaults (1→45), N = 45.
•  Signal logic (stateful) 
  –  Long  when score >  upper  (e.g., > 40 with N = 45 → VWAP higher than ~89% of checked lags).
  –  Short  on  crossunder  of  lower  (e.g., dropping below −10).
  – A compact state variable ( out ) holds the current regime: +1 (long), −1 (short), otherwise unchanged. This “stickiness” avoids constant flipping between bars without sufficient evidence.
 Why VWAP + a breadth score? 
• VWAP aggregates both price and volume—where participants actually traded.
• The breadth-style count rewards  consistency  of the anchored trend, not one-off spikes.
• Thresholds give you binary structure when you need it (alerts, automation), without complex math.
 What you’ll see on the chart 
•  Sub-pane oscillator  — The for-loop score line, colored by regime (long/short/neutral).
•  Main-pane VWAP (optional)  — Even though the indicator runs off-chart, the anchored VWAP can be overlaid on price (toggle visibility and whether it inherits trend colors).
•  Threshold guides  — Horizontal lines for the long/short bands (toggle).
•  Cosmetics  — Optional candle painting and background shading by regime; adjustable line width and colors.
 Input map (quick reference) 
•  VWAP Anchor Period  — Day, Week, Month, Quarter, Year.
•  Calculation Start/End  — The for-loop lag window  . With 1→45, you evaluate 45 comparisons.
•  Long/Short Thresholds  — Default upper=40, lower=−10 (asymmetric by design; see below).
•  UI/Style  — Show thresholds, paint candles, background color, line width, VWAP visibility and coloring, custom long/short colors.
 Interpreting the score 
•  Near +N  — Current anchored VWAP is above most historical VWAP checkpoints in the window → entrenched strength.
•  Near −N  — Current anchored VWAP is below most checkpoints → entrenched weakness.
•  Between  — Mixed, choppy, or transitioning regimes; use thresholds to avoid reacting to noise.
 Why the asymmetric default thresholds? 
•  Long = score > upper (40)  — Demands unusually broad upside persistence before declaring “long regime.”
•  Short = crossunder lower (−10)  — Triggers only on  downward momentum events  (a fresh breach), not merely being below −10. This combination tends to:
  – Capture sustained uptrends only when they’re very strong.
  – Flag downside turns as they occur, rather than waiting for an extreme negative breadth.
 Tuning guide 
 Choose an anchor that matches your horizon 
  –  Intraday scalps : Day anchor on intraday charts.
  –  Swing/position : Month or Quarter anchor on 1h/4h/D charts to capture institutional cycles.
 Pick the for-loop window 
  – Larger N (bigger end) = stronger evidence requirement, smoother oscillator.
  – Smaller N = faster, more reactive score.
 Set achievable thresholds 
  – Ensure  upper ≤ N  and  lower ≥ −N ; if N=30, an upper of 40 can never trigger.
  – Symmetric setups (e.g., +20/−20) are fine if you want balanced behavior.
 Match visuals to intent 
  – Enabling VWAP coloring lets you see regime directly on price.
  – Background shading is useful for discretionary reading; turn it off for cleaner automation displays.
 Playbook examples 
•  Trend confirmation with disciplined entries  — On Month anchor, N=45, upper=38–42: when the long regime engages, use pullbacks toward anchored VWAP on the main pane for entries, with stops just beyond VWAP or a recent swing.
•  Downside transition detection  — Keep lower around −8…−12 and watch for crossunders; combine with price losing anchored VWAP to validate risk-off.
•  Intraday bias filter  — Day anchor on a 5–15m chart, N=20–30, upper ~ 16–20, lower ~ −6…−10. Only take longs while score is positive and above a midline you define (e.g., 0), and shorts only after a genuine crossunder.
 Behavior around resets (important) 
Anchored VWAP is  hard-reset  each period. Immediately after a reset, the series can be young and comparisons to pre-reset values may span two periods. If you prefer within-period evaluation only, choose  end  small enough not to bridge typical period length on your timeframe, or accept that the breadth test intentionally spans regimes.
 Alerts included 
•  VWAP FL Long  — Fires when the long condition is true (score > upper and not in short).
•  VWAP FL Short  — Fires on crossunder of the lower threshold (event-driven).
Messages include {{ticker}} and {{interval}} placeholders for routing.
 Strengths 
•  Simple, transparent math  — Easy to reason about and validate.
•  Volume-aware by construction  — Decisions reference VWAP, not just price.
•  Robust to single-bar noise  — Needs many lags to agree before flipping state (by design, via thresholds and the stateful output).
 Limitations & cautions 
•  Threshold feasibility  — If N < upper or |lower| > N, signals will never trigger; always cross-check N.
•  Path dependence  — The state variable persists until a new event; if you want frequent re-evaluation, lower thresholds or reduce N.
•  Regime changes  — Calendar resets can produce early ambiguity; expect a few bars for the breadth to mature.
•  VWAP sensitivity to volume spikes  — Large prints can tilt VWAP abruptly; that behavior is intentional in VWAP-based logic.
 Suggested starting profiles 
•  Intraday trend bias : Anchor=Day, N=25 (1→25), upper=18–20, lower=−8, paint candles ON.
•  Swing bias : Anchor=Month, N=45 (1→45), upper=38–42, lower=−10, VWAP coloring ON, background OFF.
•  Balanced reactivity : Anchor=Week, N=30 (1→30), upper=20–22, lower=−10…−12, symmetric if desired.
 Implementation notes 
• The indicator runs in a separate pane (oscillator), but VWAP itself is drawn on price using forced overlay so you can see interactions (touches, reclaim/loss).
• HLC3 is used for VWAP price; that’s a common choice to dampen wick noise while still reflecting intrabar range.
• For-loop cap is kept modest (≤50) for performance and clarity.
 How to use this responsibly 
Treat the oscillator as a  bias and persistence meter . Combine it with your entry framework (structure breaks, liquidity zones, higher-timeframe context) and risk controls. The design emphasizes clarity over complexity—its edge is in how strictly it demands agreement before declaring a regime, not in predicting specific turns.
 Summary 
VWAP For Loop distills the question “How broadly is the anchored, volume-weighted trend advancing or retreating?” into a single, thresholded score you can read at a glance, alert on, and color through your chart. With careful anchoring and thresholds sized to your window length, it becomes a pragmatic bias filter for both systematic and discretionary workflows.
Full Session ATR Range (Live) - with Position ToggleBelow is a publication-ready text for the "Full Session ATR Range (Live) - with Position Toggle" indicator, written in a professional yet accessible style suitable for a trading community (e.g., TradingView or a blog). The text highlights the indicator's features, usage, and benefits, while avoiding overly technical jargon for a broad audience.
---
### Introducing the Full Session ATR Range (Live) Indicator with Position Toggle
Enhance your trading strategy with the **Full Session ATR Range (Live) Indicator**, a powerful tool designed to provide real-time insights into market volatility and session dynamics. This customizable indicator, now available with a position toggle feature, compares the current session's range to a 10-day Average True Range (ATR), helping traders gauge market activity and anticipate potential movements.
#### Key Features
- **Live Range Tracking**: Displays the current session's range (high minus low) alongside a 10-day ATR, updated in real-time during market hours.
- **Session Mode Flexibility**: Includes an auto-toggle option to switch between Electronic Trading Hours (ETH) and Regular Trading Hours (RTH), adapting to your preferred trading session. Manually select ETH or RTH, or let the indicator auto-detect based on market hours.
- **Comprehensive Metrics**: Offers a detailed breakdown including:
  - Range/Avg %: Percentage of the current range relative to the 10-day ATR.
  - Points Left: Remaining points to reach the average range.
  - 100% Range Up/Dn: Potential upper and lower targets based on the ATR difference.
- **Position Customization**: Adjust the table's location on your chart with options like top-left, top-right, middle-center, or bottom-right for optimal visibility.
- **Visual Appeal**: Features a customizable background and text color to match your chart theme.
#### How It Works
The indicator calculates the 10-day ATR using daily data and tracks the current session's range, resetting at the start of each day or session change. During market hours (e.g., 6 AM - 8 PM CDT, adjustable), it updates live, providing actionable insights. When the market is closed, it displays historical ATR while marking live metrics as "n/a" to avoid confusion. The ETH/RTH toggle ensures the range reflects either the full extended session or the core trading hours, tailored to your strategy.
#### Why Use It?
Whether you're a day trader monitoring intraday volatility or a swing trader assessing longer-term trends, this indicator helps you:
- Identify overextended or underactive sessions compared to historical norms.
- Plan entries and exits with targets based on the 100% Range Up/Dn levels.
- Stay informed with a clean, adjustable display that fits your workflow.
#### Installation & Customization
1. Add the indicator to your TradingView chart.
2. Adjust the ATR length (default: 10 days) and table position via the input settings.
3. Choose your session mode (Auto, ETH, or RTH) and customize colors to suit your style.
4. Test during market hours for live updates—note that static values may appear outside trading sessions.
#### Feedback & Support
This indicator is designed for flexibility and ease of use. Share your feedback or request enhancements by commenting below or contacting the developer. Happy trading!
Mig Trade Model - Kill Zones
Key features:
Liquidity Hunt Detection: Spots aggressive moves that "hunt" stops beyond recent swing highs/lows.
Consolidation Filter: Requires 1-3 small-range candles after a hunt before confirming with a strong candle.
Bias Application: Uses daily open/close to auto-detect bias or allows manual override.
Kill Zone Restriction: Limits signals to London (default: 7-10 AM UTC) and NY (default: 12-3 PM UTC) sessions for better relevance in active markets.
This strategy is inspired by smart money concepts (SMC) and ICT (Inner Circle Trader) methodologies, aiming to capture venom-like "stings" in price action where liquidity is grabbed before reversals.
How It Works
ATR Calculation: Uses a user-defined ATR length (default: 14) to measure volatility, which scales candle body and range thresholds.
Bias Determination:
Auto: Compares daily close to open (bullish if close > open).
Manual: User selects "Bullish" or "Bearish."
Strong Candles:
Bullish: Green candle with body > 2x ATR (configurable).
Bearish: Red candle with body > 2x ATR.
Small Range Candles:
Candles where high-low < 0.5x ATR (configurable).
Liquidity Hunt:
Bullish Hunt: Strong bearish candle making a new low below the past swing low (default: 10 bars).
Bearish Hunt: Strong bullish candle making a new high above the past swing high.
Signal Generation:
After a hunt, counts 1-3 small-range candles.
Confirms with a strong candle in the opposite direction (e.g., strong bullish after bearish hunt).
Resets if >3 small candles or an opposing strong candle appears.
Kill Zone Filter:
Checks if the current bar's time (in UTC) falls within London or NY Kill Zones.
Only allows final "Buy" (bullish entry) or "Sell" (bearish entry) if bias matches and in Kill Zone.
Plots:
Yellow circle (below): Bullish liquidity hunt.
Orange circle (above): Bearish liquidity hunt.
Blue diamond (below): Raw bullish signal.
Purple diamond (above): Raw bearish signal.
Green triangle up ("Buy"): Filtered bullish entry.
Red triangle down ("Sell"): Filtered bearish entry.
Inputs
Bias: "Auto" (default), "Bullish", or "Bearish" – Controls signal direction based on daily trend.
ATR Length: 14 (default) – Period for ATR calculation.
Swing Length for Liquidity Hunt: 10 (default) – Bars to look back for swing highs/lows.
Strong Candle Body Multiplier (x ATR): 2.0 (default) – Threshold for strong candle bodies.
Small Range Multiplier (x ATR): 0.5 (default) – Threshold for small-range candles.
London Kill Zone Start/End Hour (UTC): 7/10 (default) – Customize London session hours.
NY Kill Zone Start/End Hour (UTC): 12/15 (default) – Customize New York session hours.
Usage Tips
Timeframe: Best on lower timeframes (e.g., 5-15 min) for intraday trading, especially forex pairs like EURUSD or GBPUSD.
Timezone Adjustment: Inputs are in UTC. If your chart is in a different timezone (e.g., EST = UTC-5), adjust hours accordingly (e.g., London: 2-5 AM EST → 7-10 UTC).
Risk Management: Use with stop-loss (e.g., beyond the hunt low/high) and take-profit based on ATR multiples. Not financial advice—backtest thoroughly.
Customization: Tweak multipliers for different assets; higher for volatile cryptos, lower for stocks.
Limitations: Relies on historical data; may generate false signals in ranging markets. Combine with other indicators like volume or support/resistance.
This indicator is for educational purposes. Always use discretion and proper risk management in live trading. If you find it useful, feel free to share feedback or suggestions!
Orthogonal Projections to Latent Structures (O-PLS)Version 0.1 
 Orthogonal Projections to Latent Structures (O-PLS) Indicator for TradingView
 
This indicator, named "Orthogonal Projections to Latent Structures (O-PLS)", is designed to help traders understand the relevance or predictive power of various market variables on the future close price of the asset it's applied to. Unlike standard correlation coefficients that show a simple linear relationship, O-PLS aims to separate variables into "predictive" (relevant to Y) and "orthogonal" (irrelevant noise) components. This Pine Script indicator provides a simplified proxy of the relevance score derived from O-PLS principles.
 Purpose of the Indicator
 
The primary purpose of this indicator is to identify which technical factors (such as price, volume, and other indicators) have the strongest relationship with the future price movement of the current trading instrument. By providing a "relevance score" for each input variable, it helps traders focus on the most influential data points, potentially leading to more informed trading decisions.
Inputs
The indicator offers the following user-definable inputs:
* **Lookback Period:** This integer input (default: 100, min: 10, max: 500) determines the number of past bars used to calculate the relevance scores for each variable. A longer lookback period considers more historical data, which can lead to smoother, less reactive scores but might miss recent shifts in variable importance.
* **External Asset Symbol:** This symbol input (default: `BINANCE:BTCUSDT`) allows you to specify an external asset (e.g., `BINANCE:ETHUSDT`, `NASDAQ:TSLA`) whose close price will be included in the analysis as an additional variable. This is useful for cross-market analysis to see how other assets influence the current chart.
* **Plot Visibility Checkboxes (e.g., "Plot: Open Price Relevance", "Plot: Volume Relevance", etc.):** These boolean checkboxes allow you to toggle the visibility of individual relevance score plots on the chart, helping to declutter the display and focus on specific variables.
Outputs
The indicator provides two main types of output:
 Relevance Score Plots:  These are lines plotted in a separate pane below the main price chart. Each line corresponds to a specific market variable (Open Price, Close Price, High Price, Low Price, Volume, various RSIs, SMAs, MFI, and the External Asset Close). The value of each line represents the calculated "relevance score" for that variable, typically scaled between 0 and 10. A higher score indicates a stronger predictive relationship with the future close price.
 Sorted Relevance Table : A table displayed in the top-right corner of the chart provides a clear, sorted list of all analyzed variables and their corresponding relevance scores. The table is sorted in descending order of relevance, making it easy to identify the most influential factors at a glance. Each variable name in the table is colored according to its plot color, and the external asset's name is dynamically displayed without the "BINANCE:" prefix.
How to Use the Indicator
1.  **Add to Chart:** Apply the "Orthogonal Projections to Latent Structures (O-PLS)" indicator to your desired trading chart (e.g., ETH/USDT).
2.  **Adjust Inputs:**
    * **Lookback Period:** Experiment with different lookback periods to see how the relevance scores change. A shorter period might highlight recent correlations, while a longer one might show more fundamental relationships.
    * **External Asset Symbol:** If you trade BTC/USDT, you might add ETH/USDT or SPX as an external asset to see its influence.
3.  **Analyze Relevance Scores:**
    * **Plots:** Observe the individual relevance score plots over time. Are certain variables consistently high? Do scores change before significant price moves?
    * **Table:** Refer to the sorted table on the latest confirmed bar to quickly identify the top-ranked variables.
4.  **Incorporate into Strategy:** Use the insights from the relevance scores to:
    * Prioritize certain indicators or price actions in your trading strategy. For example, if "Volume" has a high relevance score, it suggests volume confirmation is critical for future price moves.
    * Understand the influence of inter-market relationships (via the External Asset Close).
How the Indicator Works
The indicator works by performing the following steps on each bar:
1.  **Data Fetching:** It gathers historical data for various price components (open, high, low, close), volume, and calculated technical indicators (SMA, RSI, MFI) for the specified `lookback` period.  It also fetches the close price of an `External Asset Symbol` .
2.  **Standardization (Z-scoring):** All collected raw data series are standardized by converting them into Z-scores.  This involves subtracting the mean of each series and dividing by its standard deviation . Standardization is crucial because it brings all variables to a common scale, preventing variables with larger absolute values from disproportionately influencing the correlation calculations.
3.   **Correlation Calculation (Proxy for O-PLS Relevance):** The indicator then calculates a simplified form of correlation between each standardized input variable and the standardized future close price (Y variable) . This correlation is a proxy for the relevance that O-PLS would identify. A high absolute correlation indicates a strong linear relationship.
4.   **Relevance Scaling:** The calculated correlation values are then scaled to a range of 0 to 10 to provide an easily interpretable "relevance score" .
5.   **Output Display:** The relevance scores are presented both as time-series plots (allowing observation of changes over time) and in a real-time sorted table (for quick identification of top factors on the current bar) .
How it Differs from Full O-PLS
This indicator provides a *simplified proxy* of O-PLS principles rather than a full, mathematically rigorous O-PLS model. Here's why and how it differs:
* **Dimensionality Reduction:** A full O-PLS model would involve complex matrix factorization techniques to decompose the independent variables (X) into components that are predictive of Y and components that are orthogonal (unrelated) to Y but still describe X's variance. Pine Script's array capabilities and computational limits make direct implementation of these matrix operations challenging.
* **Orthogonal Components:** A true O-PLS model explicitly identifies and removes orthogonal components (noise) from the X data that are unrelated to Y. This indicator, in its simplified form, primarily focuses on the direct correlation (relevance) between each X variable and Y after standardization, without explicitly modeling and separating these orthogonal variations.
* **Predictive Model:** A full O-PLS model is ultimately a predictive model that can be used for regression (predicting Y). This indicator, however, focuses solely on **identifying the relevance/correlation of inputs to Y**, rather than building a predictive model for Y itself. It's more of an analytical tool for feature importance than a direct prediction engine.
* **Computational Intensity:** Full O-PLS involves Singular Value Decomposition (SVD) or Partial Least Squares (PLS) algorithms, which are computationally intensive. The indicator uses simpler statistical measures (mean, standard deviation, and direct correlation calculation over a lookback window) that are feasible within Pine Script's execution limits.
In essence, this Pine Script indicator serves as a practical tool for gaining insights into variable relevance, inspired by the spirit of O-PLS, but adapted for the constraints and common use cases of a TradingView environment.
MA Crossover Strategy with TP/SL (5 EMA Filter)How the Strategy Works on a 5-Minute Chart:
Data Input (5-Minute Candles):
Every single data point (candle) on your chart will represent 5 minutes of price action (Open, High, Low, Close for that 5-minute period).
All calculations (MAs, EMA, signals) will be based on these 5-minute price data points.
Moving Average Calculations:
Fast MA (10-period SMA): This will be the Simple Moving Average of the closing prices of the last 10 five-minute candles. It reacts relatively quickly to recent price changes.
Slow MA (30-period SMA): This will be the Simple Moving Average of the closing prices of the last 30 five-minute candles. It represents a slightly longer-term trend compared to the Fast MA.
5 EMA (5-period EMA): This is the Exponential Moving Average of the closing prices of the last 5 five-minute candles. Being an EMA, it gives more weight to the most recent 5-minute prices, making it very responsive to immediate price action.
Signal Generation (Entry Conditions):
Long Entry Signal:
The 10-period SMA crosses above the 30-period SMA (indicating a potential bullish shift in the short-to-medium term trend).
AND the current 5-minute candle's closing price is above the 5-period EMA (confirming that the immediate price momentum is also bullish and supporting the crossover).
If both conditions are met at the close of a 5-minute candle, a "Buy" signal is generated.
Short Entry Signal:
The 10-period SMA crosses below the 30-period SMA (indicating a potential bearish shift).
AND the current 5-minute candle's closing price is below the 5-period EMA (confirming immediate bearish momentum).
If both conditions are met at the close of a 5-minute candle, a "Sell" signal is generated.
Trade Execution:
When a signal is triggered, the strategy enters a trade (long or short) at the closing price of that 5-minute candle.
Immediately upon entry, it places two contingent orders:
Take Profit (Target): Set at 2% (by default) away from your entry price. For a long trade, it's 2% above; for a short trade, 2% below.
Stop Loss: Set at 1% (by default) away from your entry price. For a long trade, it's 1% below; for a short trade, 1% above.
The trade will remain open until either the Take Profit or Stop Loss price is hit by subsequent 5-minute candles.
Implications for Trading on a 5-Minute Chart:
Increased Trade Frequency: You will likely see many more signals and trades compared to higher timeframes (like 1-hour or daily charts). This means more potential opportunities but also more transaction costs (commissions, slippage).
Sensitivity to Noise: Lower timeframes are more prone to "market noise" – small, random price fluctuations that don't indicate a true trend. While the 5 EMA filter helps, some false signals might still occur.
Faster Price Action: Price movements can be very rapid on a 5-minute chart. Your take profit or stop loss levels might be hit very quickly, sometimes within the same or next few candles.
Parameter Optimization is Crucial: The default MA lengths (10, 30) and EMA (5) might not be optimal for every asset or market condition on a 5-minute chart. You'll need to backtest extensively and potentially adjust these lengths, as well as the targetPerc and stopPerc, to find what works best for the specific instrument you're trading.
Risk Management: The fixed percentage stop loss is vital on a 5-minute chart due to its volatility. Without it, a few unfavorable moves could lead to significant losses.
Frahm FactorIntended Usage of the Frahm Factor Indicator
The Frahm Factor is designed to give you a rapid, at-a-glance assessment of how volatile the market is right now—and how large the average candle has been—over the most recent 24-hour window. Here’s how to put it to work:
Gauge Volatility Regimes
Volatility Score (1–10)
A low score (1–3, green) signals calm seas—tight ranges, low risk of big moves.
A mid score (4–6, yellow) warns you that volatility is picking up.
A high score (7–10, red) tells you to prepare for disorderly swings or breakout opportunities.
How to trade off it
In low-volatility periods, you might favor mean-reversion or range-bound strategies.
As the score climbs into the red zone, consider widening stops, scaling back position size, or switching to breakout momentum plays.
Monitor Average Candle Size
Avg Candle (ticks) cell shows you the mean true-range of each bar over that 24h window in ticks.
When candles are small, you know the market is consolidating and liquidity may be thin.
When candles are large, momentum and volume are driving strong directional bias.
The optional dynamic color ramp (green→yellow→red) immediately flags when average bar size is unusually small or large versus its own 24h history.
Customize & Stay Flexible
Timeframes: Works on any intraday chart—from 1-minute scalping to 4-hour swing setups—because it always looks back exactly 24 hours.
Toggles:
Show or hide the Volatility and Avg-Candle cells to keep your screen uncluttered.
Turn on the dynamic color ramp only when you want that extra visual cue.
Alerts: Built-in alerts fire automatically at meaningful thresholds (Volatility ≥ 8 or ≤ 3), so you’ll never miss regime shifts, even if you step away.
Real-World Applications
Risk Management: Automatically adjust your stop-loss distances or position sizing based on the current volatility band.
Strategy Selection: Flip between range-trading and momentum strategies as the volatility regime changes.
Session Analysis: Pinpoint when during the day volatility typically ramps—perfect for doorway sessions like London opening or the US midday news spikes.
Bottom line: the Frahm Factor gives you one compact dashboard to see the pulse of the market—so you can make choices with conviction, dial your risk in real time, and never be caught off guard by sudden volatility shifts.
Logic Behind the Frahm Factor Indicator
24-Hour Rolling Window
On every intraday bar, we append that bar’s True Range (TR) and timestamp to two arrays.
We then prune any entries older than 24 hours, so the arrays always reflect exactly the last day of data.
Volatility Score (1–10)
We count how many of those 24 h TR values are less than or equal to the current bar’s TR.
Dividing by the total array size gives a percentile (0–1), which we scale and round into a 1–10 score.
Average Candle Size (ticks)
We sum all TR values in the same 24 h window, divide by array length to get the mean TR, then convert that price range into ticks.
Optionally, a green→yellow→red ramp highlights when average bar size is unusually small, medium or large versus its own 24 h history.
Color & Alerts
The Volatility cell flips green (1–3), yellow (4–6) or red (7–10) so you see regime shifts at a glance.
Built-in alertcondition calls fire when the score crosses your high (≥ 8) or low (≤ 3) thresholds.
Modularity
Everything—table location, which cells to show, dynamic coloring—is controlled by simple toggles, so you can strip it back or layer on extra visual cues as needed.
That’s the full recipe: a true 24 h look-back, a percentile-ranked volatility gauge, and a mean-bar-size meter, all wrapped into one compact dashboard.
Timeframe LoopThe  Timeframe Loop  publication aims to visualize intrabar price progression in a new, different way.
  
🔶  CONCEPTS and USAGE 
I got inspiration from the Pressure/Volume loop, which is used in Mechanical Ventilation with Critical Care patients to visualize pressure/volume evolution during inhalation/exhalation.
  
The main idea is that intrabar prices are visualized by a loop, going to the right during the first half and returning to the left towards its closing point. Here, the main chart timeframe (CTF) is 4 hours, and we see the movements of eight 30-minute lower timeframe (LTF) periods, highlighted by four yellow dots/lines (first 2 hours -> "Right") and four blue dots/lines (last 2 hours <- "Left"):
  
🔹  BTF 
If "Show Lowest TF" is enabled, the LTF is split into another lower TF (BTF - "Base TF"); in this case, the 30-minute LTF is split into 10 parts of 3 minutes (BTF):
  
Enabling "Loop Lowest TF" will enable the BTF to react similarly to the largest loop; from halfway, it will return to its startpoint:
  
Here is a more detailed example:
  
🔹  Mini-Candles 
The included option "Mini-Candles" will bring even more detail, showing the LTF as Japanese candlesticks with user-defined colors and adjustable body width; in this example, the mini-candles associated with the first half (yellow lines/dots) are green/red, while blue/fuchsia in the second half (blue lines/dots):
CTF 10 minutes, LTF 1 minute, BTF 5 seconds
  
One can see the detailed intrabar price progression in one glance.
CTF 5 minutes, LTF 1 minute, BTF 5 seconds
  
If the LTF/BTF ratio, divided by two, results in a non-integer number, the right side will be a vertical line instead of just a turning point. In that case, the smaller, most right blue loop will be situated at the right of that line.
 
 10 minutes / 1 minute = 10 -> 10 / 2 =    5 parts
     5 minutes / 1 minute =   5 ->   5 / 2 = 2.5 parts
 
🔶  SETTINGS 
🔹  Timeframes 
 
 Lower Timeframe 1
 Lower Timeframe 2
 
No need to worry about the order of both timeframes; BTF will be the lowest TF of the 2, LTF the highest; both have to be lower than the main chart TF (CTF); otherwise, it will result in the error: "`Lower Timeframes` should be lower than current chart timeframe".
  
The ratio LTF / BTF should be equal or higher than 2; otherwise, this error will show: "`Lower Timeframe` should minimally be twice the `Base (smallest) Timeframe`"
Lastly, the ratio CTF / BTF should be lower than 500; otherwise, this error will pop up: "`Current Chart timeframe` / `Lower Timeframe` should be less than 500."
I have tried to capture runtime errors as best I could. If one should be triggered (red exclamation mark next to the title), it is best to increase the lowest TF.
🔹  Options 
 
 Show Lowest TF: Show BTF progression.
 Loop Lowest TF: Enabling will let the BTF line return halfway.
 Show Mini-Candles
 Show Steps
 
"Show Steps" can be useful to see how the script works, where the location of the current price is compared against the position of the left (L) and right (R) labels:
  
🔹  Style 
  
MTF RSI MA System + Adaptive BandsMTF RSI MA System + Adaptive Bands
 Overview 
MTF RSI MA System + Adaptive Bands is a highly customizable Pine Script indicator for traders seeking a versatile tool for multi-timeframe (MTF) analysis. Unlike traditional RSI, it focuses on the Moving Average of RSI (RSI MA), delivering smoother and more flexible trading signals. The main screenshot displays the indicator in two panels to showcase its diverse capabilities.  
Important: Timeframes do not adjust automatically – users must manually set them to match the chart’s timeframe.
 Features 
Core Component: Built around RSI MA, not raw RSI, for smoother trend signals.
Multi-Timeframe: Analyze RSI MA across three customizable timeframes (default: 4H, 8H, 12H).
Adaptive Bands: Three band calculation methods (Fixed, Percent, StdDev) for dynamic signals.
Flexible Signals: Generated via RSI MA crossovers, band interactions, or directional alignment across timeframes.
Background Coloring: Highlights when RSI MAs across timeframes move in the same direction, aiding trend confirmation.
 Screenshot Panels Configuration 
Upper Panel: Shows RSI, RSI MA, and fixed bands for reversal strategies (RSI crossing bands).
Lower Panel: Displays three RSI MAs (Alligator-style) for trend-following, with background coloring for directional alignment.
 Band Calculation Methods 
The indicator offers three ways to calculate bands around RSI MA, each with unique characteristics:
Fixed Bands
Set at a fixed point value (default: 10) above and below RSI MA.
Example: If RSI MA = 50, band value = 10 → upper band = 60, lower = 40.
Use Case: Best for stable markets or fixed-range preferences.
Tip: Adjust the band value to widen or narrow the range based on asset volatility.
Percent Bands
Calculated as a percentage of RSI MA (default: 10%).
Example: If RSI MA = 50, band value = 10% → upper band = 55, lower = 45.
Use Case: Ideal for assets with varying volatility, as bands scale with RSI MA.
Tip: Experiment with percentage values to match typical price swings.
Standard Deviation Bands (StdDev)
Based on RSI’s standard deviation over the MA period, multiplied by a user-defined factor (default: 10).
Example: If RSI MA = 50, standard deviation = 5, factor = 2 → upper band = 60, lower = 40.
Important: The default value (10) may produce wide bands. Reduce to 1–2 for tighter, practical bands.
Use Case: Best for dynamic markets with fluctuating volatility.
 Configuration Options 
RSI Length: Set RSI calculation period (default: 20).
MA Length: Set RSI MA period (default: 20).
MA Type: Choose SMA or EMA for RSI MA (default: EMA).
Timeframes: Configure three timeframes (default: 4H, 8H, 12H) for MTF analysis.
Overbought/Oversold Levels: Optionally display fixed levels (default: 70/30).
Background Coloring: Enable/disable for each timeframe to highlight directional alignment.
 How to Use 
Add Indicator: Load it onto your TradingView chart.
Setup:
Reversals: Configure like the upper panel (RSI, RSI MA, bands) and watch for RSI crossing bands.
Trends: Configure like the lower panel (three RSI MAs) and look for fastest MA crossovers and background coloring.
Adjust Timeframes: Manually set tf1, tf2, tf3 (e.g., 1H, 2H, 4H on a 1H chart) to suit your strategy.
Adjust Bands: Choose band type (Fixed, Percent, StdDev) and value. For StdDev, reduce to 1–2 for tighter bands.
Experiment: Test settings to match your trading style, whether scalping, swing trading, or long-term.
 Notes 
Timeframes: Always match tf1, tf2, tf3 to your chart’s needs, as they don’t auto-adjust.
StdDev Bands: Lower the default value (10) to avoid overly wide bands.
Versatility: Works across markets (stocks, forex, crypto).
Golden Key: Opening Channel DashboardGolden Key: Opening Channel Dashboard   
Complementary to the original  Golden Key – The Frequency   
Upgrade of  10 Monday's 1H Avg Range + 30-Day Daily Range 
 This indicator provides a structured dashboard to monitor the opening channel range and related metrics on 15m and 5m charts. Built to work alongside the Golden Key methodology, it focuses on pip precision, average volatility, and SL sizing. 
 What It Does 
 
 Detects first 4 candles of the session:
 
 15m chart → first 4 Monday candles (1 hour)
 5m chart → first 4 candles of each day (20 minutes)
 
 Calculates pip range of the opening move
 Stores and averages the last 10 such ranges
 Calculates daily range average over 10 or 30 days
 Generates SL size based on your multiplier setting
 Auto-adjusts for FX, JPY, and XAUUSD pip sizes
 Displays all values in a clean table in the top-right
 
 How to Use It 
 
 Add to a 15m or 5m chart
 Compare the current opening range to the average
 Use the daily average to assess broader volatility
 Define SL size using the opening range x multiplier
 Customize display colors per table row
 
 About This Script 
This is not a visual box-style indicator. It is designed to complement the original “Golden Key – The Frequency” by focusing on metric output. It is also an upgraded version of the earlier "10 Monday’s 1H Avg Range" script, now supporting multi-timeframe logic and additional customization.
 Disclaimer   
This is a technical analysis tool. It does not provide trading advice. Use it in combination with your own research and strategy.






















