AlphaAlpha is a measure of the active return on an investment, the performance of that investment compared to the S&P500 index, where 0.01 = 1%
alpha < 0: the investment has earned too little for its risk (or, was too risky for the return)
alpha = 0: the investment has earned a return adequate for the risk taken
alpha > 0: the investment has a return in excess of the reward for the assumed risk
Recherche dans les scripts pour "ha溢价率"
Mister Transistor 3.0This is a general purpose very flexible program to test the effectiveness of HA bars.
Please note that if you are charting at tradingview using Heikin-Ashi charting, your system will be trading fictitious prices even if you check the "use real prices" box. Thought you might like to know that before you lose all your money.
This program performs the HA calcs internally thus allowing you to use HA bars on a standard bar chart and obtaining real prices for your trades.
Courtesy of Boffin Hollow Lab
Author: Tarzan the Ape Man
Trailing Sharpe RatioThe Sharpe ratio allows you to see whether or not an investment has historically provided a return appropriate to its risk level. A Sharpe ratio above one is acceptable, above 2 is good, and above 3 is excellent. A Sharpe ratio less than one would indicate that an investment has not returned a high enough return to justify the risk of holding it. Interesting in this example, SPY's one year avg Sharpe ratio is above 3. This would mean on average SPY returns 3x better returns than the risk associated with holding it, implying there is some sort of underlying value to the investment.
When the sharpe ratio is above its signal, this implies the investment is currently outperforming compared to its typical return, below the signal means the investment is currently under performing. A negative Shape would mean that the investment has not provided a positive return, and may be a possible short candidate.
Zweig Market Breadth Thrust Indicator [LazyBear]The Breadth Thrust (BT) indicator is a market momentum indicator developed by Dr. Martin Zweig. According to Dr. Zweig a Breadth Thrust occurs when, during a 10-day period, the Breadth Thrust indicator rises from below 40 percent to above 61.5 percent.
A "Thrust" indicates that the stock market has rapidly changed from an oversold condition to one of strength, but has not yet become overbought. This is very rare and has happened only a few times. Dr. Zweig also points out that most bull markets begin with a Breadth Thrust.
All parameters are configurable. You can draw BT for NYSE, NASDAQ, AMEX or based on combined data (i.e., AMEX+NYSE+NASD). There is also a "CUSTOM" mode supported, so you can enter your own ADV/DEC symbols.
More info:
Definition: www.investopedia.com
A Breadth Thrust Signal: www.mcoscillator.com
A Rare "Zweig" Buy Signal: www.moneyshow.com
Zweig Breadth Thrust: recessionalert.com
List of my public indicators: bit.ly
List of my app-store indicators: blog.tradingview.com
KK_Traders Dynamic Index_Bar HighlightingHey guys,
this is one of my favorite scripts as it represents a whole trading system that has given me very good results!
I have only used it on Bitcoin so far but I am sure it will also work for other instruments.
The original code to this was created by LazyBear, so all props to him for this great script!
I have linked his original post down below.
You can find the full rules to the system in this PDF (which has also been taken from LBs post):
www.forexmt4.com
Here is a short summary of the rules:
Go long when (all conditions have to be met):
The green line is above 50
The green line is above the red line
The green line is above the orange line
The close is above the upper Band of the Price Action Channel
The candles close is above its open
(The green line is below 68)
Go short when (all conditions have to be met):
The green line is below 50
The green line is below the red line
The green line is below the orange line
The close is below the lower band of the Price Action Channel
The candles close is below its open
(The green line is above 32)
Close when:
Any of these conditions aren't true anymore.
I have marked two of the rules in brackets as they seem to cut out a lot of the profits this system generates. You can choose to still use these rules by checking the box that says "Use Original Ruleset" in the options.
The system also contains rules regarding the Heiken Ashi bars. However these aren't as specific as the other rules. This is where your personal judgement comes in and this part is hard to explain. Take a look at the PDF I have linked to get a better understanding.
So far, this is just the TDI trading system and LBs script, now what have I changed?
I have incorporated the Price Action Channel to the system and changed it so that it highlights the bars whenever the system is giving a signal. As long as the bars are green the system is giving a long signal, as long as they are red the system is giving a short signal. Keep in mind that this doesn't consider the bar size of the HA bars. I recommend coloring all bars grey via the chart settings in order to be able to see the bar highlighting properly.
I have also published the Price Action Channel seperately in case some of you wish to view the Channel.
I am fairly new to creating scripts so use it with caution and let me know what you think!
LBs original post:
The seperate Price Action Channel script:
CM Stochastic POP Method 1 - Jake Bernstein_V1A good friend ucsgears recently published a Stochastic Pop Indicator designed by Jake Bernstein with a modified version he found.
I spoke to Jake this morning and asked if he had any updates to his Stochastic POP Trading Method. Attached is a PDF Jake published a while back (Please read for basic rules, which also Includes a New Method). I will release the Additional Method Tomorrow.
Jake asked me to share that he has Updated this Method Recently. Now across all symbols he has found the Stochastic Values of 60 and 30 to be the most profitable. NOTE - This can be Significantly Optimized for certain Symbols/Markets.
Jake Bernstein will be a contributor on TradingView when Backtesting/Strategies are released. Jake is one of the Top Trading System Developers in the world with 45+ years experience and he is going to teach how to create Trading Systems and how to Optimize the correct way.
Below are a few Strategy Results....Soon You Will Be Able To Find Results Like This Yourself on TradingView.com
BackTesting Results Example: EUR-USD Daily Chart Since 01/01/2005
Strategy 1:
Go Long When Stochastic Crosses Above 60. Go Short When Stochastic Crosses Below 30. Exit Long/Short When Stochastic has a Reverse Cross of Entry Value.
Results:
Total Trades = 164
Profit = 50, 126 Pips
Win% = 38.4%
Profit Factor = 1.35
Avg Trade = 306 Pips Profit
***Most Consecutive Wins = 3 ... Most Consecutive Losses = 6
Strategy 2:
Rules - Proprietary Optimization Jake Will Teach. Only Added 1 Additional Exit Rule.
Results:
Total Trades = 164
Profit = 62, 876 Pips!!!
Win% = 38.4%
Profit Factor = 1.44
Avg Trade = 383 Pips Profit
***Most Consecutive Wins = 3 ... Most Consecutive Losses = 6
Strategy 3:
Rules - Proprietary Optimization Jake Will Teach. Only added 1 Additional Exit Rule.
Results:
Winning Percent Increases to 72.6%!!! , Same Amount of Trades.
***Most Consecutive Wins = 21 ...Most Consecutive Losses = 4
Indicator Includes:
-Ability to Color Candles (CheckBox In Inputs Tab)
Green = Long Trade
Blue = No Trade
Red = Short Trade
-Color Coded Stochastic Line based on being Above/Below or In Between Entry Lines.
Link To Jakes PDF with Rules
dl.dropboxusercontent.com
We Are Witnessing A Historical Event With A Clear Outcome!!!"Full Disclosure: I came across this information from www.SentimenTrader.com
I have no financial affiliation…They provide incredible statistical facts on
The General Market, Currencies, and Futures. They offer a two week free trial.
I Highly Recommend.
The S&P 500 has gone 43 trading days without a 1% daily move, up or down.
which is the equivalent of two months and one day in trading days.
During this stretch, the S&P has gained more than 4%,
and it has notched a 52-week high recently as well.
Since 1952, there were nine other precedents. All of
these went 42 trading days without a 1% move, all of
them saw the S&P gain at least 4% during their streaks,
and all of them saw the S&P close at a 52-week highs.
***There was consistent weakness a week later, with only three
gainers, and all below +0.5%.
***After that, stocks did better, often continuing an Extraordinary move higher.
Charts can sometimes give us a better nuance than
numbers from a table, and from the charts we can see a
general pattern -
***if stocks held up well in the following
weeks, then they tended to do extremely well in the
months ahead.
***If stocks started to stumble after this two-
month period of calm, however, then the following months
tended to show a lot more volatility.
We already know we're seeing an exceptional market
environment at the moment, going against a large number
of precedents that argued for weakness here, instead of
the rally we've seen. If we continue to head higher in
spite of everything, these precedents would suggest that
we're in the midst of something that could be TRULY EXTRAORDINARY.
Trading Strategy based on BB/KC squeeze**** [Edit: New version (v02) posted, see the comments section for the code *****
Simple strategy. You only consider taking a squeeze play when both the upper and lower Bollinger Bands go inside the Keltner Channel. When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and a move is about to take place.
I have added more support indicators -- I highlight the bullish / bearish KC breaches (using GREEN/RED crosses) and a SAR to see where price action is trending.
Appreciate any feedback. Enjoy!
Color codes for v02:
----------------------------
When both the upper and lower Bollinger Bands go inside the Keltner Channel, the squeeze is on and is highlighted in RED.
When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and is highlighted in GREEN.
When one of the Bollinger Bands is out of Keltner Channel, no highlighting is done (this means, the background color shows up, so don't get confused if you have RED/GREEN in your chart's bground :))
Color codes for v01:
----------------------------
When both the upper and lower Bollinger Bands go inside the Keltner Channel, the squeeze is on and is highlighted in YELLOW.
When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and is highlighted in BLUE.
The Strat - Levels [rdjxyz]◆ OVERVIEW
The Strat - Levels dynamically displays key levels used in The Strat trading methodology, developed by Rob Smith. The level colors are dynamically determined by their Strat classification (1, 2 up, failed 2 up, 2 down, failed 2 down, 3)—making it easy to recognize higher timeframe Strat candle classifications from any lower timeframe.
◆ DETAILS
If you're unfamiliar with The Strat, there are 3 universal scenarios regarding candle behavior:
SCENARIO ONE
The 1 Bar - Inside Bar: A candle that doesn't take out the highs or the lows of the previous candle; aka consolidation.
SCENARIO TWO
The 2 Bar - Directional Bar: A candle that takes out one side of the previous candle; aka trending (or at least attempting to trend).
These can be broken down even further as follows:
2 Up: A candle that takes out the high of the previous candle and closes bullish
Failed 2 Up: A candle that takes out the high of the previous candle and closes bearish
2 Down: A candle that takes out the low of the previous candle and closes bearish
Failed 2 Down: A candle that takes out the low of the previous candle and closes bullish
SCENARIO THREE
The 3 Bar - Outside Bar: A candle that takes out both sides of the previous candle; aka broadening formation.
◇ HOW THE DYNAMIC LEVEL COLORING WORKS
PREVIOUS LEVELS
Previous Day High/Low
Previous Week High/Low
Previous Month High/Low
Previous Quarter High/Low
Previous Year High/Low
Each period's levels are compared to their previous period's levels and colored according to the 3 universal scenarios, which are fixed based on historical data. (No repainting)
CURRENT LEVELS
Current Day Open
Current Week Open
Current Month Open
Current Quarter Open
Current Year Open
Each current period's levels (high, low, and current price) are compared to the previous period's levels and current period's open on every tick—changing colors in real-time as their Strat classification changes. (Will repaint as price action evolves)
E.g. When a new day opens inside of the previous day's range (high/low) the Day Open line will be gray (default for inside bars). When the current day trades above the previous day's range, the Day Open line will become aqua (default for 2 up). If price trades back below the current day's open, the Day Open line will become fuchsia (default for failed 2 up). And if price trades below the previous day's range, the Day Open line will become dark purple (default for 3s).
◆ SETTINGS
Current Day Open
Previous Day High/Low
Current Week Open
Previous Week High/Low
Current Month Open
Previous Month High/Low
Current Quarter Open
Previous Quarter High/Low
Current Year Open
Previous Year High/Low
Strat Colors
Each Current Level Open has 4 inputs:
Show/Hide Checkbox
Line Style
Line Width
Label Offset (Integer)
Each Previous Level High/Low has 5 inputs:
Show/Hide High Checkbox
Show/Hide Low Checkbox
Line Style
Line Width
Label Offset (Integer)
And each Strat scenario can be custom colored:
1-Bar Color - Default Gray
2-Up Color - Default Aqua
Failed 2-Up Color - Default Fuchsia
2-Down Color - Default White
Failed 2-Down Color - Default Teal
3-Bar Color - Default Dark Purple
◆ USAGE
There are 3 ways to look at these levels:
Potential continuation (e.g. Previous Day's 2-Up High being broken by Current Day's Price)
Potential reversal (e.g. Previous Day's 2-Down High being broken by Current Day's Price)
Potential exhaustion risk (e.g. Previous Month's Low is broken by Current Day's Price but trades back up into the Previous Month's range)
It's best to use this indicator with a separate indicator that color codes your chart's candles according to their Strat Scenario (1, 2, 3) and use top-down analysis to gauge whether to view levels as a sign of continuation, reversal, or exhaustion risk.
◆ WRAP UP
As demonstrated, The Strat - Levels offers Strat Scenario color-coded key levels, making it easy to identify the previous period's Strat Scenario (1, 2-Up, Failed 2-Up, 2-Down, Failed 2-Down, or 3) without needing to manually plot levels or refer to higher timeframes.
◆ DISCLAIMER
This indicator is a tool for visual analysis and is intended to assist traders who follow The Strat methodology. As with any trading methodology, there's no guarantee of profits; trading involves a high degree of risk and you could lose all of your invested capital. Use of this indicator is not indicative of future results and does not constitute and should not be construed as investment advice. All trading decisions and investments made by you are at your own discretion and risk. Under no circumstances shall the author be liable for any direct, indirect, or incidental damages. You should only risk capital you can afford to lose.
Compression Breakout [30min 65+33 EMA]Compression Breakout
by GhostMMXM (inspired by Chris Cady & Steidlmayer Market Profile principles)
This indicator automates the exact compression-to-displacement setup that veteran CBOT floor trader and Market Profile pioneer Chris Cady describes in interviews and his work with Peter Steidlmayer.
Core idea
Chris Cady uses two simple moving averages on the 30-minute chart — a 33-period and a 65-period — to visually detect when the market falls into “balance” (compression). When both lines go almost perfectly flat for several bars, the market is in a low-volatility, high-consensus state — the calm before a violent vertical breakout.
What this script does
• Detects when both the 33 EMA and 65 EMA are virtually flat (user-adjustable sensitivity)
• Requires a minimum of 6 consecutive flat bars (adjustable) before declaring compression
• Draws a light-grey background + live-updating box showing the detecting compression
• Triggers only on the first strong displacing bar that:
– closes entirely above the compression high OR entirely below the compression low
– has a range ≥ 1.5× the average bar range inside the compression zone (adjustable)
• Plots a clear “LONG Cady Break” or “SHORT Cady Break” label on the breakout bar
• Fires a clean alert instantly usable on entire watchlists:
BTC → Compression LONG breakout!
ES1! → Compression SHORT breakout!
Designed for 30-minute charts (BTC, ETH, SOL, NQ, CL, GC, etc.) but works on any timeframe.
Perfect for traders who want to catch the highest-conviction vertical moves that Chris Cady has traded for decades with only a few contracts scaled in aggressively on the break.
Settings
• Minimum flat bars for compression (default 6)
• Max % slope to be considered flat (default 0.08 %)
• Minimum range multiplier vs compression average (default 1.5×)
Enjoy the cleanest, most mechanical version of Chris Cady’s famous compression breakout strategy available on TradingView.
Happy trading!
Momentum Day Trading ToolkitMomentum Day Trading Toolkit
Complete User Guide
Table of Contents
Overview
Quick Start
The Dashboard
Module 1: 5 Pillars Screener
Module 2: Gap & Go
Module 3: Bull Flag / Flat Top
Module 4: Float Rotation
Module 5: R2G / G2R
Module 6: Micro Pullback
Signal Reference
Quality Score
Settings Guide
Alerts Setup
Trading Workflows
Troubleshooting
Overview
The Momentum Day Trading Toolkit combines 6 powerful indicators into one unified system for day trading momentum stocks.
ModulePurpose① 5 PillarsConfirms stock is "in play"② Gap & GoPre-market levels & gap analysis③ Bull Flag / Flat TopClassic breakout patterns④ Float RotationMeasures true interest level⑤ R2G / G2RTracks prior close crosses⑥ Micro PullbackPrecision continuation entries
All modules work together - the dashboard shows you everything at a glance, and you can enable/disable any module you don't need.
Quick Start
Step 1: Add to Chart
Add the indicator to any stock chart
Recommended timeframes: 1-minute, 5-minute, or 15-minute
Step 2: Check the Dashboard (Top Right)
Look for:
Status = Current state (Scanning, Entry Signal, etc.)
Quality Score = Setup rating out of 10
Green checkmarks (✓) = Criteria passing
Step 3: Watch for Entry Signals
Triangles, circles, diamonds below bars = Entry signals
Arrows = R2G/G2R crosses
Step 4: Set Alerts
Right-click chart → Add Alert
Select "Momentum Day Trading Toolkit"
Choose your alert condition
The Dashboard
The dashboard in the top-right corner gives you instant analysis:
┌─────────────────────────────┐
│ MOMENTUM TOOLKIT │
├─────────────────────────────┤
│ Status │ 🎯 ENTRY SIGNAL │
│ Day │ 🟢 GREEN │
│ Gap │ +8.5% 🔥 │
│ RVol │ 3.2x ✓ │
│ Rotation │ 1.45x 🔥 │
│ Float │ 5.2M 🔥 │
│ Change │ +12.3% ✓ │
│ Pattern │ BULL FLAG! │
│ EMA 9/20 │ Above Both ✓ │
│ VWAP │ Above ✓ │
│ Prior Cl │ 5.91 │
│ PM High │ 9.11 ✓ │
│ Price │ 9.46 ✓ │
└─────────────────────────────┘
Dashboard Row Reference
RowWhat It ShowsGood ValuesStatusCurrent state🎯 ENTRY SIGNALDayGreen/Red vs prior close🟢 GREENGapGap % from prior close🔥 (5%+) or 🔥🔥 (10%+)RVolRelative volume✓ (2x+) or ✓✓ (5x+)RotationFloat rotation🔥 (1x) or 🔥🔥 (2x+)FloatFloat in millions🔥 (<5M) or Low (<10M)ChangeDaily % change✓ (meets minimum)PatternPattern statusBREAKOUT!EMA 9/20Trend positionAbove Both ✓VWAPVWAP positionAbove ✓Prior CloseKey R2G levelReference pricePM HighPre-market high✓ = Above itPriceCurrent price✓ = In range
Status Messages
StatusMeaningActionScanning...Looking for setupsWait✅ ALL PILLARSStock qualifiesWatch for pattern⏳ PATTERN FORMINGSetup developingGet ready🎯 ENTRY SIGNALSignal triggeredExecute trade
Module 1: 5 Pillars Screener
What It Does
Confirms the stock meets basic criteria to be worth trading.
The 5 Pillars
PillarDefaultWhy It MattersRelative Volume2x+ (5x for "strong")Confirms unusual interestDaily Change5%+Stock is movingPrice Range$1-$20Sweet spot for momentumFloat Size<20M sharesLower float = bigger moves
Visual Indicator
Green background appears when ALL pillars pass
Dashboard Shows
Individual pillar status with ✓ checkmarks
Quality score includes pillar factors
Settings
SettingDefaultDescriptionMin RVol2.0xMinimum relative volumeStrong RVol5.0xVolume for full qualificationMin Change5%Minimum daily moveMin Price$1Minimum stock priceMax Price$20Maximum stock priceMax Float20MMaximum float size
Module 2: Gap & Go
What It Does
Analyzes pre-market gaps and displays key price levels.
Key Levels Displayed
LevelColorDescriptionPrior CloseOrangeYesterday's close - THE key levelPM HighGreenPre-market high - breakout levelPM LowRedPre-market low - support
Gap Classification
Gap SizeRatingMeaning5-9.9%🔥 QualifyingWorth watching10%+🔥🔥 StrongHigh priority
Entry Signal
Small green triangle = PM High Breakout
How to Trade
Stock gaps up in pre-market
Wait for market open
Look for break above PM High
Enter on breakout with stop below PM Low
Settings
SettingDefaultDescriptionMin Gap %5%Qualifying gap thresholdStrong Gap %10%Strong gap thresholdShow PM LevelsONDisplay PM high/low lines
Module 3: Bull Flag / Flat Top
What It Does
Detects classic continuation patterns and signals breakouts.
Bull Flag Pattern
▲ BREAKOUT (Entry Signal)
│
┌────┴────┐
│ Pullback │ ← 2-5 red candles
│ (flag) │ Max 50% retrace
└─────────┘
│
┌────┴────┐
│ Pole │ ← 3+ green candles
│ (move) │ Strong momentum
└─────────┘
Flat Top Pattern
═══════════════ Resistance (2+ touches)
│
▲ BREAKOUT above resistance
Entry Signals
SignalShapeColorPatternBull Flag Breakout▲ TriangleLimeFlag breaks upFlat Top Breakout◆ DiamondAquaResistance breaks
How to Trade Bull Flag
See 3+ green candles (the pole)
Price pulls back 2-5 red candles
Pullback stays above 50% of move
Enter on break above pullback high
Stop below pullback low
Settings
SettingDefaultDescriptionMin Pole Candles3Green candles neededMax Pullback5Max red candles allowedMax Retrace50%Max pullback depthFT Touches2Resistance touches neededFT Lookback10Bars to check for resistance
Module 4: Float Rotation
What It Does
Tracks how many times the entire float has traded hands today.
The Formula
Rotation = Cumulative Day Volume ÷ Float
Rotation Levels
RotationEmojiMeaning0.5x—Half float traded1.0x🔥FULL rotation - significant!2.0x🔥🔥Double rotation - extreme3.0x+🔥🔥🔥Triple rotation - rare event
Why It Matters
High rotation = Extreme interest
Everyone who owns shares has likely traded
Often precedes explosive moves
Shows "real" demand beyond just volume
Dashboard Shows
Current rotation level
Fire emojis for milestones
Settings
SettingDefaultDescriptionFloat SourceAutoAuto-detect or manualManual Float10MIf auto fails, use thisAlert Level1.0xAlert when rotation hits this
Module 5: R2G / G2R
What It Does
Tracks when price crosses the prior day's close - a key psychological level.
Red to Green (R2G) 🟢
Prior Close ─────────────────
↗ CROSS TO GREEN
↗
(opened red)
Stock opened below prior close (red)
Crosses above prior close (green)
BULLISH signal
Green to Red (G2R) 🔴
(opened green)
↘
↘ CROSS TO RED
Prior Close ─────────────────
Stock opened above prior close (green)
Crosses below prior close (red)
BEARISH signal
Entry Signals
SignalShapeColorMeaningR2G↑ ArrowLimeCrossed to greenG2R↓ ArrowRedCrossed to red
Why R2G Matters
Bears who shorted get squeezed
Creates FOMO buying
Prior close becomes support
Momentum often continues
Dashboard Shows
Current day status (🟢 GREEN / 🔴 RED)
Whether R2G or G2R occurred (R2G ✓ or G2R ✓)
Settings
SettingDefaultDescriptionRequire Opposite OpenONR2G needs red openShow Prior CloseONDisplay the line
Module 6: Micro Pullback
What It Does
Finds precision entries on brief 1-3 candle pullbacks after strong moves.
The Pattern
▲ ENTRY (break pullback high)
│
┌──┴───┐
│ 1-3 │ ← Micro pullback (brief!)
│ red │ Stop = low of this
└──────┘
│
┌──┴───┐
│ 3+ │ ← Strong move
│green │ Momentum building
└──────┘
Why Micro Pullbacks Work
Tight stop = Pullback low is close
Momentum intact = Only paused briefly
Early entry = Catch continuation early
Clear trigger = Break of pullback high
Entry Signal
SignalShapeColorMicro Pullback Entry● CircleYellow
How to Trade
See 3+ green candles (strong move)
1-3 red candles (brief pause)
Pullback stays above 50% retrace
Enter when green candle breaks pullback high
Stop at pullback low
Settings
SettingDefaultDescriptionMin Green Candles3Candles before pullbackMax Pullback3Max red candlesMax Retrace50%Max pullback depth
Signal Reference
All Entry Signals (Below Bar)
ShapeColorSignalModule▲ Large TriangleLimeBull Flag BreakoutPatterns◆ DiamondAquaFlat Top BreakoutPatterns● CircleYellowMicro Pullback EntryMicro PB▲ Small TriangleGreenPM High BreakoutGap & Go↑ ArrowLimeRed to GreenR2G/G2R
Warning Signals (Above Bar)
ShapeColorSignalModule↓ ArrowRedGreen to RedR2G/G2R
Optional Forming Signals (Disabled by Default)
ShapeColorSignal🚩 FlagFaded LimeBull Flag Forming● CircleFaded YellowMicro PB Forming
Enable "Show 'Forming' Markers" in settings to see these
Quality Score
The quality score (0-10) rates the overall setup strength.
Scoring Breakdown
FactorPointsRVol 5x++2RVol 2x++1Daily change 5%++1Low float (<20M)+1Strong gap (10%+)+2Qualifying gap (5%+)+1Rotation 1x++2Rotation 0.5x++1Above EMA 20+1
Score Interpretation
ScoreGradeAction8-10A+Best setups - full position6-7AGood setups - standard size4-5BAverage - reduced size0-3CWeak - skip or paper trade
Settings Guide
Module Toggles
Turn each module ON/OFF:
SettingDefaultDescription① 5 Pillars ScreenerONStock qualification② Gap & Go AnalysisONGap & level analysis③ Bull Flag / Flat TopONPattern detection④ Float RotationONRotation tracking⑤ R2G / G2R TrackerONPrior close crosses⑥ Micro PullbackONPullback entries
Visual Settings
SettingDefaultDescriptionShow DashboardONDisplay info tableTable SizeNormalSmall/Normal/LargeShow Entry SignalsONDisplay entry shapesShow 'Forming' MarkersOFFShow pattern formingShow Key LevelsONPrior close, PM levelsShow EMA 9/20ONTrend EMAsShow VWAPONVWAP line
Recommended Presets
Minimal (Clean Chart)
Show Dashboard: ON
Show Entry Signals: ON
Show 'Forming' Markers: OFF
Show Key Levels: OFF
Show EMA: OFF
Show VWAP: OFF
Standard (Balanced)
All defaults
Full Analysis
All settings ON
Alerts Setup
Available Alerts
AlertTriggerAny Bullish EntryAny entry signal firesBull Flag BreakoutBull flag breaks outFlat Top BreakoutFlat top breaks outMicro Pullback EntryMicro PB triggersPM High BreakoutBreaks above PM highRed to GreenR2G crossGreen to RedG2R crossFloat RotationHits rotation level5 Pillars PassAll pillars qualifyPattern FormingPattern starts formingHigh Quality EntryEntry with score 7+/10
How to Set Alerts
Right-click on chart
Select "Add Alert"
Condition: "Momentum Day Trading Toolkit"
Select alert type from dropdown
Set expiration and notifications
Click "Create"
Recommended Alerts
For Active Trading:
Any Bullish Entry
High Quality Entry
For Watchlist Monitoring:
5 Pillars Pass
Float Rotation
Trading Workflows
Workflow 1: Full Qualification
Step 1: 5 PILLARS
└─→ Wait for "✅ ALL PILLARS" status
Step 2: CHECK SETUP
└─→ Quality score 6+?
└─→ Above EMA and VWAP?
Step 3: WAIT FOR ENTRY
└─→ Bull Flag, Flat Top, or Micro PB signal
Step 4: EXECUTE
└─→ Enter on signal
└─→ Stop below pattern low
└─→ Target 2:1 minimum
Workflow 2: Gap & Go
Step 1: PRE-MARKET
└─→ Stock gaps 5%+ (shows in Gap row)
Step 2: MARKET OPEN
└─→ Note PM High level (green line)
Step 3: WAIT FOR BREAK
└─→ PM High Breakout signal (small triangle)
Step 4: CONFIRM
└─→ R2G if opened red (double confirmation)
└─→ RVol 2x+
Step 5: EXECUTE
└─→ Enter on PM High break
└─→ Stop below PM Low
Workflow 3: Micro Pullback Scalp
Step 1: FIND MOMENTUM
└─→ Stock moving, 3+ green candles
Step 2: WAIT FOR PAUSE
└─→ 1-3 red candles (brief pullback)
Step 3: ENTRY
└─→ Yellow circle signal appears
Step 4: QUICK TRADE
└─→ Enter at signal
└─→ Tight stop at pullback low
└─→ Quick target (1:1 to 2:1)
Troubleshooting
Q: Lines are moving/jumping on real-time chart?
A: This was fixed in latest version. Make sure you have the newest code. Lines now lock in place at market open.
Q: Too many signals, chart is cluttered?
A:
Turn off "Show 'Forming' Markers"
Disable modules you don't need
Use "Minimal" visual preset
Q: No signals appearing?
A:
Check if "Show Entry Signals" is ON
Make sure relevant module is enabled
Stock may not meet pattern criteria
Q: Dashboard shows wrong float?
A:
TradingView float data isn't available for all stocks
Switch Float Source to "Manual"
Enter correct float in millions
Q: PM High/Low not showing?
A:
Only appears during market hours
Needs pre-market data to calculate
Check if "Show Key Levels" is ON
Q: Quality score seems wrong?
A:
Score updates in real-time
Check individual factors in dashboard
RVol and rotation change throughout day
Q: Alert not triggering?
A:
Make sure alert is set on correct symbol
Check alert hasn't expired
Verify condition is set correctly
Quick Reference Card
Entry Signals
▲ Lime Triangle = Bull Flag Breakout
◆ Aqua Diamond = Flat Top Breakout
● Yellow Circle = Micro Pullback
▲ Green Triangle = PM High Break
↑ Lime Arrow = R2G (bullish)
↓ Red Arrow = G2R (bearish)
Dashboard Quick Read
🎯 = Entry signal active
✅ = All pillars pass
🟢 = Day is green
🔥 = Strong (gap/rotation)
✓ = Criteria met
✗ = Criteria failed
Quality Score
8-10 = A+ (Best)
6-7 = A (Good)
4-5 = B (Average)
0-3 = C (Weak)
Key Levels
Orange Line = Prior Close (R2G level)
Green Line = PM High (breakout level)
Red Line = PM Low (support)
Purple Line = VWAP
Yellow/Orange = EMA 9/20
Happy Trading! 🎯📈
For questions or issues, use TradingView's comment section on the indicator page.
Dynamic Support and Resistance with Trend LinesDynamic Support and Resistance with Trend Lines (DSRTL)
1. Introduction & Methodology
The DSRTL indicator is designed to provide a multidimensional analysis of market structure. Unlike traditional tools that rely solely on price pivots, this script combines Static Volume-based Zones with Dynamic Trend Lines to evaluate the price's position relative to critical market components.
The S/R Identification Technique
Instead of standard pivot points, DSRTL utilizes Volume Analysis to highlight areas of significant trader participation:
- Strategy A:
Matrix Climax: Identifies candles within the lookback period that are near price extremes (Highs/Lows) and coincide with significant buying or selling volume.
- Strategy B:
Volume Extremes: Detects candles with the absolute highest buy/sell volumes within the selected lookback window, creating extreme volume-based S/R zones.
- Result:
This creates Support/Resistance (S/R) zones that are validated by actual market activity, not just price geometry.
Dynamic Trend Lines
To complement the static zones, the indicator employs two adaptive channel methods:
- Pivot Span: Connects recent significant pivots for a fast, reactive trend corridor.
- 5-Point Channel: Segments the lookback period into 5 parts to perform a linear regression analysis, creating a stable and statistically significant channel.
2. Volume Calculation Methodology
Accurate S/R detection requires distinguishing Buy Volume from Sell Volume. DSRTL offers two calculation modes:
- Geometry (Source File): Estimates buy/sell volume based on the Close price's position relative to the High/Low of the candle.
Note: This is an approximation that works on all plan types as it does not require intrabar data.
- Intrabar (Precise): Analyzes historical lower-timeframe data (e.g., 15S) to calculate intrabar-based volume deltas with higher precision compared to the geometric method.
Note: This offers superior accuracy. It requires access to historical intrabar data (depending on your plan limits). For the best analytical results, use this mode if available.
3. The Smart Matrix Engine (3D Analysis)
The core of DSRTL is its dashboard, powered by the "Smart Matrix Engine." This engine evaluates the current price in a multi-layer market structure context (Static Volume Zones + Dynamic Channels + Volume Metrics).:
A. S-State (Static): Where is the price relative to the Volume S/R zones?
B. D-State (Dynamic): Where is the price relative to the Trend Channels?
How to read the Matrix Map:
The dashboard displays a 5x5 grid representing 25 possible market scenarios.
- Rows (S1-S5): Represent the Static State (S1=Breakout, S3=Mid-Range, S5=Breakdown).
- Columns (D1-D5): Represent the Dynamic State (D1=Overextended Up, D3=Neutral, D5=Overextended Down).
- Active Cell: Marked with a dot, indicating the specific intersection of price action and market structure.
4. Matrix Interpretations (The 25 Scenarios)
Below is the detailed logic for every possible state displayed on the dashboard, explaining the Title, Bias, and actionable Signal.
Section I: S1 - Static Breakout (Price > Static Resistance)
The price has cleared the static volume resistance zone.
- S1 / D1: HYPER EXTENSION
Bias: Extreme Bullish
Signal: Caution: Exhaustion Risk. Trail stops tight.
- S1 / D2: RESISTANCE CLASH
Bias: Bullish
Signal: Breakout confirmed but facing immediate dynamic resistance.
- S1 / D3: CHANNEL BREAKOUT
Bias: Strong Bullish
Signal: Ideal Trend Continuation. Look to buy dips.
- S1 / D4: SMART PULLBACK
Bias: Bullish (Pullback)
Signal: A pullback occurring after a breakout. Strong buy opportunity.
- S1 / D5: CONFLICT (DIV)
Bias: Conflict/Reversal
Signal: Major Divergence. Static breakout is failing against dynamic structure. High Risk.
Section II: S2 - Inside Static Resistance
The price is currently testing the overhead resistance zone.
- S2 / D1: WEAK SPIKE
Bias: Neutral/Bullish
Signal: Testing resistance, but short-term overextended.
- S2 / D2: IRON FORTRESS (R)
Bias: Rejection Risk
Signal: Double Resistance (Static + Dynamic). High probability of rejection.
- S2 / D3: TESTING RES
Bias: Neutral
Signal: Consolidating at resistance. Wait for a clear break or rejection.
- S2 / D4: COMPRESSION (UP)
Bias: Conflict (Squeeze)
Signal: Squeezed between Static Resistance and Dynamic Support. Volatility imminent.
- S2 / D5: RES vs DOWN-TREND
Bias: Bearish
Signal: Strong downtrend meeting static resistance. Potential Short entry.
Section III: S3 - Mid-Range
The price is floating between significant Static Support and Resistance.
- S3 / D1: OVERBOUGHT RANGE
Bias: Rejection Risk (OB)
Signal: Overextended within the range. Potential fade (short).
- S3 / D2: RANGE HIGH LIMIT
Bias: Neutral/Bearish
Signal: At the top of the dynamic channel. Look for rejection signs.
- S3 / D3: NEUTRAL / CHOPPY
Bias: Neutral
Signal: Dead Center. Low probability environment. Avoid trading.
- S3 / D4: RANGE DIP BUY
Bias: Neutral/Bullish
Signal: At the bottom of the dynamic channel. Look for bounce signs.
- S3 / D5: WEAK RANGE (OS)
Bias: Bounce Risk (OS)
Signal: Oversold within the range. Potential fade (long).
Section IV: S4 - Inside Static Support
The price is currently testing the floor support zone.
- S4 / D1: SUP vs UP-TREND
Bias: Bullish
Signal: Strong uptrend meeting static support. Potential Long entry.
- S4 / D2: COMPRESSION (DN)
Bias: Conflict (Squeeze)
Signal: Squeezed between Static Support and Dynamic Resistance. Volatility imminent.
- S4 / D3: TESTING SUPPORT
Bias: Neutral
Signal: Consolidating at support. Wait for a bounce or breakdown.
- S4 / D4: IRON FLOOR (S)
Bias: Bounce Risk
Signal: Double Support (Static + Dynamic). High probability of a bounce.
- S4 / D5: WEAK DIP
Bias: Neutral/Bearish
Signal: Testing support, but short-term oversold.
Section V: S5 - Static Breakdown (Price < Static Support)
The price has dropped below the static volume support zone.
- S5 / D1: CONFLICT (DIV)
Bias: Conflict/Reversal
Signal: Major Divergence. Static breakdown is failing. High Risk.
- S5 / D2: BEAR PULLBACK
Bias: Bearish (Pullback)
Signal: A pullback occurring after a breakdown. Strong selling opportunity.
- S5 / D3: CHANNEL BREAKDOWN
Bias: Strong Bearish
Signal: Ideal Trend Continuation (Down). Sell rallies.
- S5 / D4: SUPPORT CLASH
Bias: Bearish
Signal: Breakdown confirmed but facing immediate dynamic support.
- S5 / D5: HYPER DROP (VOID)
Bias: Extreme Bearish
Signal: Caution: Climax risk. Trail stops for shorts.
DISCLAIMER & EDUCATIONAL PURPOSE
This indicator is strictly an educational tool designed to visualize complex market structure concepts. Its primary purpose is to help traders "bridge the gap" between academic theory and real-time market behavior by providing a visual representation of support, resistance, and volume dynamics.
Please Note:
1. Not a Trading Strategy: This script is an analytical assistant, not a standalone "Black Box" trading system. It does not generate buy or sell signals that should be followed blindly.
2. No Financial Advice: The data provided by this tool is for informational purposes only. It is not a recommendation to buy or sell any asset.
3. Risk Warning: Trading involves significant risk. Always use your own judgment, perform your own technical analysis, and use proper risk management. Do not use this tool as the sole basis for your trading decisions.
4. Data Precision & Platform Limits: The "Intrabar (Precise)" calculation mode relies on high-resolution historical data to provide exact results. Access to this specific data depth depends entirely on your platform's subscription capabilities. If your plan does not support this level of historical intrabar data, the Precise mode may have limited coverage. In that case, you should switch to "Geometry" mode for a fully populated view.
Session ATP (Trend Colored)📌 Average Traded Price (ATP) – What It Means
ATP (Average Traded Price) is the weighted average price at which a stock has traded during the session, considering both price and volume.
It tells you where the majority of money has actually traded — not just the candle close.
If price stays above ATP → Buyers are in control
If price stays below ATP → Sellers dominate
ATP is like the intraday fair value of the stock.
📌 How ATP Helps in Trading
ATP gives three major insights:
1️⃣ Strength of Trend (Real Strength)
ATP rises only if strong volume enters at higher prices.
So, a rising ATP confirms genuine bullish strength, not fake moves.
ATP falling confirms real selling pressure, not random dips.
2️⃣ High-Probability Retests
Price often pulls back to ATP before taking the next direction.
Price above ATP → ATP becomes support
Price below ATP → ATP becomes resistance
This makes ATP extremely useful for intraday entries.
3️⃣ Identifying Where Big Players Are Positioned
Since ATP is volume-weighted, it reflects where institutions and big orders traded most.
If price stays above the level where institutions bought → trend is strong
If price stays below their cost → trend is weak
📌 How ATP Indicates Price Direction
In your improved version, ATP is trend-colored:
✔ Green → ATP rising → buyers dominating
✔ Red → ATP falling → sellers dominating
✔ Gray → sideways
Direction rule:
Bullish bias when price > ATP and ATP rising
Bearish bias when price < ATP and ATP falling
No-trade zone when price and ATP are flat / tangled
ATP often acts as:
Magnet in consolidation
Springboard in uptrend
Ceiling in downtrend
This helps you judge whether the move is:
A breakout with strength, or
A fake move without volume support.
🔥 Final Line
ATP is one of the few indicators that shows where the real money is trading, making it an excellent guide for intraday trend confirmation, support/resistance, and entry timing.
Dynamic Equity Allocation Model//@version=6
indicator('Dynamic Equity Allocation Model', shorttitle = 'DEAM', overlay = false, precision = 1, scale = scale.right, max_bars_back = 500)
// DYNAMIC EQUITY ALLOCATION MODEL
// Quantitative framework for dynamic portfolio allocation between stocks and cash.
// Analyzes five dimensions: market regime, risk metrics, valuation, sentiment,
// and macro conditions to generate allocation recommendations (0-100% equity).
//
// Uses real-time data from TradingView including fundamentals (P/E, ROE, ERP),
// volatility indicators (VIX), credit spreads, yield curves, and market structure.
// INPUT PARAMETERS
group1 = 'Model Configuration'
model_type = input.string('Adaptive', 'Allocation Model Type', options = , group = group1, tooltip = 'Conservative: Slower to increase equity, Aggressive: Faster allocation changes, Adaptive: Dynamic based on regime')
use_crisis_detection = input.bool(true, 'Enable Crisis Detection System', group = group1, tooltip = 'Automatic detection and response to crisis conditions')
use_regime_model = input.bool(true, 'Use Market Regime Detection', group = group1, tooltip = 'Identify Bull/Bear/Crisis regimes for dynamic allocation')
group2 = 'Portfolio Risk Management'
target_portfolio_volatility = input.float(12.0, 'Target Portfolio Volatility (%)', minval = 3, maxval = 20, step = 0.5, group = group2, tooltip = 'Target portfolio volatility (Cash reduces volatility: 50% Equity = ~10% vol, 100% Equity = ~20% vol)')
max_portfolio_drawdown = input.float(15.0, 'Maximum Portfolio Drawdown (%)', minval = 5, maxval = 35, step = 2.5, group = group2, tooltip = 'Maximum acceptable PORTFOLIO drawdown (not market drawdown - portfolio with cash has lower drawdown)')
enable_portfolio_risk_scaling = input.bool(true, 'Enable Portfolio Risk Scaling', group = group2, tooltip = 'Scale allocation based on actual portfolio risk characteristics (recommended)')
risk_lookback = input.int(252, 'Risk Calculation Period (Days)', minval = 60, maxval = 504, group = group2, tooltip = 'Period for calculating volatility and risk metrics')
group3 = 'Component Weights (Total = 100%)'
w_regime = input.float(35.0, 'Market Regime Weight (%)', minval = 0, maxval = 100, step = 5, group = group3)
w_risk = input.float(25.0, 'Risk Metrics Weight (%)', minval = 0, maxval = 100, step = 5, group = group3)
w_valuation = input.float(20.0, 'Valuation Weight (%)', minval = 0, maxval = 100, step = 5, group = group3)
w_sentiment = input.float(15.0, 'Sentiment Weight (%)', minval = 0, maxval = 100, step = 5, group = group3)
w_macro = input.float(5.0, 'Macro Weight (%)', minval = 0, maxval = 100, step = 5, group = group3)
group4 = 'Crisis Detection Thresholds'
crisis_vix_threshold = input.float(40, 'Crisis VIX Level', minval = 30, maxval = 80, group = group4, tooltip = 'VIX level indicating crisis conditions (COVID peaked at 82)')
crisis_drawdown_threshold = input.float(15, 'Crisis Drawdown Threshold (%)', minval = 10, maxval = 30, group = group4, tooltip = 'Market drawdown indicating crisis conditions')
crisis_credit_spread = input.float(500, 'Crisis Credit Spread (bps)', minval = 300, maxval = 1000, group = group4, tooltip = 'High yield spread indicating crisis conditions')
group5 = 'Display Settings'
show_components = input.bool(false, 'Show Component Breakdown', group = group5, tooltip = 'Display individual component analysis lines')
show_regime_background = input.bool(true, 'Show Dynamic Background', group = group5, tooltip = 'Color background based on allocation signals')
show_reference_lines = input.bool(false, 'Show Reference Lines', group = group5, tooltip = 'Display allocation percentage reference lines')
show_dashboard = input.bool(true, 'Show Analytics Dashboard', group = group5, tooltip = 'Display comprehensive analytics table')
show_confidence_bands = input.bool(false, 'Show Confidence Bands', group = group5, tooltip = 'Display uncertainty quantification bands')
smoothing_period = input.int(3, 'Smoothing Period', minval = 1, maxval = 10, group = group5, tooltip = 'Smoothing to reduce allocation noise')
background_intensity = input.int(95, 'Background Intensity (%)', minval = 90, maxval = 99, group = group5, tooltip = 'Higher values = more transparent background')
// Styling Options
color_scheme = input.string('EdgeTools', 'Color Theme', options = , group = 'Appearance', tooltip = 'Professional color themes')
use_dark_mode = input.bool(true, 'Optimize for Dark Theme', group = 'Appearance')
main_line_width = input.int(3, 'Main Line Width', minval = 1, maxval = 5, group = 'Appearance')
// DATA RETRIEVAL
// Market Data
sp500 = request.security('SPY', timeframe.period, close)
sp500_high = request.security('SPY', timeframe.period, high)
sp500_low = request.security('SPY', timeframe.period, low)
sp500_volume = request.security('SPY', timeframe.period, volume)
// Volatility Indicators
vix = request.security('VIX', timeframe.period, close)
vix9d = request.security('VIX9D', timeframe.period, close)
vxn = request.security('VXN', timeframe.period, close)
// Fixed Income and Credit
us2y = request.security('US02Y', timeframe.period, close)
us10y = request.security('US10Y', timeframe.period, close)
us3m = request.security('US03MY', timeframe.period, close)
hyg = request.security('HYG', timeframe.period, close)
lqd = request.security('LQD', timeframe.period, close)
tlt = request.security('TLT', timeframe.period, close)
// Safe Haven Assets
gold = request.security('GLD', timeframe.period, close)
usd = request.security('DXY', timeframe.period, close)
yen = request.security('JPYUSD', timeframe.period, close)
// Financial data with fallback values
get_financial_data(symbol, fin_id, period, fallback) =>
data = request.financial(symbol, fin_id, period, ignore_invalid_symbol = true)
na(data) ? fallback : data
// SPY fundamental metrics
spy_earnings_per_share = get_financial_data('AMEX:SPY', 'EARNINGS_PER_SHARE_BASIC', 'TTM', 20.0)
spy_operating_earnings_yield = get_financial_data('AMEX:SPY', 'OPERATING_EARNINGS_YIELD', 'FY', 4.5)
spy_dividend_yield = get_financial_data('AMEX:SPY', 'DIVIDENDS_YIELD', 'FY', 1.8)
spy_buyback_yield = get_financial_data('AMEX:SPY', 'BUYBACK_YIELD', 'FY', 2.0)
spy_net_margin = get_financial_data('AMEX:SPY', 'NET_MARGIN', 'TTM', 12.0)
spy_debt_to_equity = get_financial_data('AMEX:SPY', 'DEBT_TO_EQUITY', 'FY', 0.5)
spy_return_on_equity = get_financial_data('AMEX:SPY', 'RETURN_ON_EQUITY', 'FY', 15.0)
spy_free_cash_flow = get_financial_data('AMEX:SPY', 'FREE_CASH_FLOW', 'TTM', 100000000)
spy_ebitda = get_financial_data('AMEX:SPY', 'EBITDA', 'TTM', 200000000)
spy_pe_forward = get_financial_data('AMEX:SPY', 'PRICE_EARNINGS_FORWARD', 'FY', 18.0)
spy_total_debt = get_financial_data('AMEX:SPY', 'TOTAL_DEBT', 'FY', 500000000)
spy_total_equity = get_financial_data('AMEX:SPY', 'TOTAL_EQUITY', 'FY', 1000000000)
spy_enterprise_value = get_financial_data('AMEX:SPY', 'ENTERPRISE_VALUE', 'FY', 30000000000)
spy_revenue_growth = get_financial_data('AMEX:SPY', 'REVENUE_ONE_YEAR_GROWTH', 'TTM', 5.0)
// Market Breadth Indicators
nya = request.security('NYA', timeframe.period, close)
rut = request.security('IWM', timeframe.period, close)
// Sector Performance
xlk = request.security('XLK', timeframe.period, close)
xlu = request.security('XLU', timeframe.period, close)
xlf = request.security('XLF', timeframe.period, close)
// MARKET REGIME DETECTION
// Calculate Market Trend
sma_20 = ta.sma(sp500, 20)
sma_50 = ta.sma(sp500, 50)
sma_200 = ta.sma(sp500, 200)
ema_10 = ta.ema(sp500, 10)
// Market Structure Score
trend_strength = 0.0
trend_strength := trend_strength + (sp500 > sma_20 ? 1 : -1)
trend_strength := trend_strength + (sp500 > sma_50 ? 1 : -1)
trend_strength := trend_strength + (sp500 > sma_200 ? 2 : -2)
trend_strength := trend_strength + (sma_50 > sma_200 ? 2 : -2)
// Volatility Regime
returns = math.log(sp500 / sp500 )
realized_vol_20d = ta.stdev(returns, 20) * math.sqrt(252) * 100
realized_vol_60d = ta.stdev(returns, 60) * math.sqrt(252) * 100
ewma_vol = ta.ema(math.pow(returns, 2), 20)
realized_vol = math.sqrt(ewma_vol * 252) * 100
vol_premium = vix - realized_vol
// Drawdown Calculation
running_max = ta.highest(sp500, risk_lookback)
current_drawdown = (running_max - sp500) / running_max * 100
// Regime Score
regime_score = 0.0
// Trend Component (40%)
if trend_strength >= 4
regime_score := regime_score + 40
regime_score
else if trend_strength >= 2
regime_score := regime_score + 30
regime_score
else if trend_strength >= 0
regime_score := regime_score + 20
regime_score
else if trend_strength >= -2
regime_score := regime_score + 10
regime_score
else
regime_score := regime_score + 0
regime_score
// Volatility Component (30%)
if vix < 15
regime_score := regime_score + 30
regime_score
else if vix < 20
regime_score := regime_score + 25
regime_score
else if vix < 25
regime_score := regime_score + 15
regime_score
else if vix < 35
regime_score := regime_score + 5
regime_score
else
regime_score := regime_score + 0
regime_score
// Drawdown Component (30%)
if current_drawdown < 3
regime_score := regime_score + 30
regime_score
else if current_drawdown < 7
regime_score := regime_score + 20
regime_score
else if current_drawdown < 12
regime_score := regime_score + 10
regime_score
else if current_drawdown < 20
regime_score := regime_score + 5
regime_score
else
regime_score := regime_score + 0
regime_score
// Classify Regime
market_regime = regime_score >= 80 ? 'Strong Bull' : regime_score >= 60 ? 'Bull Market' : regime_score >= 40 ? 'Neutral' : regime_score >= 20 ? 'Correction' : regime_score >= 10 ? 'Bear Market' : 'Crisis'
// RISK-BASED ALLOCATION
// Calculate Market Risk
parkinson_hl = math.log(sp500_high / sp500_low)
parkinson_vol = parkinson_hl / (2 * math.sqrt(math.log(2))) * math.sqrt(252) * 100
garman_klass_vol = math.sqrt((0.5 * math.pow(math.log(sp500_high / sp500_low), 2) - (2 * math.log(2) - 1) * math.pow(math.log(sp500 / sp500 ), 2)) * 252) * 100
market_volatility_20d = math.max(ta.stdev(returns, 20) * math.sqrt(252) * 100, parkinson_vol)
market_volatility_60d = ta.stdev(returns, 60) * math.sqrt(252) * 100
market_drawdown = current_drawdown
// Initialize risk allocation
risk_allocation = 50.0
if enable_portfolio_risk_scaling
// Volatility-based allocation
vol_based_allocation = target_portfolio_volatility / math.max(market_volatility_20d, 5.0) * 100
vol_based_allocation := math.max(0, math.min(100, vol_based_allocation))
// Drawdown-based allocation
dd_based_allocation = 100.0
if market_drawdown > 1.0
dd_based_allocation := max_portfolio_drawdown / market_drawdown * 100
dd_based_allocation := math.max(0, math.min(100, dd_based_allocation))
dd_based_allocation
// Combine (conservative)
risk_allocation := math.min(vol_based_allocation, dd_based_allocation)
// Dynamic adjustment
current_equity_estimate = 50.0
estimated_portfolio_vol = current_equity_estimate / 100 * market_volatility_20d
estimated_portfolio_dd = current_equity_estimate / 100 * market_drawdown
vol_utilization = estimated_portfolio_vol / target_portfolio_volatility
dd_utilization = estimated_portfolio_dd / max_portfolio_drawdown
risk_utilization = math.max(vol_utilization, dd_utilization)
risk_adjustment_factor = 1.0
if risk_utilization > 1.0
risk_adjustment_factor := math.exp(-0.5 * (risk_utilization - 1.0))
risk_adjustment_factor := math.max(0.5, risk_adjustment_factor)
risk_adjustment_factor
else if risk_utilization < 0.9
risk_adjustment_factor := 1.0 + 0.2 * math.log(1.0 / risk_utilization)
risk_adjustment_factor := math.min(1.3, risk_adjustment_factor)
risk_adjustment_factor
risk_allocation := risk_allocation * risk_adjustment_factor
risk_allocation
else
vol_scalar = target_portfolio_volatility / math.max(market_volatility_20d, 10)
vol_scalar := math.min(1.5, math.max(0.2, vol_scalar))
drawdown_penalty = 0.0
if current_drawdown > max_portfolio_drawdown
drawdown_penalty := (current_drawdown - max_portfolio_drawdown) / max_portfolio_drawdown
drawdown_penalty := math.min(1.0, drawdown_penalty)
drawdown_penalty
risk_allocation := 100 * vol_scalar * (1 - drawdown_penalty)
risk_allocation
risk_allocation := math.max(0, math.min(100, risk_allocation))
// VALUATION ANALYSIS
// Valuation Metrics
actual_pe_ratio = spy_earnings_per_share > 0 ? sp500 / spy_earnings_per_share : spy_pe_forward
actual_earnings_yield = nz(spy_operating_earnings_yield, 0) > 0 ? spy_operating_earnings_yield : 100 / actual_pe_ratio
total_shareholder_yield = spy_dividend_yield + spy_buyback_yield
// Equity Risk Premium (multi-method calculation)
method1_erp = actual_earnings_yield - us10y
method2_erp = actual_earnings_yield + spy_buyback_yield - us10y
payout_ratio = spy_dividend_yield > 0 and actual_earnings_yield > 0 ? spy_dividend_yield / actual_earnings_yield : 0.4
sustainable_growth = spy_return_on_equity * (1 - payout_ratio) / 100
method3_erp = spy_dividend_yield + sustainable_growth * 100 - us10y
implied_growth = spy_revenue_growth * 0.7
method4_erp = total_shareholder_yield + implied_growth - us10y
equity_risk_premium = method1_erp * 0.35 + method2_erp * 0.30 + method3_erp * 0.20 + method4_erp * 0.15
ev_ebitda_ratio = spy_enterprise_value > 0 and spy_ebitda > 0 ? spy_enterprise_value / spy_ebitda : 15.0
debt_equity_health = spy_debt_to_equity < 1.0 ? 1.2 : spy_debt_to_equity < 2.0 ? 1.0 : 0.8
// Valuation Score
base_valuation_score = 50.0
if equity_risk_premium > 4
base_valuation_score := 95
base_valuation_score
else if equity_risk_premium > 3
base_valuation_score := 85
base_valuation_score
else if equity_risk_premium > 2
base_valuation_score := 70
base_valuation_score
else if equity_risk_premium > 1
base_valuation_score := 55
base_valuation_score
else if equity_risk_premium > 0
base_valuation_score := 40
base_valuation_score
else if equity_risk_premium > -1
base_valuation_score := 25
base_valuation_score
else
base_valuation_score := 10
base_valuation_score
growth_adjustment = spy_revenue_growth > 10 ? 10 : spy_revenue_growth > 5 ? 5 : 0
margin_adjustment = spy_net_margin > 15 ? 5 : spy_net_margin < 8 ? -5 : 0
roe_adjustment = spy_return_on_equity > 20 ? 5 : spy_return_on_equity < 10 ? -5 : 0
valuation_score = base_valuation_score + growth_adjustment + margin_adjustment + roe_adjustment
valuation_score := math.max(0, math.min(100, valuation_score * debt_equity_health))
// SENTIMENT ANALYSIS
// VIX Term Structure
vix_term_structure = vix9d > 0 ? vix / vix9d : 1
backwardation = vix_term_structure > 1.05
steep_backwardation = vix_term_structure > 1.15
// Safe Haven Flows
gold_momentum = ta.roc(gold, 20)
dollar_momentum = ta.roc(usd, 20)
yen_momentum = ta.roc(yen, 20)
treasury_momentum = ta.roc(tlt, 20)
safe_haven_flow = gold_momentum * 0.3 + treasury_momentum * 0.3 + dollar_momentum * 0.25 + yen_momentum * 0.15
// Advanced Sentiment Analysis
vix_percentile = ta.percentrank(vix, 252)
vix_zscore = (vix - ta.sma(vix, 252)) / ta.stdev(vix, 252)
vix_momentum = ta.roc(vix, 5)
vvix_proxy = ta.stdev(vix_momentum, 20) * math.sqrt(252)
risk_reversal_proxy = (vix - realized_vol) / realized_vol
// Sentiment Score
base_sentiment = 50.0
vix_adjustment = 0.0
if vix_zscore < -1.5
vix_adjustment := 40
vix_adjustment
else if vix_zscore < -0.5
vix_adjustment := 20
vix_adjustment
else if vix_zscore < 0.5
vix_adjustment := 0
vix_adjustment
else if vix_zscore < 1.5
vix_adjustment := -20
vix_adjustment
else
vix_adjustment := -40
vix_adjustment
term_structure_adjustment = backwardation ? -15 : steep_backwardation ? -30 : 5
vvix_adjustment = vvix_proxy > 2.0 ? -10 : vvix_proxy < 1.0 ? 10 : 0
sentiment_score = base_sentiment + vix_adjustment + term_structure_adjustment + vvix_adjustment
sentiment_score := math.max(0, math.min(100, sentiment_score))
// MACRO ANALYSIS
// Yield Curve
yield_spread_2_10 = us10y - us2y
yield_spread_3m_10 = us10y - us3m
// Credit Conditions
hyg_return = ta.roc(hyg, 20)
lqd_return = ta.roc(lqd, 20)
tlt_return = ta.roc(tlt, 20)
hyg_duration = 4.0
lqd_duration = 8.0
tlt_duration = 17.0
hyg_log_returns = math.log(hyg / hyg )
lqd_log_returns = math.log(lqd / lqd )
hyg_volatility = ta.stdev(hyg_log_returns, 20) * math.sqrt(252)
lqd_volatility = ta.stdev(lqd_log_returns, 20) * math.sqrt(252)
hyg_yield_proxy = -math.log(hyg / hyg ) * 100
lqd_yield_proxy = -math.log(lqd / lqd ) * 100
tlt_yield = us10y
hyg_spread = (hyg_yield_proxy - tlt_yield) * 100
lqd_spread = (lqd_yield_proxy - tlt_yield) * 100
hyg_distance = (hyg - ta.lowest(hyg, 252)) / (ta.highest(hyg, 252) - ta.lowest(hyg, 252))
lqd_distance = (lqd - ta.lowest(lqd, 252)) / (ta.highest(lqd, 252) - ta.lowest(lqd, 252))
default_risk_proxy = 2.0 - (hyg_distance + lqd_distance)
credit_spread = hyg_spread * 0.5 + (hyg_volatility - lqd_volatility) * 1000 * 0.3 + default_risk_proxy * 200 * 0.2
credit_spread := math.max(50, credit_spread)
credit_market_health = hyg_return > lqd_return ? 1 : -1
flight_to_quality = tlt_return > (hyg_return + lqd_return) / 2
// Macro Score
macro_score = 50.0
yield_curve_score = 0
if yield_spread_2_10 > 1.5 and yield_spread_3m_10 > 2
yield_curve_score := 40
yield_curve_score
else if yield_spread_2_10 > 0.5 and yield_spread_3m_10 > 1
yield_curve_score := 30
yield_curve_score
else if yield_spread_2_10 > 0 and yield_spread_3m_10 > 0
yield_curve_score := 20
yield_curve_score
else if yield_spread_2_10 < 0 or yield_spread_3m_10 < 0
yield_curve_score := 10
yield_curve_score
else
yield_curve_score := 5
yield_curve_score
credit_conditions_score = 0
if credit_spread < 200 and not flight_to_quality
credit_conditions_score := 30
credit_conditions_score
else if credit_spread < 400 and credit_market_health > 0
credit_conditions_score := 20
credit_conditions_score
else if credit_spread < 600
credit_conditions_score := 15
credit_conditions_score
else if credit_spread < 1000
credit_conditions_score := 10
credit_conditions_score
else
credit_conditions_score := 0
credit_conditions_score
financial_stability_score = 0
if spy_debt_to_equity < 0.5 and spy_return_on_equity > 15
financial_stability_score := 20
financial_stability_score
else if spy_debt_to_equity < 1.0 and spy_return_on_equity > 10
financial_stability_score := 15
financial_stability_score
else if spy_debt_to_equity < 1.5
financial_stability_score := 10
financial_stability_score
else
financial_stability_score := 5
financial_stability_score
macro_score := yield_curve_score + credit_conditions_score + financial_stability_score
macro_score := math.max(0, math.min(100, macro_score))
// CRISIS DETECTION
crisis_indicators = 0
if vix > crisis_vix_threshold
crisis_indicators := crisis_indicators + 1
crisis_indicators
if vix > 60
crisis_indicators := crisis_indicators + 2
crisis_indicators
if current_drawdown > crisis_drawdown_threshold
crisis_indicators := crisis_indicators + 1
crisis_indicators
if current_drawdown > 25
crisis_indicators := crisis_indicators + 1
crisis_indicators
if credit_spread > crisis_credit_spread
crisis_indicators := crisis_indicators + 1
crisis_indicators
sp500_roc_5 = ta.roc(sp500, 5)
tlt_roc_5 = ta.roc(tlt, 5)
if sp500_roc_5 < -10 and tlt_roc_5 < -5
crisis_indicators := crisis_indicators + 2
crisis_indicators
volume_spike = sp500_volume > ta.sma(sp500_volume, 20) * 2
sp500_roc_1 = ta.roc(sp500, 1)
if volume_spike and sp500_roc_1 < -3
crisis_indicators := crisis_indicators + 1
crisis_indicators
is_crisis = crisis_indicators >= 3
is_severe_crisis = crisis_indicators >= 5
// FINAL ALLOCATION CALCULATION
// Convert regime to base allocation
regime_allocation = market_regime == 'Strong Bull' ? 100 : market_regime == 'Bull Market' ? 80 : market_regime == 'Neutral' ? 60 : market_regime == 'Correction' ? 40 : market_regime == 'Bear Market' ? 20 : 0
// Normalize weights
total_weight = w_regime + w_risk + w_valuation + w_sentiment + w_macro
w_regime_norm = w_regime / total_weight
w_risk_norm = w_risk / total_weight
w_valuation_norm = w_valuation / total_weight
w_sentiment_norm = w_sentiment / total_weight
w_macro_norm = w_macro / total_weight
// Calculate Weighted Allocation
weighted_allocation = regime_allocation * w_regime_norm + risk_allocation * w_risk_norm + valuation_score * w_valuation_norm + sentiment_score * w_sentiment_norm + macro_score * w_macro_norm
// Apply Crisis Override
if use_crisis_detection
if is_severe_crisis
weighted_allocation := math.min(weighted_allocation, 10)
weighted_allocation
else if is_crisis
weighted_allocation := math.min(weighted_allocation, 25)
weighted_allocation
// Model Type Adjustment
model_adjustment = 0.0
if model_type == 'Conservative'
model_adjustment := -10
model_adjustment
else if model_type == 'Aggressive'
model_adjustment := 10
model_adjustment
else if model_type == 'Adaptive'
recent_return = (sp500 - sp500 ) / sp500 * 100
if recent_return > 5
model_adjustment := 5
model_adjustment
else if recent_return < -5
model_adjustment := -5
model_adjustment
// Apply adjustment and bounds
final_allocation = weighted_allocation + model_adjustment
final_allocation := math.max(0, math.min(100, final_allocation))
// Smooth allocation
smoothed_allocation = ta.sma(final_allocation, smoothing_period)
// Calculate portfolio risk metrics (only for internal alerts)
actual_portfolio_volatility = smoothed_allocation / 100 * market_volatility_20d
actual_portfolio_drawdown = smoothed_allocation / 100 * current_drawdown
// VISUALIZATION
// Color definitions
var color primary_color = #2196F3
var color bullish_color = #4CAF50
var color bearish_color = #FF5252
var color neutral_color = #808080
var color text_color = color.white
var color bg_color = #000000
var color table_bg_color = #1E1E1E
var color header_bg_color = #2D2D2D
switch color_scheme // Apply color scheme
'Gold' =>
primary_color := use_dark_mode ? #FFD700 : #DAA520
bullish_color := use_dark_mode ? #FFA500 : #FF8C00
bearish_color := use_dark_mode ? #FF5252 : #D32F2F
neutral_color := use_dark_mode ? #C0C0C0 : #808080
text_color := use_dark_mode ? color.white : color.black
bg_color := use_dark_mode ? #000000 : #FFFFFF
table_bg_color := use_dark_mode ? #1A1A00 : #FFFEF0
header_bg_color := use_dark_mode ? #2D2600 : #F5F5DC
header_bg_color
'EdgeTools' =>
primary_color := use_dark_mode ? #4682B4 : #1E90FF
bullish_color := use_dark_mode ? #4CAF50 : #388E3C
bearish_color := use_dark_mode ? #FF5252 : #D32F2F
neutral_color := use_dark_mode ? #708090 : #696969
text_color := use_dark_mode ? color.white : color.black
bg_color := use_dark_mode ? #000000 : #FFFFFF
table_bg_color := use_dark_mode ? #0F1419 : #F0F8FF
header_bg_color := use_dark_mode ? #1E2A3A : #E6F3FF
header_bg_color
'Behavioral' =>
primary_color := #808080
bullish_color := #00FF00
bearish_color := #8B0000
neutral_color := #FFBF00
text_color := use_dark_mode ? color.white : color.black
bg_color := use_dark_mode ? #000000 : #FFFFFF
table_bg_color := use_dark_mode ? #1A1A1A : #F8F8F8
header_bg_color := use_dark_mode ? #2D2D2D : #E8E8E8
header_bg_color
'Quant' =>
primary_color := #808080
bullish_color := #FFA500
bearish_color := #8B0000
neutral_color := #4682B4
text_color := use_dark_mode ? color.white : color.black
bg_color := use_dark_mode ? #000000 : #FFFFFF
table_bg_color := use_dark_mode ? #0D0D0D : #FAFAFA
header_bg_color := use_dark_mode ? #1A1A1A : #F0F0F0
header_bg_color
'Ocean' =>
primary_color := use_dark_mode ? #20B2AA : #008B8B
bullish_color := use_dark_mode ? #00CED1 : #4682B4
bearish_color := use_dark_mode ? #FF4500 : #B22222
neutral_color := use_dark_mode ? #87CEEB : #2F4F4F
text_color := use_dark_mode ? #F0F8FF : #191970
bg_color := use_dark_mode ? #001F3F : #F0F8FF
table_bg_color := use_dark_mode ? #001A2E : #E6F7FF
header_bg_color := use_dark_mode ? #002A47 : #CCF2FF
header_bg_color
'Fire' =>
primary_color := use_dark_mode ? #FF6347 : #DC143C
bullish_color := use_dark_mode ? #FFD700 : #FF8C00
bearish_color := use_dark_mode ? #8B0000 : #800000
neutral_color := use_dark_mode ? #FFA500 : #CD853F
text_color := use_dark_mode ? #FFFAF0 : #2F1B14
bg_color := use_dark_mode ? #2F1B14 : #FFFAF0
table_bg_color := use_dark_mode ? #261611 : #FFF8F0
header_bg_color := use_dark_mode ? #3D241A : #FFE4CC
header_bg_color
'Matrix' =>
primary_color := use_dark_mode ? #00FF41 : #006400
bullish_color := use_dark_mode ? #39FF14 : #228B22
bearish_color := use_dark_mode ? #FF073A : #8B0000
neutral_color := use_dark_mode ? #00FFFF : #008B8B
text_color := use_dark_mode ? #C0FF8C : #003300
bg_color := use_dark_mode ? #0D1B0D : #F0FFF0
table_bg_color := use_dark_mode ? #0A1A0A : #E8FFF0
header_bg_color := use_dark_mode ? #112B11 : #CCFFCC
header_bg_color
'Arctic' =>
primary_color := use_dark_mode ? #87CEFA : #4169E1
bullish_color := use_dark_mode ? #00BFFF : #0000CD
bearish_color := use_dark_mode ? #FF1493 : #8B008B
neutral_color := use_dark_mode ? #B0E0E6 : #483D8B
text_color := use_dark_mode ? #F8F8FF : #191970
bg_color := use_dark_mode ? #191970 : #F8F8FF
table_bg_color := use_dark_mode ? #141B47 : #F0F8FF
header_bg_color := use_dark_mode ? #1E2A5C : #E0F0FF
header_bg_color
// Transparency settings
bg_transparency = use_dark_mode ? 85 : 92
zone_transparency = use_dark_mode ? 90 : 95
band_transparency = use_dark_mode ? 70 : 85
table_transparency = use_dark_mode ? 80 : 15
// Allocation color
alloc_color = smoothed_allocation >= 80 ? bullish_color : smoothed_allocation >= 60 ? color.new(bullish_color, 30) : smoothed_allocation >= 40 ? primary_color : smoothed_allocation >= 20 ? color.new(bearish_color, 30) : bearish_color
// Dynamic background
var color dynamic_bg_color = na
if show_regime_background
if smoothed_allocation >= 70
dynamic_bg_color := color.new(bullish_color, background_intensity)
dynamic_bg_color
else if smoothed_allocation <= 30
dynamic_bg_color := color.new(bearish_color, background_intensity)
dynamic_bg_color
else if smoothed_allocation > 60 or smoothed_allocation < 40
dynamic_bg_color := color.new(primary_color, math.min(99, background_intensity + 2))
dynamic_bg_color
bgcolor(dynamic_bg_color, title = 'Allocation Signal Background')
// Plot main allocation line
plot(smoothed_allocation, 'Equity Allocation %', color = alloc_color, linewidth = math.max(1, main_line_width))
// Reference lines (static colors for hline)
hline_bullish_color = color_scheme == 'Gold' ? use_dark_mode ? #FFA500 : #FF8C00 : color_scheme == 'EdgeTools' ? use_dark_mode ? #4CAF50 : #388E3C : color_scheme == 'Behavioral' ? #00FF00 : color_scheme == 'Quant' ? #FFA500 : color_scheme == 'Ocean' ? use_dark_mode ? #00CED1 : #4682B4 : color_scheme == 'Fire' ? use_dark_mode ? #FFD700 : #FF8C00 : color_scheme == 'Matrix' ? use_dark_mode ? #39FF14 : #228B22 : color_scheme == 'Arctic' ? use_dark_mode ? #00BFFF : #0000CD : #4CAF50
hline_bearish_color = color_scheme == 'Gold' ? use_dark_mode ? #FF5252 : #D32F2F : color_scheme == 'EdgeTools' ? use_dark_mode ? #FF5252 : #D32F2F : color_scheme == 'Behavioral' ? #8B0000 : color_scheme == 'Quant' ? #8B0000 : color_scheme == 'Ocean' ? use_dark_mode ? #FF4500 : #B22222 : color_scheme == 'Fire' ? use_dark_mode ? #8B0000 : #800000 : color_scheme == 'Matrix' ? use_dark_mode ? #FF073A : #8B0000 : color_scheme == 'Arctic' ? use_dark_mode ? #FF1493 : #8B008B : #FF5252
hline_primary_color = color_scheme == 'Gold' ? use_dark_mode ? #FFD700 : #DAA520 : color_scheme == 'EdgeTools' ? use_dark_mode ? #4682B4 : #1E90FF : color_scheme == 'Behavioral' ? #808080 : color_scheme == 'Quant' ? #808080 : color_scheme == 'Ocean' ? use_dark_mode ? #20B2AA : #008B8B : color_scheme == 'Fire' ? use_dark_mode ? #FF6347 : #DC143C : color_scheme == 'Matrix' ? use_dark_mode ? #00FF41 : #006400 : color_scheme == 'Arctic' ? use_dark_mode ? #87CEFA : #4169E1 : #2196F3
hline(show_reference_lines ? 100 : na, '100% Equity', color = color.new(hline_bullish_color, 70), linestyle = hline.style_dotted, linewidth = 1)
hline(show_reference_lines ? 80 : na, '80% Equity', color = color.new(hline_bullish_color, 40), linestyle = hline.style_dashed, linewidth = 1)
hline(show_reference_lines ? 60 : na, '60% Equity', color = color.new(hline_bullish_color, 60), linestyle = hline.style_dotted, linewidth = 1)
hline(50, '50% Balanced', color = color.new(hline_primary_color, 50), linestyle = hline.style_solid, linewidth = 2)
hline(show_reference_lines ? 40 : na, '40% Equity', color = color.new(hline_bearish_color, 60), linestyle = hline.style_dotted, linewidth = 1)
hline(show_reference_lines ? 20 : na, '20% Equity', color = color.new(hline_bearish_color, 40), linestyle = hline.style_dashed, linewidth = 1)
hline(show_reference_lines ? 0 : na, '0% Equity', color = color.new(hline_bearish_color, 70), linestyle = hline.style_dotted, linewidth = 1)
// Component plots
plot(show_components ? regime_allocation : na, 'Regime', color = color.new(#4ECDC4, 70), linewidth = 1)
plot(show_components ? risk_allocation : na, 'Risk', color = color.new(#FF6B6B, 70), linewidth = 1)
plot(show_components ? valuation_score : na, 'Valuation', color = color.new(#45B7D1, 70), linewidth = 1)
plot(show_components ? sentiment_score : na, 'Sentiment', color = color.new(#FFD93D, 70), linewidth = 1)
plot(show_components ? macro_score : na, 'Macro', color = color.new(#6BCF7F, 70), linewidth = 1)
// Confidence bands
upper_band = plot(show_confidence_bands ? math.min(100, smoothed_allocation + ta.stdev(smoothed_allocation, 20)) : na, color = color.new(neutral_color, band_transparency), display = display.none, title = 'Upper Band')
lower_band = plot(show_confidence_bands ? math.max(0, smoothed_allocation - ta.stdev(smoothed_allocation, 20)) : na, color = color.new(neutral_color, band_transparency), display = display.none, title = 'Lower Band')
fill(upper_band, lower_band, color = show_confidence_bands ? color.new(neutral_color, zone_transparency) : na, title = 'Uncertainty')
// DASHBOARD
if show_dashboard and barstate.islast
var table dashboard = table.new(position.top_right, 2, 20, border_width = 1, bgcolor = color.new(table_bg_color, table_transparency))
table.clear(dashboard, 0, 0, 1, 19)
// Header
header_color = color.new(header_bg_color, 20)
dashboard_text_color = text_color
table.cell(dashboard, 0, 0, 'DEAM', text_color = dashboard_text_color, bgcolor = header_color, text_size = size.normal)
table.cell(dashboard, 1, 0, model_type, text_color = dashboard_text_color, bgcolor = header_color, text_size = size.normal)
// Core metrics
table.cell(dashboard, 0, 1, 'Equity Allocation', text_color = dashboard_text_color, text_size = size.small)
table.cell(dashboard, 1, 1, str.tostring(smoothed_allocation, '##.#') + '%', text_color = alloc_color, text_size = size.small)
table.cell(dashboard, 0, 2, 'Cash Allocation', text_color = dashboard_text_color, text_size = size.small)
cash_color = 100 - smoothed_allocation > 70 ? bearish_color : primary_color
table.cell(dashboard, 1, 2, str.tostring(100 - smoothed_allocation, '##.#') + '%', text_color = cash_color, text_size = size.small)
// Signal
signal_text = 'NEUTRAL'
signal_color = primary_color
if smoothed_allocation >= 70
signal_text := 'BULLISH'
signal_color := bullish_color
signal_color
else if smoothed_allocation <= 30
signal_text := 'BEARISH'
signal_color := bearish_color
signal_color
table.cell(dashboard, 0, 3, 'Signal', text_color = dashboard_text_color, text_size = size.small)
table.cell(dashboard, 1, 3, signal_text, text_color = signal_color, text_size = size.small)
// Market Regime
table.cell(dashboard, 0, 4, 'Regime', text_color = dashboard_text_color, text_size = size.small)
regime_color_display = market_regime == 'Strong Bull' or market_regime == 'Bull Market' ? bullish_color : market_regime == 'Neutral' ? primary_color : market_regime == 'Crisis' ? bearish_color : bearish_color
table.cell(dashboard, 1, 4, market_regime, text_color = regime_color_display, text_size = size.small)
// VIX
table.cell(dashboard, 0, 5, 'VIX Level', text_color = dashboard_text_color, text_size = size.small)
vix_color_display = vix < 20 ? bullish_color : vix < 30 ? primary_color : bearish_color
table.cell(dashboard, 1, 5, str.tostring(vix, '##.##'), text_color = vix_color_display, text_size = size.small)
// Market Drawdown
table.cell(dashboard, 0, 6, 'Market DD', text_color = dashboard_text_color, text_size = size.small)
market_dd_color = current_drawdown < 5 ? bullish_color : current_drawdown < 10 ? primary_color : bearish_color
table.cell(dashboard, 1, 6, '-' + str.tostring(current_drawdown, '##.#') + '%', text_color = market_dd_color, text_size = size.small)
// Crisis Detection
table.cell(dashboard, 0, 7, 'Crisis Detection', text_color = dashboard_text_color, text_size = size.small)
crisis_text = is_severe_crisis ? 'SEVERE' : is_crisis ? 'CRISIS' : 'Normal'
crisis_display_color = is_severe_crisis or is_crisis ? bearish_color : bullish_color
table.cell(dashboard, 1, 7, crisis_text, text_color = crisis_display_color, text_size = size.small)
// Real Data Section
financial_bg = color.new(primary_color, 85)
table.cell(dashboard, 0, 8, 'REAL DATA', text_color = dashboard_text_color, bgcolor = financial_bg, text_size = size.small)
table.cell(dashboard, 1, 8, 'Live Metrics', text_color = dashboard_text_color, bgcolor = financial_bg, text_size = size.small)
// P/E Ratio
table.cell(dashboard, 0, 9, 'P/E Ratio', text_color = dashboard_text_color, text_size = size.small)
pe_color = actual_pe_ratio < 18 ? bullish_color : actual_pe_ratio < 25 ? primary_color : bearish_color
table.cell(dashboard, 1, 9, str.tostring(actual_pe_ratio, '##.#'), text_color = pe_color, text_size = size.small)
// ERP
table.cell(dashboard, 0, 10, 'ERP', text_color = dashboard_text_color, text_size = size.small)
erp_color = equity_risk_premium > 2 ? bullish_color : equity_risk_premium > 0 ? primary_color : bearish_color
table.cell(dashboard, 1, 10, str.tostring(equity_risk_premium, '##.##') + '%', text_color = erp_color, text_size = size.small)
// ROE
table.cell(dashboard, 0, 11, 'ROE', text_color = dashboard_text_color, text_size = size.small)
roe_color = spy_return_on_equity > 20 ? bullish_color : spy_return_on_equity > 10 ? primary_color : bearish_color
table.cell(dashboard, 1, 11, str.tostring(spy_return_on_equity, '##.#') + '%', text_color = roe_color, text_size = size.small)
// D/E Ratio
table.cell(dashboard, 0, 12, 'D/E Ratio', text_color = dashboard_text_color, text_size = size.small)
de_color = spy_debt_to_equity < 0.5 ? bullish_color : spy_debt_to_equity < 1.0 ? primary_color : bearish_color
table.cell(dashboard, 1, 12, str.tostring(spy_debt_to_equity, '##.##'), text_color = de_color, text_size = size.small)
// Shareholder Yield
table.cell(dashboard, 0, 13, 'Dividend+Buyback', text_color = dashboard_text_color, text_size = size.small)
yield_color = total_shareholder_yield > 4 ? bullish_color : total_shareholder_yield > 2 ? primary_color : bearish_color
table.cell(dashboard, 1, 13, str.tostring(total_shareholder_yield, '##.#') + '%', text_color = yield_color, text_size = size.small)
// Component Scores
component_bg = color.new(neutral_color, 80)
table.cell(dashboard, 0, 14, 'Components', text_color = dashboard_text_color, bgcolor = component_bg, text_size = size.small)
table.cell(dashboard, 1, 14, 'Scores', text_color = dashboard_text_color, bgcolor = component_bg, text_size = size.small)
table.cell(dashboard, 0, 15, 'Regime', text_color = dashboard_text_color, text_size = size.small)
regime_score_color = regime_allocation > 60 ? bullish_color : regime_allocation < 40 ? bearish_color : primary_color
table.cell(dashboard, 1, 15, str.tostring(regime_allocation, '##'), text_color = regime_score_color, text_size = size.small)
table.cell(dashboard, 0, 16, 'Risk', text_color = dashboard_text_color, text_size = size.small)
risk_score_color = risk_allocation > 60 ? bullish_color : risk_allocation < 40 ? bearish_color : primary_color
table.cell(dashboard, 1, 16, str.tostring(risk_allocation, '##'), text_color = risk_score_color, text_size = size.small)
table.cell(dashboard, 0, 17, 'Valuation', text_color = dashboard_text_color, text_size = size.small)
val_score_color = valuation_score > 60 ? bullish_color : valuation_score < 40 ? bearish_color : primary_color
table.cell(dashboard, 1, 17, str.tostring(valuation_score, '##'), text_color = val_score_color, text_size = size.small)
table.cell(dashboard, 0, 18, 'Sentiment', text_color = dashboard_text_color, text_size = size.small)
sent_score_color = sentiment_score > 60 ? bullish_color : sentiment_score < 40 ? bearish_color : primary_color
table.cell(dashboard, 1, 18, str.tostring(sentiment_score, '##'), text_color = sent_score_color, text_size = size.small)
table.cell(dashboard, 0, 19, 'Macro', text_color = dashboard_text_color, text_size = size.small)
macro_score_color = macro_score > 60 ? bullish_color : macro_score < 40 ? bearish_color : primary_color
table.cell(dashboard, 1, 19, str.tostring(macro_score, '##'), text_color = macro_score_color, text_size = size.small)
// ALERTS
// Major allocation changes
alertcondition(smoothed_allocation >= 80 and smoothed_allocation < 80, 'High Equity Allocation', 'Equity allocation reached 80% - Bull market conditions')
alertcondition(smoothed_allocation <= 20 and smoothed_allocation > 20, 'Low Equity Allocation', 'Equity allocation dropped to 20% - Defensive positioning')
// Crisis alerts
alertcondition(is_crisis and not is_crisis , 'CRISIS DETECTED', 'Crisis conditions detected - Reducing equity allocation')
alertcondition(is_severe_crisis and not is_severe_crisis , 'SEVERE CRISIS', 'Severe crisis detected - Maximum defensive positioning')
// Regime changes
regime_changed = market_regime != market_regime
alertcondition(regime_changed, 'Regime Change', 'Market regime has changed')
// Risk management alerts
risk_breach = enable_portfolio_risk_scaling and (actual_portfolio_volatility > target_portfolio_volatility * 1.2 or actual_portfolio_drawdown > max_portfolio_drawdown * 1.2)
alertcondition(risk_breach, 'Risk Breach', 'Portfolio risk exceeds target parameters')
// USAGE
// The indicator displays a recommended equity allocation percentage (0-100%).
// Example: 75% allocation = 75% stocks, 25% cash/bonds.
//
// The model combines market regime analysis (trend, volatility, drawdowns),
// risk management (portfolio-level targeting), valuation metrics (P/E, ERP),
// sentiment indicators (VIX term structure), and macro factors (yield curve,
// credit spreads) into a single allocation signal.
//
// Crisis detection automatically reduces exposure when multiple warning signals
// converge. Alerts available for major allocation shifts and regime changes.
//
// Designed for SPY/S&P 500 portfolio allocation. Adjust component weights and
// risk parameters in settings to match your risk tolerance.
View in Pine
Moving VWAP-KAMA CloudMoving VWAP-KAMA Cloud
Overview
The Moving VWAP-KAMA Cloud is a high-conviction trend filter designed to solve a major problem with standard indicators: Noise. By combining a smoothed Volume Weighted Average Price (MVWAP) with Kaufman’s Adaptive Moving Average (KAMA), this indicator creates a "Value Zone" that identifies the true structural trend while ignoring choppy price action.
Unlike brittle lines that break constantly, this cloud is "slow" by design—making it exceptionally powerful for spotting genuine trend reversals and filtering out fakeouts.
How It Works
This script uses a unique "Double Smoothing" architecture:
The Anchor (MVWAP): We take the standard VWAP and smooth it with a 30-period EMA. This represents the "Fair Value" baseline where volume has supported price over time.
The Filter (KAMA): We apply Kaufman's Adaptive Moving Average to the already smoothed MVWAP. KAMA is unique because it flattens out during low-volatility (choppy) periods and speeds up during high-momentum trends.
The Cloud:
Green/Teal Cloud: Bullish Structure (MVWAP > KAMA)
Purple Cloud: Bearish Structure (MVWAP < KAMA)
🔥 The "Reversal Slingshot" Strategy
Backtests reveal a powerful behavior during major trend changes, particularly after long bear markets:
The Resistance Phase: During a long-term downtrend, price will repeatedly rally into the Purple Cloud and get rejected. The flattened KAMA line acts as a "concrete ceiling," keeping the bearish trend intact.
The Breakout & Flip: When price finally breaks above the cloud with conviction, and the cloud flips Green, it signals a structural regime change.
The "Slingshot" Retest: Often, immediately after this flip, price will drop back into the top of the cloud. This is the "Slingshot" moment. The old resistance becomes new, hardened support.
The Rally: From this support bounce, stocks often launch into a sustained, multi-month bull run. This setup has been observed repeatedly at the bottom of major corrections.
How to Use This Indicator
1. Dynamic Support & Resistance
The KAMA Wall: When price retraces into the cloud, the KAMA line often flattens out, acting as a hard "floor" or "wall." A break of this wall usually signals a genuine trend change, not just a stop hunt.
2. Trend Confirmation (Regime Filter)
Bullish Regime: If price is holding above the cloud, only look for Long setups.
Bearish Regime: If price is holding below the cloud, only look for Short setups.
No-Trade Zone: If price is stuck inside the cloud, the market is traversing fair value. Stand aside until a clear winner emerges.
3. Multi-Timeframe Versatility
While designed for trend confirmation on higher timeframes (4H, Daily), this indicator adapts beautifully to lower timeframes (5m, 15m) for intraday scalping.
On Lower Timeframes: The cloud reacts much faster, acting as a dynamic "VWAP Band" that helps intraday traders stay on the right side of momentum during the session.
Settings
Moving VWAP Period (30): The lookback period for the base VWAP smoothing.
KAMA Settings (10, 10, 30): Controls the sensitivity of the adaptive filter.
Cloud Transparency: Adjust to keep your chart clean.
Alerts Included
Price Cross Over/Under MVWAP
Price Cross Over/Under KAMA
Cloud Flip (Bullish/Bearish Trend Change)
Tip for Traders
This is not a signal entry indicator. It is a Trend Conviction tool. Use it to filter your entries from faster indicators (like RSI or MACD). If your fast indicator signals "Buy" but the cloud is Purple, the probability is low. Wait for the Cloud Flip
Debt-Cycle vs Bitcoin-CycleDebt-Cycle vs Bitcoin-Cycle Indicator
The Debt-Cycle vs Bitcoin-Cycle indicator is a macro-economic analysis tool that compares traditional financial market cycles (debt/credit cycles) against Bitcoin market cycles. It uses Z-score normalization to track the relative positioning of global financial conditions versus cryptocurrency market sentiment, helping identify potential turning points and divergences between traditional finance and digital assets.
Key Features
Dual-Cycle Analysis: Simultaneously tracks traditional financial cycles and Bitcoin-specific cycles
Z-Score Normalization: Standardizes diverse data sources for meaningful comparison
Multi-Asset Coverage: Analyzes currencies, commodities, bonds, monetary aggregates, and on-chain metrics
Divergence Detection: Identifies when Bitcoin cycles move independently from traditional finance
21-Day Timeframe: Optimized for Long-term cycle analysis
What It Measures
Finance-Cycle (White Line)
Tracks traditional financial market health through:
Currencies: USD strength (DXY), global currency weights (USDWCU, EURWCU)
Commodities: Oil, gold, natural gas, agricultural products, and Bitcoin price
Corporate Bonds: Investment-grade spreads, high-yield spreads, credit conditions
Monetary Aggregates: M2 money supply, foreign exchange reserves (weighted by currency)
Treasury Bonds: Yield curve (2Y/10Y, 3M/10Y), term premiums, long-term rates
Bitcoin-Cycle (Orange Line)
Tracks Bitcoin market positioning through:
On-Chain Metrics:
MVRV Ratio (Market Value to Realized Value)
NUPL (Net Unrealized Profit/Loss)
Profit/Loss Address Distribution
Technical Indicators:
Bitcoin price Z-score
Moving average deviation
Relative Strength:
ETH/BTC ratio (altcoin strength indicator)
Visual Elements
White Line: Finance-Cycle indicator (positive = expansionary conditions, negative = contractionary)
Orange Line: Bitcoin-Cycle indicator (positive = bullish positioning, negative = bearish)
Zero Line: Neutral reference point
Interpretation
Cycle Alignment
Both positive: Risk-on environment, favorable for crypto
Both negative: Risk-off environment, caution warranted
Divergence: Potential opportunities or warning signals
Divergence Signals
Finance positive, Bitcoin negative: Bitcoin may be undervalued relative to macro conditions
Finance negative, Bitcoin positive: Bitcoin may be overextended or decoupling from traditional finance
Important Limitations
This indicator uses some technical and macro data but still has significant gaps:
⚠️ Limited monetary data - missing:
Funding rates (repo, overnight markets)
Comprehensive bond spread analysis
Collateral velocity and quality metrics
Central bank balance sheet details
⚠️ Basic economic coverage - missing:
GDP growth rates
Inflation expectations
Employment data
Manufacturing indices
Consumer confidence
⚠️ Simplified on-chain analysis - missing:
Exchange flow data
Whale wallet movements
Mining difficulty adjustments
Hash rate trends
Network fee dynamics
⚠️ No sentiment data - missing:
Fear & Greed Index
Options positioning
Futures open interest
Social media sentiment
The indicator provides a high-level cycle comparison but should be combined with comprehensive fundamental analysis, detailed on-chain research, and proper risk management.
Settings
Offset: Adjust the horizontal positioning of the indicators (default: 0)
Timeframe: Fixed at 21 days for optimal cycle detection
Use Cases
Macro-crypto correlation analysis: Understand when Bitcoin moves with or against traditional markets
Cycle timing: Identify potential tops and bottoms in both cycles
Risk assessment: Gauge overall market conditions across asset classes
Divergence trading: Spot opportunities when cycles diverge significantly
Portfolio allocation: Balance traditional and crypto assets based on cycle positioning
Technical Notes
Uses Z-score normalization with varying lookback periods (40-60 bars)
Applies HMA (Hull Moving Average) smoothing to reduce noise
Asymmetric multipliers for upside/downside movements in certain metrics
Requires access to FRED economic data, Glassnode, CoinMetrics, and IntoTheBlock feeds
21-day timeframe optimized for cycle analysis
Strategy Applications
This indicator is particularly useful for:
Cross-asset allocation - Decide between traditional finance and crypto exposure
Cycle positioning - Identify where we are in credit/debt cycles vs. Bitcoin cycles
Regime changes - Detect shifts in market leadership and correlation patterns
Risk management - Reduce exposure when both cycles turn negative
Disclaimer: This indicator is a cycle analysis tool and should not be used as the sole basis for investment decisions. It has limited coverage of monetary conditions, economic fundamentals, and on-chain metrics. The indicator provides directional insight but cannot predict exact timing or magnitude of market moves. Always conduct thorough research, consider multiple data sources, and maintain proper risk management in all investment decisions.
Multi-Timeframe Supertrend + MACD + MTF Dashboard if you like it click source code and save it in notepad for back up .
The Multi-Timeframe Supertrend Dashboard is a powerful tool designed to give traders a clear view of market trends across multiple timeframes, all from a single dashboard. This indicator leverages the Supertrend method to calculate buy and sell signals based on the direction of price relative to dynamically calculated support and resistance lines. The dashboard is optimized for dark mode and provides easy-to-interpret color-coded signals for each timeframe.
How It Works
The Supertrend indicator is a trend-following indicator that uses the Average True Range (ATR) to set upper and lower bands around the price, adapting dynamically as volatility changes. When the price is above the Supertrend line, the market is considered in an uptrend, triggering a "BUY" signal. Conversely, when the price falls below the Supertrend line, the market is in a downtrend, triggering a "SELL" signal.
This Multi-Timeframe Supertrend Dashboard calculates Supertrend signals for the following timeframes:
1 minute
5 minutes
15 minutes
1 hour
Daily
Weekly
Monthly
For each timeframe, the dashboard shows either a "BUY" or "SELL" signal, allowing traders to assess whether trends align across timeframes. A "BUY" signal displays in green, and a "SELL" signal displays in red, giving a quick visual reference of the overall trend direction for each timeframe.
Customization Options
ATR Period: Defines the period for the Average True Range (ATR) calculation, which determines how responsive the Supertrend lines are to changes in market volatility.
Multiplier: Sets the sensitivity of the Supertrend bands to price movements. Higher values make the bands less sensitive, while lower values increase sensitivity, allowing quicker reactions to changes in price.
How to Interpret the Dashboard
The Multi-Timeframe Supertrend Dashboard allows traders to see at a glance if trends across multiple timeframes are aligned. Here’s how to interpret the signals:
BUY (Green): The current timeframe’s price is in an uptrend based on the Supertrend calculation.
SELL (Red): The current timeframe’s price is in a downtrend based on the Supertrend calculation.
For example:
If all timeframes display "BUY," the asset is in a strong uptrend across multiple time horizons, which may indicate a bullish market.
If all timeframes display "SELL," the asset is likely in a strong downtrend, signaling a bearish market.
Mixed signals across timeframes suggest market consolidation or differing trends across short- and long-term periods.
Use Cases
Trend Confirmation: Use the dashboard to confirm trends across multiple timeframes before entering or exiting a position.
Quick Market Analysis: Get a snapshot of market conditions across timeframes without having to change charts.
Multi-Timeframe Alignment: Identify alignment across timeframes, which is often a strong indicator of market momentum in one direction.
Dark Mode Optimization
The dashboard has been optimized for dark mode, with white text and contrasting background colors to ensure easy readability on darker TradingView themes.
Nov 4, 2024
Release Notes
Multi-Timeframe Supertrend Dashboard with Alerts
Overview
The Multi-Timeframe Supertrend Dashboard with Alerts is a powerful indicator designed to give traders a comprehensive view of market trends across multiple timeframes. This dashboard uses the Supertrend method to calculate buy and sell signals based on the direction of price relative to dynamic support and resistance levels. The indicator is optimized for dark mode and provides a color-coded display of buy and sell signals for each timeframe, along with optional alerts for trend alignment.
How It Works
The Supertrend indicator is a trend-following indicator that uses the Average True Range (ATR) to set upper and lower bands around the price, adjusting dynamically with market volatility. When the price is above the Supertrend line, the market is considered in an uptrend, triggering a "BUY" signal. Conversely, when the price falls below the Supertrend line, the market is in a downtrend, triggering a "SELL" signal.
The Multi-Timeframe Supertrend Dashboard displays Supertrend signals for the following timeframes:
1 minute
5 minutes
15 minutes
1 hour
Daily
Weekly
Monthly
For each timeframe, the dashboard shows either a "BUY" or "SELL" signal, allowing traders to assess trend alignment across multiple timeframes with a single glance. A "BUY" signal displays in green, and a "SELL" signal displays in red.
Alerts for Trend Alignment
This indicator includes built-in alert conditions that allow traders to receive notifications when all timeframes simultaneously align in a "BUY" or "SELL" signal. This is particularly useful for identifying moments of strong trend alignment across short-term and long-term timeframes. The alerts can be set to notify the trader when:
All timeframes display a "BUY" signal, indicating a strong bullish alignment across all time horizons.
All timeframes display a "SELL" signal, signaling a strong bearish alignment.
Customization Options
ATR Period: Defines the period for the Average True Range (ATR) calculation, which determines how responsive the Supertrend lines are to changes in market volatility.
Multiplier: Sets the sensitivity of the Supertrend bands to price movements. Higher values make the bands less sensitive, while lower values increase sensitivity, allowing quicker reactions to changes in price.
How to Interpret the Dashboard
BUY (Green): The price is above the Supertrend line, indicating an uptrend for that timeframe.
SELL (Red): The price is below the Supertrend line, indicating a downtrend for that timeframe.
Examples:
If all timeframes display "BUY," the asset is in a strong uptrend across multiple time horizons, signaling potential buying opportunities.
If all timeframes display "SELL," the asset is likely in a strong downtrend, signaling potential selling opportunities.
Mixed signals suggest a consolidation phase or differing trends across short- and long-term periods.
Use Cases
Trend Confirmation: Use the dashboard to confirm trends across multiple timeframes before entering or exiting a position.
Alert Notifications: Set alerts to receive notifications when all timeframes align in a "BUY" or "SELL" signal.
Quick Market Analysis: Get an instant overview of market conditions without switching between charts.
Multi-Timeframe Alignment: Identify alignment across timeframes, often a strong indicator of market momentum in one direction.
Dark Mode Optimization
The dashboard has been optimized for dark mode, with white text and contrasting background colors to ensure easy readability on darker TradingView themes.
Nov 6, 2024
Release Notes
Multi-Timeframe Supertrend Dashboard with Custom Alerts
Description:
This Multi-Timeframe Supertrend Dashboard indicator provides a powerful tool for traders who want to monitor multiple timeframes simultaneously and receive alerts when all timeframes align on a single trend (either BUY or SELL). The indicator uses the popular Supertrend calculation, with customizable ATR (Average True Range) period and multiplier values to tailor sensitivity to your trading style.
Key Features:
Customizable Timeframes:
Track and display up to six timeframes, fully configurable to meet any trading strategy. The default timeframes include 1 Minute, 5 Minutes, 15 Minutes, 1 Hour, 1 Day, and 1 Week but can be changed to any intervals supported by TradingView.
Selective Display Options:
With a user-friendly display selection, you can choose which timeframes to show on the dashboard. For example, you may choose to view only Timeframe 1 through Timeframe 5 or any combination of the six.
Real-Time Alignment Alerts:
Alerts can be set to trigger when all selected timeframes align on a BUY or SELL signal. This feature enables traders to catch strong trends across timeframes without constant monitoring. Alerts are fully configurable, allowing for sound notifications, email alerts, or even webhook notifications to automated trading systems.
Custom Supertrend Settings:
Adjust the ATR Period and Multiplier values to control the Supertrend's sensitivity. Lower values result in more frequent trend changes, while higher values smooth out the trend and focus on larger market moves.
Intuitive Color-Coded Dashboard:
The dashboard is visually optimized for quick insights:
Green cells indicate a BUY trend.
Red cells indicate a SELL trend.
Background color changes when all selected timeframes align, giving an instant visual cue for strong trends.
How to Use:
Select Timeframes:
Go to the input settings to choose the timeframes you want to monitor. Each timeframe is labeled (e.g., Timeframe 1, Timeframe 2) for easy reference.
Configure Display Preferences:
Enable or disable specific timeframes to customize your dashboard view. This is useful for focusing only on timeframes relevant to your strategy.
Set ATR and Multiplier Values:
Adjust these settings to define the Supertrend calculation's responsiveness. This customization allows adaptation to various markets, including stocks, forex, and cryptocurrencies.
Enable Alerts:
Turn on alerts to receive notifications when all active timeframes align. Customize the alert type and delivery (sound, popup, email, etc.) to ensure you’re notified on time.
Ideal For:
Trend Traders who want confirmation of trends across multiple timeframes.
Scalpers and Day Traders looking for quick trend changes with smaller timeframes.
Swing Traders who want a broader overview of market alignment across hourly and daily frames.
Automated System Developers looking for reliable signals across multiple timeframes to integrate with other strategies.
EMA CloudSimple EMA cloud using a fast, a slow and an optinal middle EMA.
It has EMA, EMA cloud and candle coloring depending on whether it's a downtrend or an uptrend.
It has a dashboard also with 4 customizable time frames that tells you if they are bullish or bearish and tells you the strength of the trend for the timeframe you are viewing.
Smart Money COTThis indicator implements the method of analysing COT data as defined by Michael Huddleston (I.E. The Inner Circle Trader). It removes all superfluous information contained in the standard COT reports and focusses only on Commercial speculators using the overall Long-Short positions.
Features
The unique feature of this indicator is its ability to look back over time and provide the following information:
Calculation of the range high and low of the specified lookback range.
Calculation of equilibrium of that range.
Automatic colour coding of net long and net short positions when the Long-Short COT calculation is above or below equilibrium of the lookback range.
Instructions
Use the Daily Timeframe only. You may get unexpected results on other timeframes.
Ensure the asset has COT data available. Script is mainly focused on commodity futures, such as ES, NQ, YM. It has not been tested against Forex.
You will need to define the "Lookback" setting in the script settings. Use the total number of trading days required for your analysis. E.g. if you want a 6 month COT analysis, use the measurement tool to count the quantity of daily candles between now and 6 months ago - use this as your Lookback setting. Adjust as needed for other lookback periods, e.g. 3 months, 12 months etc.
Other Info
The script provides the ability to customise colours in its settings.
Range High and Range Low plots can be disabled in settings.
jhehli LiquidityWhat are BSL and SSL?
In the context of Smart Money Concepts, liquidity simply refers to pending orders—specifically Stop Losses and Buy/Sell Stop orders—resting above old highs and below old lows.
BSL (Buy-Side Liquidity): This is found above Swing Highs. Retail traders who are short the market will place their "Buy Stop" protective orders here. Additionally, breakout traders place "Buy Limit" orders here. Smart Money views this area as a pool of willing buyers. To fill large sell orders, institutions must drive price up into this liquidity to pair their massive sell interest with these buy stops.
SSL (Sell-Side Liquidity): This is found below Swing Lows. Retail traders who are long the market place their "Sell Stop" protective orders here. Smart Money targets these levels to accumulate long positions. They need the market to sell off into these levels so they can buy from the willing sellers at a discount.
How this Indicator Works
This tool automates the process of market structure analysis by identifying key Swing Highs and Swing Lows.
Detection: It scans price action to find fractal highs and lows (classic swing points) where price has rejected a level.
Visualization: It projects a line from these points, clearly marking where the "stops" are likely residing.
Liquidity Raids: When price pierces these levels, it is considered a "Liquidity Raid" or "Stop Hunt."
How to Use This in Your Trading
Do not treat these lines simply as Support and Resistance. In the ICT methodology, old highs and lows are targets, not barriers.
For Reversals: Wait for a "Turtle Soup" or "Judas Swing." This occurs when price aggressively expands into a BSL or SSL level to trigger stops, only to quickly reverse back into the trading range. This indicates that Smart Money has finished their accumulation or distribution.
For Bias: If the higher timeframe trend is Bullish, expect SSL to be raided to fuel the move, while BSL becomes the target (Draw on Liquidity).
By using this indicator, you remove the guesswork of manually marking every swing point, allowing you to focus on price action and the reaction at these critical liquidity pools.
Delta Zones Smart Money Concept (SMC) UT Trend Reversal Mul.Sig.🚀 What's New in This Version (V5 Update)
This version is a major overhaul focused on improving trade entry timing and risk management through enhanced UT Bot functionality:
Integrated UT Trailing Stop (ATR-based): The primary trend filter and moving stop-loss mechanism is now fully integrated.
Pre-Warning Line: A revolutionary feature that alerts traders when the price penetrates a specific percentage distance (customizable) from the UT Trailing Stop before the main reversal signal fires.
"Ready" Signal: Plots a "Ready" warning label on the chart and triggers an alert condition (UT Ready Long/Short) for pre-emptive trade preparation.
V5 Compatibility: All code has been optimized for Pine Script version 5, utilizing the modern array and type structures for efficient Order Block and Breaker Block detection.
💡 How to Use This Indicator
This indicator works best when confirming signals across different components:
1. Identify the Trend Bias (UT Trailing Stop)
Uptrend: UT Trailing Stop line is Green (Focus only on Buy/Long opportunities).
Downtrend: UT Trailing Stop line is Red (Focus only on Sell/Short opportunities).
2. Prepare for Entry (Warning Line)
Action: When you see the "Ready" label or the price hits the Pre-Warning Line (Dotted Orange Line), this is your alert to prepare for a trend flip, or to tighten the stop on your current trade.
3. Confirm the Entry (Multi-Signals)
Look for a primary entry signal that aligns with the desired trend:
High-Conviction Entry: Wait for the UT Buy/Sell label (confirmed trend flip) AND a Combined Buy/Sell arrow (confirmed by your selected Oscillator settings).
High-Liquidity Entry: Look for a Delta Zone Box forming near an active Order Block or Breaker Block (SMC zones), and then confirm with a UT or Combined Signal.
4. Manage Risk (Trailing Stop)
Always set your initial Stop Loss (SL) either just outside the opposite Order Block or at the UT Trailing Stop level itself.
If the price closes back across the UT Trailing Stop, exit your position immediately, as the trend bias has officially shifted.
Features & Components
1. Delta Zones (Liquidity/Wick Pressure)
Identifies periods of extreme buying or selling pressure based on wick-to-body ratios and standard deviation analysis.
Plots colored pressure boxes (Buy/Sell) to highlight potential exhaustion points or institutional activity.
2. Smart Money Concepts (SMC)
Automatically detects and plots Order Blocks (OBs) and Breaker Blocks (BBs) based on confirmed Market Structure Breaks (MSBs).
Includes Chop Control logic to remove less reliable Breaker Blocks.
3. UT Bot Trailing Stop & Warning Line
UT Trailing Stop (ATR-based): Plots a dynamic trend line (Green/Red) that acts as a moving stop-loss and primary trend filter.
Ready/Warning Signals: Alerts traders (via the "Ready" label and orange lines) when the price enters a "Pre-Reversal Zone" near the Trailing Stop.
4. Multi-Indicator Confirmation (Filters)
Includes customizable signals based on the crossover/crossunder of RSI, CCI, and Stochastic indicators against configurable Overbought/Oversold levels.
Allows selection of combination signals (e.g., RSI & CCI, All Combined, etc.) for high-conviction entries.
Volatility Signal-to-Noise Ratio🙏🏻 this is VSNR: the most effective and simple volatility regime detector & automatic volatility threshold scaler that somehow no1 ever talks about.
This is simply an inverse of the coefficient of variation of absolute returns, but properly constructed taking into account temporal information, and made online via recursive math with algocomplexity O(1) both in expanding and moving windows modes.
How do the available alternatives differ (while some’re just worse)?
Mainstream quant stat tests like Durbin-Watson, Dickey-Fuller etc: default implementations are ALL not time aware. They measure different kinds of regime, which is less (if at all) relevant for actual trading context. Mix of different math, high algocomplexity.
The closest one is MMI by financialhacker, but his approach is also not time aware, and has a higher algocomplexity anyways. Best alternative to mine, but pls modify it to use a time-weighted median.
Fractal dimension & its derivatives by John Ehlers: again not time aware, very low info gain, relies on bar sizes (high and lows), which don’t always exist unlike changes between datapoints. But it’s a geometric tool in essence, so this is fundamental. Let it watch your back if you already use it.
Hurst exponent: much higher algocomplexity, mix of parametric and non-parametric math inside. An invention, not a math entity. Again, not time aware. Also measures different kinds of regime.
How to set it up:
Given my other tools, I choose length so that it will match the amount of data that your trading method or study uses multiplied by ~ 4-5. E.g if you use some kind of bands to trade volatility and you calculate them over moving window 64, put VSNR on 256.
However it depends mathematically on many things, so for your methods you may instead need multipliers of 1 or ~ 16.
Additionally if you wanna use all data to estimate SNR, put 0 into length input.
How to use for regime detection:
First we define:
MR bias: mean reversion bias meaning volatility shorts would work better, fading levels would work better
Momo bias: momentum bias meaning volatility longs would work better, trading breakouts of levels would work better.
The study plots 3 horizontal thresholds for VSNR, just check its location:
Above upper level: significant Momo bias
Above 1 : Momo bias
Below 1 : MR bias
Below lower level: significant MR bias
Take a look at the screenshots, 2 completely different volatility regimes are spotted by VSNR, while an ADF does not show different regime:
^^ CBOT:ZN1!
^^ INDEX:BTCUSD
How to use as automatic volatility threshold scaler
Copy the code from the script, and use VSNR as a multiplier for your volatility threshold.
E.g you use a regression channel and fade/push upper and lower thresholds which are RMSEs multiples. Inside the code, multiply RMSE by VSNR, now you’re adaptive.
^^ The same logic as when MM bots widen spreads with vola goes wild.
How it works:
Returns follow Laplace distro -> logically abs returns follow exponential distro , cuz laplace = double exponential.
Exponential distro has a natural coefficient of variation = 1 -> signal to noise ratio defined as mean/stdev = 1 as well. The same can be said for Student t distro with parameter v = 4. So 1 is our main threshold.
We can add additional thresholds by discovering SNRs of Student t with v = 3 and v = 5 (+- 1 from baseline v = 4). These have lighter & heavier tails each favoring mean reversion or momentum more. I computed the SNR values you see in the code with mpmath python module, with precision 256 decimals, so you can trust it I put it on my momma.
Then I use exponential smoothing with properly defined alphas (one matches cumulative WMA and another minimizes error with WMA in moving window mode) to estimate SNR of abs returns.
…
Lightweight huh?
∞
Fib and Slope Trend Detector [EWT] + MTF Dashboard🚀 Overview
The Momentum Structure Trend Detector is a sophisticated trend-following tool that combines Price Velocity (Slope) with Market Structure (Fibonacci) to identify high-probability trend reversals and continuations.
Unlike traditional indicators that rely heavily on lagging moving averages, this script analyzes the speed of price action in real-time. It operates on the core principle of market structure: Impulse moves are fast and steep, while corrections are slow and shallow.
🧠 The Logic: Physics Meets Market Structure
This indicator determines the trend direction by calculating the Slope (Velocity) of price swings.
ZigZag Calculation: It first identifies market swings (Highs and Lows) using a standard pivot detection algorithm.
Slope Calculation: It calculates the velocity of every completed leg using the formula: $Slope = \frac{|Price Change|}{|Time Duration|}$.
Trend Definition:
Uptrend : If the previous Up-move was fast (Impulse) and the subsequent Down-move is slower (Correction), the market is primed for an uptrend.
Downtrend : If the previous Down-move was fast (Impulse) and the subsequent Up-move is slower (Correction), the market is primed for a downtrend.
🔥 Key Features
1. Aggressive Real-Time Detection (No Lag)
Most structure indicators wait for a "Higher High" to confirm a trend, which often leads to late entries. This script uses an Aggressive Live Slope calculation:
It compares the current developing slope of the live price action against the slope of the previous completed leg.
Result: As soon as the current move becomes "steeper" (faster) than the previous correction, the trend flips immediately. This allows you to catch the "meat" of the move before a new pivot is even confirmed.
2. Fibonacci Validity Filter
Momentum alone isn't enough; we need structural integrity.
The script calculates the 78.6% Retracement level of the impulse leg.
If a correction moves deeper than this Fibonacci limit (on a closing basis), the trend structure is considered "broken" or "invalid," and the indicator switches to a Neutral state. This filters out choppy/ranging markets.
3. Multi-Timeframe (MTF) Dashboard
A customizable dashboard on the chart allows for fractal analysis. You can view the trend state (UP/DOWN/NEUTRAL) across 9 different timeframes (1m to 1M) simultaneously.
Green Row : Uptrend
Red Row : Downtrend
Gray : Neutral/Indeterminate
4. Smart Visuals
Background Colo r: Changes dynamically (Teal for Bullish, Red for Bearish, Gray for Neutral) to give you an instant read of the market state.
Slope Labels : Displays the calculated numeric slope on the chart, helping you visualize the momentum difference between impulse and corrective waves.
Invalidation Levels : Automatically plots the invalidation line (Stop Loss level) based on the market structure.
🛠️ Settings & Inputs
Strategy Settings
Pivot Deviation Length : Sensitivity of the ZigZag calculation (Default: 5). Lower numbers = more sensitive to small swings.
Max Retracement % : The Fibonacci limit for a valid correction (Default: 78.6%).
Min Bars for Live Calc : To prevent noise, the script waits for this many bars after a pivot before calculating the "Live Slope" (Default: 3).
Dashboard Settings
Show Dashboard : Toggle the table on/off.
Timeframe Toggles : Enable/Disable specific timeframes (1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M) to suit your trading style.
🎯 How to Use
Wait for Background Change : When the background turns Teal, it indicates that a corrective pullback has ended and a new impulse with high velocity has begun.
Check Invalidation : Look at the plotted Stop Loss Level. If price closes below this line, the trade idea is invalid.
Confirm with Dashboard : Use the table to ensure the higher timeframes (e.g., 1H, 4H) align with your current chart's direction for higher probability setups.
Disclaimer : This tool is designed for trend analysis and educational purposes. Past performance (momentum) is not indicative of future results. Always manage your risk.






















