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
Поиск скриптов по запросу "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.
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.
[CASH] Crypto And Stocks Helper (MultiPack w. Alerts)ATTENTION! I'm not a good scripter. I have just learned a little basics for this project, stolen code from other public scripts and modified it, and gotten help from AI LLM's.
If you want recognition from stolen code please tell me to give you the credit you deserve.
The script is not completely finished yet and contains alot of errors but my friends and family wants access so I made it public.
_________________________________________________________________________________
CASH has multiple indicators (a true all-in-one multipack), guides and alerts to help you make better trades/investments. It has:
- Bitcoin Bull Market Support Band
- Dollar Volume
- 5 SMA and 5 EMA
- HODL Trend (a.k.a SuperTrend) indicator
- RSI, Volume and Divergence indicators w. alerts
More to come as well, like Backburner and a POC line from Volume Profile.
Everything is fully customizable, appearance and off/on etc.
More information and explainations along with my guides you can find in settings under "Input" and "Style".
Defended Price Levels (DPLs) — Melvin Dickover ConceptThis indicator identifies and draws horizontal “Defended Price Levels” (DPLs) exactly as originally described by Melvin E. Dickover in his trading methodology.
Dickover observed that when extreme relative volume and extreme “freedom of movement” (volume-to-price-movement ratio) occur on the same bar, especially on bars with large gaps or unusually large bodies, the closing price (or previous close) of that bar very often becomes a significant future support/resistance level that the market later “defends.”
This script automates the detection of those exact coincident spikes using two well-known public indicators:
Relative Volume (RVI)
• Original idea: Melvin Dickover
• Pine Script implementation used here: “Relative Volume Indicator (Freedom Of Movement)” by LazyBear
Link:
Freedom of Movement (FoM)
• Original idea and calculation: starbolt64
• Pine Script: “Freedom of Movement” by starbolt64
Link:
How this indicator works
Calculates the raw (possibly negative) LazyBear RVI and starbolt64’s exact FoM values
Normalizes and standardizes both over the user-defined lookback
Triggers only when both RVI and FoM exceed the chosen number of standard deviations on the same bar (true Dickover coincident-spike condition)
Applies Dickover’s original price-selection rules (uses current close on big gaps or 2× body expansion candles, otherwise previous close)
Draws a thin maroon horizontal ray only when the new level is sufficiently far from all previously drawn levels (default ≥0.8 %) and the maximum number of levels has not been reached
Keeps the chart clean by limiting the total number of significant defended levels shown
This is not a republish or minor variation of the two source scripts — it is a faithful automation of Melvin Dickover’s specific “defended price line” concept that he manually marked using the coincidence of these two indicators.
Full credit goes to:
Melvin E. Dickover — creator of the Defended Price Levels concept
LazyBear — author of the Relative Volume (RVI) implementation used here
starbolt64 — author of the Freedom of Movement indicator and calculation
Settings (all adjustable):
Standard Deviation Length (default 60)
Spike Threshold in standard deviations (default 2.0)
Minimum distance between levels in % (default 0.8 %)
Maximum significant levels to display (15–80)
Use these horizontal maroon lines as potential future support/resistance zones that the market has previously shown strong willingness to defend.
Thank you to Melvin, LazyBear, and starbolt64 for the original work that made this automation possible.
Chop + MSS/FVG Retest (Ace v1.6) – IndicatorWhat this indicator does
Name: Chop + MSS/FVG Retest (Ace v1.6) – Indicator
This is an entry model helper, not just a BOS/MSS marker.
It looks for clean trend-side setups by combining:
MSS (Market Structure Shift) using swing highs/lows
3-bar ICT Fair Value Gaps (FVG)
First retest back into the FVG
A built-in chop / trend filter based on ATR and a moving average
When everything lines up, it plots:
L below the candle = Long candidate
S above the candle = Short candidate
You pair this with a higher-timeframe filter (like the Chop Meter 1H/30M/15M) to avoid pressing the button in garbage environments.
How it works (simple explanation)
Chop / Trend filter
Computes ATR and compares each bar’s range to ATR.
If the bar is small vs ATR → more likely CHOP.
If the bar is big vs ATR → more likely TREND.
Uses a moving average:
Above MA + TREND → trendLong zone
Below MA + TREND → trendShort zone
MSS (Market Structure Shift)
Uses swing highs/lows (left/right bars) to track the last significant high/low.
Bullish MSS: close breaks above last swing high with displacement.
Bearish MSS: close breaks below last swing low with displacement.
Those events are marked as tiny triangles (MSS up/down).
A MSS only stays “valid” for a certain number of bars (Bars after MSS allowed).
3-bar ICT FVG
Bullish FVG: low > high
→ gap between bar 3 high and bar 2 low.
Bearish FVG: high < low
→ gap between bar 3 low and bar 2 high.
The indicator stores the FVG boundaries (top/bottom).
Retest of FVG
Watches for price to trade back into that gap (first touch).
That retest is the “entry zone” after the MSS.
Final Long / Short condition
Long (L) prints when:
Recent bullish MSS
Bullish FVG has formed
Price retests the bullish FVG
Environment = trendLong (ATR + above MA)
Not CHOP
Short (S) prints when:
Recent bearish MSS
Bearish FVG has formed
Price retests the bearish FVG
Environment = trendShort (ATR + below MA)
Not CHOP
So the L/S markers are “model-approved entry candles”, not just any random BOS.
Inputs / Settings
Key inputs you’ll see:
ATR length (chop filter)
How many bars to use for ATR in the chop / trend filter.
Lower = more sensitive, twitchy
Higher = smoother, slower to change
Max chop ratio
If barRange / ATR is below this → treat as CHOP.
Min trend ratio
If barRange / ATR is above this → treat as TREND.
Hide MSS/BOS marks in CHOP?
ON = MSS triangles disappear when the bar is classified as CHOP
Keeps your chart cleaner in consolidation
Swing left / right bars
Controls how tight or wide the swing highs/lows are for MSS:
Smaller = more sensitive, more MSS points
Larger = fewer, more significant swings
Bars after MSS allowed
How many bars after a MSS the indicator will still allow FVG entries.
Small value (e.g. 10) = MSS must deliver quickly or it’s ignored.
Larger (e.g. 20) = MSS idea stays “in play” longer.
Visual RR (for info only)
Just for plotting relative risk-reward in your head.
This is not a strategy tester; it doesn’t manage positions.
What you see on the chart
Small green triangle up = Bullish MSS
Small red triangle down = Bearish MSS
“L” triangle below a bar = Long idea (MSS + FVG retest + trendLong + not chop)
“S” triangle above a bar = Short idea (MSS + FVG retest + trendShort + not chop)
Faint circle plots on price:
When the filter sees CHOP
When it sees Trend Long zone
When it sees Trend Short zone
You do not have to trade every L or S.
They’re there to show “this is where the model would have considered an entry.”
How to use it in your trading
1. Use it with a higher-timeframe filter
Best practice:
Use this with the Chop Meter 1H/30M/15M or some other HTF filter.
Only consider L/S when:
Chop Meter = TRADE / NORMAL, and
This indicator prints L or S in the right location (premium/discount, near OB/FVG, etc.)
If higher-timeframe says NO TRADE, you ignore all L/S.
2. Location > Signal
Treat L/S as confirmation, not the whole story.
For shorts (S):
Look for premium zones (previous highs, OBs, fair value ranges above mid).
Want purge / raid of liquidity + MSS down + bearish FVG retest → then S.
For longs (L):
Look for discount zones (previous lows, OBs/FVGs below mid).
Want stop raid / purge low + MSS up + bullish FVG retest → then L.
If you see L/S firing in the middle of a bigger range, that’s where you skip and let it go.
3. Instrument presets (example)
You can tune the ATR/chop settings per instrument:
MNQ (noisy, 1m chart):
ATR length: 21
Max chop ratio: 0.90
Min trend ratio: 1.40
Bars after MSS allowed: 10
GOLD (cleaner, 3m chart):
ATR length: 14
Max chop ratio: 0.80
Min trend ratio: 1.30
Bars after MSS allowed: 20
You can save those as presets in the TV settings for quick switching.
4. How to practice with it
Open replay on a couple of days.
Check Chop Meter → if NO TRADE, just observe.
When Chop Meter says TRADE:
Mark where L/S printed.
Ask:
Was this in premium/discount?
Was there SMT / purge on HTF?
Did the move actually deliver, or did it die?
Screenshot the A+ L/S and the ugly ones; refine:
ATR length
Chop / trend thresholds
MSS lookback
Your goal is to get it to where:
The L/S marks show up mostly in the same places your eye already likes,
and you ignore the rest.
200SMA Distance OscillatorThe oscillator measures the percentage deviation of closing price x from SMA200.
The idea behind the oscillator was preceded by an analysis of how often MAs in the index hold/bounce or are broken through.
Basically, the idea was about index analysis, i.e., the macro picture of a market.
Who wants to buy individual stocks when the overall market is plummeting ;-)
Or in other words: How long are you long in a market? When is it time to take profits?
After the analysis of the stability of SMAs in the index was rather modest (ratio of just under 6:4 for bounce to breakout – overall in 20, 50, 100, and 200 frames from 2020 to 2025), it was noticeable that the percentage over- or underperformance was scalable, especially in indices.
And since indices generally move upwards, there were fixed limits for over- and underestimations – especially in the longer term (SMA200) – unlike with individual stocks.
It is therefore more a question of macro trends and less of short-term movements, e.g., in day trading.
It was now interesting to see at what percentage range counter-movements were likely – particularly in the positive range for profit-taking, but of course also in the negative range for entry into sold-off markets.
If, for example, closing prices around +25% above SMA200 were reached in the NDX, the probability is very high that the market has overreacted and an interim correction will follow – so the theory goes.
On the other hand, continuous levels of +5 to +10% are a product of healthy positive development in a bull market and do not necessarily require action.
The oscillator was specifically designed for the NDX, but can also be used for the SPX and others.
The style was based on the RSI, so that the color level rises from 10% to 20% (overbought/oversold principle).
Based on manually examined movements, the criteria were set as follows:
+/-10% = flow / no color background
> +/-10% = border areas / color background
The center line represents the 252 average of the percentage deviations and could also be used as a trigger, provided it has been historically examined and is valid.
The oscillator is very interesting because it behaves completely differently from one financial instrument to another and, as a result, also in the timeframes (4h, D, W).
It would probably make sense to change the flow and border levels in the code when using it outside of indices.
The fact is that the oscillator must be “adjusted” to each instrument in order to achieve its goal of providing the best possible prediction. “Adjusting” refers to the analysis of the levels at which an instrument/asset usually reacts.
As with all indicators and oscillators, it is advisable to take other indicators and, in particular, macro news into account when analyzing this development.
If I find any substantial correlations with other indicators, I will be happy to provide an update.
The idea came from me, the code from Grok.
The code is not 100% perfect, but the data (percentage deviation, color background) is correct according to initial analysis.
In the settings, you can make the lines of the plots invisible. This makes the oscillator clearer. You can also adjust the settings for the average line.
Flux-Tensor Singularity [FTS]Flux-Tensor Singularity - Multi-Factor Market Pressure Indicator
The Flux-Tensor Singularity (FTS) is an advanced multi-factor oscillator that combines volume analysis, momentum tracking, and volatility-weighted normalization to identify critical market inflection points. Unlike traditional single-factor indicators, FTS synthesizes price velocity, volume mass, and volatility context into a unified framework that adapts to changing market regimes.
This indicator identifies extreme market conditions (termed "singularities") where multiple confirming factors converge, then uses a sophisticated scoring system to determine directional bias. It is designed for traders seeking high-probability setups with built-in confluence requirements.
THEORETICAL FOUNDATION
The indicator is built on the premise that market time is not constant - different market conditions contain varying levels of information density. A 1-minute bar during a major news event contains far more actionable information than a 1-minute bar during overnight low-volume trading. Traditional indicators treat all bars equally; FTS does not.
The theoretical framework draws conceptual parallels to physics (purely as a mental model, not literal physics):
Volume as Mass: Large volume represents significant market participation and "weight" behind price moves. Just as massive objects have stronger gravitational effects, high-volume moves carry more significance.
Price Change as Velocity: The rate of price movement through price space represents momentum and directional force.
Volatility as Time Dilation: When volatility is high relative to its historical norm, the "information density" of each bar increases. The indicator weights these periods more heavily, similar to how time dilates near massive objects in physics.
This is a pedagogical metaphor to create a coherent mental model - the underlying mathematics are standard financial calculations combined in a novel way.
MATHEMATICAL FRAMEWORK
The indicator calculates a composite singularity value through four distinct steps:
Step 1: Raw Singularity Calculation
S_raw = (ΔP × V) × γ²
Where:
ΔP = Price Velocity = close - close
V = Volume Mass = log(volume + 1)
γ² = Time Dilation Factor = (ATR_local / ATR_global)²
Volume Transformation: Volume is log-transformed because raw volume can have extreme outliers (10x-100x normal). The logarithm compresses these spikes while preserving their significance. This is standard practice in volume analysis.
Volatility Weighting: The ratio of short-term ATR (5 periods) to long-term ATR (user-defined lookback) is squared to create a volatility amplification factor. When local volatility exceeds global volatility, this ratio increases, amplifying the raw singularity value. This makes the indicator regime-aware.
Step 2: Normalization
The raw singularity values are normalized to a 0-100 scale using a stochastic-style calculation:
S_normalized = ((S_raw - S_min) / (S_max - S_min)) × 100
Where S_min and S_max are the lowest and highest raw singularity values over the lookback period.
Step 3: Epsilon Compression
S_compressed = 50 + ((S_normalized - 50) / ε)
This is the critical innovation that makes the sensitivity control functional. By applying compression AFTER normalization, the epsilon parameter actually affects the final output:
ε < 1.0: Expands range (more signals)
ε = 1.0: No change (default)
ε > 1.0: Compresses toward 50 (fewer, higher-quality signals)
For example, with ε = 2.0, a normalized value of 90 becomes 70, making threshold breaches rarer and more significant.
Step 4: Smoothing
S_final = EMA(S_compressed, smoothing_period)
An exponential moving average removes high-frequency noise while preserving trend.
SIGNAL GENERATION LOGIC
When the tensor crosses above the upper threshold (default 90) or below the lower threshold (default 10), an extreme event is detected. However, the indicator does NOT immediately generate a buy or sell signal. Instead, it analyzes market context through a multi-factor scoring system:
Scoring Components:
Price Structure (+1 point): Current bar bullish/bearish
Momentum (+1 point): Price higher/lower than N bars ago
Trend Context (+2 points): Fast EMA above/below slow EMA (weighted heavier)
Acceleration (+1 point): Rate of change increasing/decreasing
Volume Multiplier (×1.5): If volume > average, multiply score
The highest score (bullish vs bearish) determines signal direction. This prevents the common indicator failure mode of "overbought can stay overbought" by requiring directional confirmation.
Signal Conditions:
A BUY signal requires:
Extreme event detection (tensor crosses threshold)
Bullish score > Bearish score
Price confirmation: Bullish candle (optional, user-controlled)
Volume confirmation: Volume > average (optional, user-controlled)
Momentum confirmation: Positive momentum (optional, user-controlled)
A SELL signal requires the inverse conditions.
INPUTS EXPLAINED - Core Parameters:
Global Horizon (Context): Default 20. Lookback period for normalization and volatility comparison. Higher values = smoother but less responsive. Lower values = more signals but potentially more noise.
Tensor Smoothing: Default 3. EMA period applied to final output. Removes "quantum foam" (high-frequency noise). Range 1-20.
Singularity Threshold: Default 90. Values above this (or below 100-threshold) trigger extreme event detection. Higher = rarer, stronger signals.
Signal Sensitivity (Epsilon): Default 1.0. Post-normalization compression factor. This is the key innovation - it actually works because it's applied AFTER normalization. Range 0.1-5.0.
Signal Interpreter Toggles:
Require Price Confirmation: Default ON. Only generates buy signals on bullish candles, sell signals on bearish candles. Reduces false signals but may delay entry.
Require Volume Confirmation: Default ON. Only signals when volume > average. Critical for stocks/crypto, less important for forex (unreliable volume data).
Use Momentum Filter: Default ON. Requires momentum agreement with signal direction. Prevents counter-trend signals.
Momentum Lookback: Default 5. Number of bars for momentum calculation. Shorter = more responsive, longer = trend-following bias.
Visual Controls:
Colors: Customizable colors for bullish flux, bearish flux, background, and event horizon.
Visual Transparency: Default 85. Master control for all visual elements (accretion disk, field lines, particles, etc.). Range 50-99. Signals and dashboard have separate controls.
Visibility Toggles: Individual on/off switches for:
Gravitational field lines (trend EMAs)
Field reversals (trend crossovers)
Accretion disk (background gradient)
Singularity diamonds (neutral extreme events)
Energy particles (volume bursts)
Event horizon flash (extreme event background)
Signal background flash
Signal Size: Tiny/Small/Normal triangle size
Signal Offsets: Separate controls for buy and sell signal vertical positioning (percentage of price)
Dashboard Settings:
Show Dashboard: Toggle on/off
Position: 9 placement options (all corners, centers, middles)
Text Size: Tiny/Small/Normal/Large
Background Transparency: 0-50, separate from visual transparency
VISUAL ELEMENTS EXPLAINED
1. Accretion Disk (Background Gradient):
A three-layer gradient background that intensifies as the tensor approaches extremes. The outer disk appears at any non-neutral reading, the inner disk activates above 70 or below 30, and the core layer appears above 85 or below 15. Color indicates direction (cyan = bullish, red = bearish). This provides instant visual feedback on market pressure intensity.
2. Gravitational Field Lines (EMAs):
Two trend-following EMAs (10 and 30 period) visualized as colored lines. These represent the "curvature" of market trend - when they diverge, trend is strong; when they converge, trend is weakening. Crossovers mark potential trend reversals.
3. Field Reversals (Circles):
Small circles appear when the fast EMA crosses the slow EMA, indicating a potential trend change. These are distinct from extreme events and appear at normal market structure shifts.
4. Singularity Diamonds:
Small diamond shapes appear when the tensor reaches extreme levels (>90 or <10) but doesn't meet the full signal criteria. These are "watch" events - extreme pressure exists but directional confirmation is lacking.
5. Energy Particles (Dots):
Tiny dots appear when volume exceeds 2× average, indicating significant participation. Color matches bar direction. These highlight genuine high-conviction moves versus low-volume drifts.
6. Event Horizon Flash:
A golden background flash appears the instant any extreme threshold is breached, before directional analysis. This alerts you to pay attention.
7. Signal Background Flash:
When a full buy/sell signal is confirmed, the background flashes cyan (buy) or red (sell). This is your primary alert that all conditions are met.
8. Signal Triangles:
The actual buy (▲) and sell (▼) markers. These only appear when ALL selected confirmation criteria are satisfied. Position is offset from bars to avoid overlap with other indicators.
DASHBOARD METRICS EXPLAINED
The dashboard displays real-time calculated values:
Event Density: Current tensor value (0-100). Above 90 or below 10 = critical. Icon changes: 🔥 (extreme high), ❄️ (extreme low), ○ (neutral).
Time Dilation (γ): Current volatility ratio squared. Values >2.0 indicate extreme volatility environments. >1.5 = elevated, >1.0 = above average. Icon: ⚡ (extreme), ⚠ (elevated), ○ (normal).
Mass (Vol): Log-transformed volume value. Compared to volume ratio (current/average). Icon: ● (>2× avg), ◐ (>1× avg), ○ (below avg).
Velocity (ΔP): Raw price change. Direction arrow indicates momentum direction. Shows the actual price delta value.
Bullish Flux: Current bullish context score. Displayed as both a bar chart (visual) and numeric value. Brighter when bullish score dominates.
Bearish Flux: Current bearish context score. Same visualization as bullish flux. These scores compete - the winner determines signal direction.
Field: Trend direction based on EMA relationship. "Repulsive" (uptrend), "Attractive" (downtrend), "Neutral" (ranging). Icon: ⬆⬇↔
State: Current market condition:
🚀 EJECTION: Buy signal active
💥 COLLAPSE: Sell signal active
⚠ CRITICAL: Extreme event, no directional confirmation
● STABLE: Normal market conditions
HOW TO USE THE INDICATOR
1. Wait for Extreme Events:
The indicator is designed to be selective. Don't trade every fluctuation - wait for tensor to reach >90 or <10. This alone is not a signal.
2. Check Context Scores:
Look at the Bullish Flux vs Bearish Flux in the dashboard. If scores are close (within 1-2 points), the market is indecisive - skip the trade.
3. Confirm with Signals:
Only act when a full triangle signal appears (▲ or ▼). This means ALL your selected confirmation criteria have been met.
4. Use with Price Structure:
Combine with support/resistance levels. A buy signal AT support is higher probability than a buy signal in the middle of nowhere.
5. Respect the Dashboard State:
When State shows "CRITICAL" (⚠), it means extreme pressure exists but direction is unclear. These are the most dangerous moments - wait for resolution.
6. Volume Matters:
Energy particles (dots) and the Mass metric tell you if institutions are participating. Signals without volume confirmation are lower probability.
MARKET AND TIMEFRAME RECOMMENDATIONS
Scalping (1m-5m):
Lookback: 10-14
Smoothing: 5-7
Threshold: 85
Epsilon: 0.5-0.7
Note: Expect more noise. Confirm with Level 2 data. Best on highly liquid instruments.
Intraday (15m-1h):
Lookback: 20-30 (default settings work well)
Smoothing: 3-5
Threshold: 90
Epsilon: 1.0
Note: Sweet spot for the indicator. High win rate on liquid stocks, forex majors, and crypto.
Swing Trading (4h-1D):
Lookback: 30-50
Smoothing: 3
Threshold: 90-95
Epsilon: 1.5-2.0
Note: Signals are rare but high conviction. Combine with higher timeframe trend analysis.
Position Trading (1D-1W):
Lookback: 50-100
Smoothing: 5-7
Threshold: 95
Epsilon: 2.0-3.0
Note: Extremely rare signals. Only trade the most extreme events. Expect massive moves.
Market-Specific Settings:
Forex (EUR/USD, GBP/USD, etc.):
Volume data is unreliable (spot forex has no centralized volume)
Disable "Require Volume Confirmation"
Focus on momentum and trend filters
News events create extreme singularities
Best on 15m-1h timeframes
Stocks (High-Volume Equities):
Volume confirmation is CRITICAL - keep it ON
Works excellently on AAPL, TSLA, SPY, etc.
Morning session (9:30-11:00 ET) shows highest event density
Earnings announcements create guaranteed extreme events
Best on 5m-1h for day trading, 1D for swing trading
Crypto (BTC, ETH, major alts):
Reduce threshold to 85 (crypto has constant high volatility)
Volume spikes are THE primary signal - keep volume confirmation ON
Works exceptionally well due to 24/7 trading and high volatility
Epsilon can be reduced to 0.7-0.8 for more signals
Best on 15m-4h timeframes
Commodities (Gold, Oil, etc.):
Gold responds to macro events (Fed announcements, geopolitical events)
Oil responds to supply shocks
Use daily timeframe minimum
Increase lookback to 50+
These are slow-moving markets - be patient
Indices (SPX, NDX, etc.):
Institutional volume matters - keep volume confirmation ON
Opening hour (9:30-10:30 ET) = highest singularity probability
Strong correlation with VIX - high VIX = more extreme events
Best on 15m-1h for day trading
WHAT MAKES THIS INDICATOR UNIQUE
1. Post-Normalization Sensitivity Control:
Unlike most oscillators where sensitivity controls don't actually work (they're applied before normalization, which then rescales everything), FTS applies epsilon compression AFTER normalization. This means the sensitivity parameter genuinely affects signal frequency. This is a novel implementation not found in standard oscillators.
2. Multi-Factor Confluence Requirement:
The indicator doesn't just detect "overbought" or "oversold" - it detects extreme conditions AND THEN analyzes context through five separate factors (price structure, momentum, trend, acceleration, volume). Most indicators are single-factor; FTS requires confluence.
3. Volatility-Weighted Normalization:
By squaring the ATR ratio (local/global), the indicator adapts to changing market regimes. A 1% move in a low-volatility environment is treated differently than a 1% move in a high-volatility environment. Traditional indicators treat all moves equally regardless of context.
4. Volume Integration at the Core:
Volume isn't an afterthought or optional filter - it's baked into the fundamental equation as "mass." The log transformation handles outliers elegantly while preserving significance. Most price-based indicators completely ignore volume.
5. Adaptive Scoring System:
Rather than fixed buy/sell rules ("RSI >70 = sell"), FTS uses competitive scoring where bullish and bearish evidence compete. The winner determines direction. This solves the classic problem of "overbought markets can stay overbought during strong uptrends."
6. Comprehensive Visual Feedback:
The multi-layer visualization system (accretion disk, field lines, particles, flashes) provides instant intuitive feedback on market state without requiring dashboard reading. You can see pressure building before extreme thresholds are hit.
7. Separate Extreme Detection and Signal Generation:
"Singularity diamonds" show extreme events that don't meet full criteria, while "signal triangles" only appear when ALL conditions are met. This distinction helps traders understand when pressure exists versus when it's actionable.
COMPARISON TO EXISTING INDICATORS
vs. RSI/Stochastic:
These normalize price relative to recent range. FTS normalizes (price change × log volume × volatility ratio) - a composite metric, not just price position.
vs. Chaikin Money Flow:
CMF combines price and volume but lacks volatility context and doesn't use adaptive normalization or post-normalization compression.
vs. Bollinger Bands + Volume:
Bollinger Bands show volatility but don't integrate volume or create a unified oscillator. They're separate components, not synthesized.
vs. MACD:
MACD is pure momentum. FTS combines momentum with volume weighting and volatility context, plus provides a normalized 0-100 scale.
The specific combination of log-volume weighting, squared volatility amplification, post-normalization epsilon compression, and multi-factor directional scoring is unique to this indicator.
LIMITATIONS AND PROPER DISCLOSURE
Not a Holy Grail:
No indicator is perfect. This tool identifies high-probability setups but cannot predict the future. Losses will occur. Use proper risk management.
Requires Confirmation:
Best used in conjunction with price action analysis, support/resistance levels, and higher timeframe trend. Don't trade signals blindly.
Volume Data Dependency:
On forex (spot) and some low-volume instruments, volume data is unreliable or tick-volume only. Disable volume confirmation in these cases.
Lagging Components:
The EMA smoothing and trend filters are inherently lagging. In extremely fast moves, signals may appear after the initial thrust.
Extreme Event Rarity:
With conservative settings (high threshold, high epsilon), signals can be rare. This is by design - quality over quantity. If you need more frequent signals, reduce threshold to 85 and epsilon to 0.7.
Not Financial Advice:
This indicator is an analytical tool. All trading decisions and their consequences are solely your responsibility. Past performance does not guarantee future results.
BEST PRACTICES
Don't trade every singularity - wait for context confirmation
Higher timeframes = higher reliability
Combine with support/resistance for entry refinement
Volume confirmation is CRITICAL for stocks/crypto (toggle off only for forex)
During major news events, singularities are inevitable but direction may be uncertain - use wider stops
When bullish and bearish flux scores are close, skip the trade
Test settings on your specific instrument/timeframe before live trading
Use the dashboard actively - it contains critical diagnostic information
Taking you to school. — Dskyz, Trade with insight. Trade with anticipation.






















