Rolling Log Returns [BackQuant]Rolling Log Returns
The Rolling Log Returns indicator is a versatile tool designed to help traders, quants, and data-driven analysts evaluate the dynamics of price changes using logarithmic return analysis. Widely adopted in quantitative finance, log returns offer several mathematical and statistical advantages over simple returns, making them ideal for backtesting, portfolio optimization, volatility modeling, and risk management.
What Are Log Returns?
In quantitative finance, logarithmic returns are defined as:
ln(Pₜ / Pₜ₋₁)
or for rolling periods:
ln(Pₜ / Pₜ₋ₙ)
where P represents price and n is the rolling lookback window.
Log returns are preferred because:
They are time additive : returns over multiple periods can be summed.
They allow for easier statistical modeling , especially when assuming normally distributed returns.
They behave symmetrically for gains and losses, unlike arithmetic returns.
They normalize percentage changes, making cross-asset or cross-timeframe comparisons more consistent.
Indicator Overview
The Rolling Log Returns indicator computes log returns either on a standard (1-period) basis or using a rolling lookback period , allowing users to adapt it to short-term trading or long-term trend analysis.
It also supports a comparison series , enabling traders to compare the return structure of the main charted asset to another instrument (e.g., SPY, BTC, etc.).
Core Features
✅ Return Modes :
Normal Log Returns : Measures ln(price / price ), ideal for day-to-day return analysis.
Rolling Log Returns : Measures ln(price / price ), highlighting price drift over longer horizons.
✅ Comparison Support :
Compare log returns of the primary instrument to another symbol (like an index or ETF).
Useful for relative performance and market regime analysis .
✅ Moving Averages of Returns :
Smooth noisy return series with customizable MA types: SMA, EMA, WMA, RMA, and Linear Regression.
Applicable to both primary and comparison series.
✅ Conditional Coloring :
Returns > 0 are colored green ; returns < 0 are red .
Comparison series gets its own unique color scheme.
✅ Extreme Return Detection :
Highlight unusually large price moves using upper/lower thresholds.
Visually flags abnormal volatility events such as earnings surprises or macroeconomic shocks.
Quantitative Use Cases
🔍 Return Distribution Analysis :
Gain insight into the statistical properties of asset returns (e.g., skewness, kurtosis, tail behavior).
📉 Risk Management :
Use historical return outliers to define drawdown expectations, stress tests, or VaR simulations.
🔁 Strategy Backtesting :
Apply rolling log returns to momentum or mean-reversion models where compounding and consistent scaling matter.
📊 Market Regime Detection :
Identify periods of consistent overperformance/underperformance relative to a benchmark asset.
📈 Signal Engineering :
Incorporate return deltas, moving average crossover of returns, or threshold-based triggers into machine learning pipelines or rule-based systems.
Recommended Settings
Use Normal mode for high-frequency trading signals.
Use Rolling mode for swing or trend-following strategies.
Compare vs. a broad market index (e.g., SPY or QQQ ) to extract relative strength insights.
Set upper and lower thresholds around ±5% for spotting major volatility days.
Conclusion
The Rolling Log Returns indicator transforms raw price action into a statistically sound return series—equipping traders with a professional-grade lens into market behavior. Whether you're conducting exploratory data analysis, building factor models, or visually scanning for outliers, this indicator integrates seamlessly into a modern quant's toolbox.
Pine utilities
Live Price Watermark (Flashing Overlay)Displays the current price as a large, centered watermark directly on your chart. The text color updates dynamically:
- Green when price rises
- Red when price falls
- Translucent black when unchanged
All SMAs Bullish/Bearish ScreenerTitle: All SMAs Bullish/Bearish Screener: Uncover Powerful Trend Alignment
Description:
Are you tired of sifting through countless charts, desperately trying to find stocks that are truly trending? Do you seek clear, unequivocal signals that scream "Buy!" or "Sell!" based on robust price action? Look no further. Introducing the "All SMAs Bullish/Bearish Screener," a powerful yet elegantly simple Pine Script indicator designed to pinpoint stocks where the current price is in absolute harmony (or discord) with a comprehensive suite of Simple Moving Averages.
The Power of Confluence: Why This Indicator Matters
In the dynamic world of trading, strong trends are often characterized by significant alignment across multiple timeframes. This indicator is built on the profound principle of Moving Average Confluence. Instead of just looking at one or two moving averages, this screener meticulously analyzes the relationship between the current closing price and six critical Simple Moving Averages (SMAs): the 5, 10, 20, 50, 100, and 200-period SMAs.
When the price is trading above ALL these moving averages – from the shortest-term (5-period) to the longest-term (200-period) – it's a powerful declaration of unwavering bullish momentum. This often signifies strong institutional buying, a clear accumulation phase, and a robust uptrend across all market horizons. Imagine easily identifying stocks like the one pictured (SAIL), where price confidently rides above every key average, signaling a prime opportunity.
Conversely, when the price is trading below ALL these moving averages, it indicates a severe and widespread bearish bias. This is a warning sign, often preceding further declines, suggesting strong distribution, and a downtrend that impacts every time horizon.
What This Script Delivers:
Unambiguous Trend Identification: Quickly identify stocks exhibiting exceptionally strong bullish or bearish trends. No more guessing – the alignment of all SMAs provides undeniable clarity.
Customizable SMA Lengths: Tailor the moving average periods to your specific trading style and preferred timeframes. Whether you prefer slightly different short, medium, or long-term averages, you have full control via user-friendly input settings.
Instant Visual Cues: The indicator visually highlights these rare and significant conditions directly on your chart:
A green triangle-up signal appears below the bar when all SMAs are bullish.
A red triangle-down signal appears above the bar when all SMAs are bearish.
The chart background color will subtly shift to lime green for bullish alignment and red for bearish alignment, providing immediate visual feedback at a glance.
Real-time Screener Capability (via TradingView Alerts): This is where the true power of this script shines for efficient trading. Set up custom alerts on TradingView for "All SMAs Bullish" or "All SMAs Bearish" conditions. Receive instant notifications (email, mobile, webhook) on any stock in your watchlist that meets these stringent criteria, allowing you to react swiftly to high-probability setups without constant chart monitoring. The alert message even tells you the ticker!
On-Chart Status Display: A clear, concise status message is displayed directly on your chart, indicating "Current Price is ABOVE ALL SMAs (Bullish)", "Current Price is BELOW ALL SMAs (Bearish)", or "SMAs are Mixed," ensuring you're always aware of the prevailing condition.
Who is This For?
This indicator is invaluable for:
Trend Followers: Identify robust trends early and ride them for significant gains.
Swing Traders: Spot strong directional momentum for intermediate-term trades.
Long-Term Investors: Confirm the health and direction of fundamental trends.
Screener Enthusiasts: Automate your market scanning to find the cleanest setups.
Stop wasting time on ambiguous charts. Leverage the "All SMAs Bullish/Bearish Screener" to gain an edge, simplify your analysis, and focus only on the highest conviction trend opportunities. Add it to your favorites today and transform your trading workflow!
#PineScript #TradingView #SMA #MovingAverage #TrendFollowing #StockScreener #TechnicalAnalysis #Bullish #Bearish #MarketScanner
SessionShades: London & NY CTSessionShades: London & NY CT is a lightweight TradingView indicator that visually highlights the London and New York trading sessions using a shaded background — no clutter, no blocks.
🔹 Time Zone: Central Time – automatically adjusts for DST
🔹 Sessions Highlighted:
• London: 2:00 AM – 11:00 AM CT
• New York: 7:00 AM – 4:00 PM CT
🔹 Customizable Colors: Easily change the shading colors and transparency
🔹 Intraday Use: Best viewed on intraday charts (1h, 30m, 15m, etc.)
This tool helps intraday traders and forex scalpers stay aware of key market hours with zero distraction. No indicators — just clean, visual session awareness.
Weinstein Stage Analysis HelperA helper script to visualize the Weinstein Stages intuitively along with other factors like
- Relative Strength
- Volume (On Balance Volume)
- RoE
- P/E
- Growth Rate
- EPS Growth Rate
TRADING GURU LIVE FLASHHi guys,
If you are looking to add some watermark into your charts. You can use this indicator.
You can add add a title and a subtitle, if you want to write in diferents lines, you can use as you can see in the script.
This is just a watermark, which follows my personal style an aesthetic when it comes to Pinescript tools. I like to keep my charts clean to focus on Time and price, and I love to have a reminder to remain disciplined.
Homo Faber Fortunae Suae is a Latin maxim which loosely translates to: Humans Are The Makers Of Their Own Destiny.
So make your own destiny, master yourself and the charts!
All the features are customizable: position, text size, text color, background.
Enjoy it.
EMA 9 & 150 Cross Arrow//@version=5
indicator("EMA 9 & 150 Cross Arrow", overlay=true)
// Input EMAs
emaShort = ta.ema(close, 9)
emaLong = ta.ema(close, 150)
// Detect Crosses
bullishCross = ta.crossover(emaShort, emaLong)
bearishCross = ta.crossunder(emaShort, emaLong)
// Plot EMAs
plot(emaShort, color=color.green, title="EMA 9")
plot(emaLong, color=color.red, title="EMA 150")
// Plot Arrows
plotshape(bullishCross, title="Bullish Cross", location=location.belowbar, color=color.green, style=shape.arrowup, size=size.small)
plotshape(bearishCross, title="Bearish Cross", location=location.abovebar, color=color.red, style=shape.arrowdown, size=size.small)
Gold DynamicThis is a custom-made TradingView indicator designed to visualize "sequential price levels" based on a user-defined step value, dynamically centered around the current gold price. It draws horizontal lines at multiples of a chosen step value (e.g., 7) both above and below the current price.
Key Features:
Dynamic Price Levels: Lines are calculated relative to the live price, providing relevant support/resistance or structural levels for the current market context.
Customizable Step Value: Easily adjust the Sequence Step Value (e.g., 7, 10, 14) from the indicator settings to align with your trading theory.
Adjustable Line Count: Control the Number of Lines ABOVE Current Price and Number of Lines BELOW Current Price to show as many or as few levels as desired.
Extended Lines: Horizontal lines extend indefinitely to both the left (historical data) and right (future projection) for comprehensive visualization.
Clear Price Labels: Each line displays its exact price value, positioned at the far right of the chart for quick reference.
Customizable Appearance: Modify line color, width, and style (solid, dotted, dashed) to suit your charting preferences.
Exact Values: All displayed price labels are rounded to whole numbers for clear, precise visualization without decimal values.
This indicator is ideal for traders looking to apply a fixed-step price theory to their gold analysis.
US Stocks SPDRsSelect Sector SPDR ETFs - These are unique Exchange Traded Funds (ETFs) that divide the S&P 500 into eleven index funds that trade all day on NYSE Arca.
Day of Week HighlighterThis Indicator Helps Indian Traders or Any Traders to see Charts Days Highlights in their Charts..
AshishBediSPLThis Pine Script indicator, "AshishBediSPL," is designed to help you visualize and analyze the combined premium of a short straddle strategy using Call and Put options. It fetches real-time and historical data for your chosen index or stock (NIFTY, BANKNIFTY, FINNIFTY, MIDCPNIFTY, SENSEX, BANKEX, or RELIANCE) and a specified expiry date and strike price.
You can opt to view the combined premium of both Call and Put options, or analyze just the Call or Put premium individually. The indicator then allows you to overlay and generate trading signals based on a selection of popular technical indicators, including:
EMA Crossover: Identify trend changes with configurable fast and slow Exponential Moving Averages.
Supertrend: Determine the prevailing trend direction and potential reversal points.
VWAP (Volume Weighted Average Price): Track the average price traded based on volume, resetting daily.
RSI (Relative Strength Index): Gauge momentum and potential overbought/oversold conditions (note: RSI buy/sell logic is set to trigger on overbought/oversold levels, which can be interpreted for contrarian or trend-following strategies depending on your approach).
SMA (Simple Moving Average): Smooth price data to identify support and resistance.
The indicator plots the combined premium as a dynamic line, changing color based on its opening and closing values. Buy and Sell signals are clearly marked on the chart, and you can set up alerts to notify you of these trading opportunities.
This tool is ideal for traders looking to monitor straddle premiums and integrate multiple indicator-based signals into their analysis.
8H/12H Trend + RSI + MACD🧠 RSI 8/12H – The Indicator That Shows Reversals Before the Move Happens
Standard RSI (14) is too slow.
By the time it flashes a signal, the move is usually halfway done.
📍 RSI 8/12H is faster, sharper, and built to spot local reversals early – before the crowd sees them.
Why 8/12H Works:
✅ Detects overbought/oversold zones with precision
✅ Especially powerful on gold, oil, and indices
✅ Gives 1–2 clean, high-probability signals per week – no noise, no clutter
🔥 If you're tired of chasing late entries,
RSI 8/12H gives you the edge to get in before the breakout.
Don’t just watch where the market’s been.
Anticipate where it turns.
Multi-Timeframe Close Alert with Toggleyou can create alerts with this indicator for when a time frame closes
RSI OB/OS Alert Indicator[CongTrader]📋 Description:
🔎 Overview
The RSI OB/OS Alert Indicator is a simple yet powerful tool that helps traders identify overbought and oversold zones using the widely-known Relative Strength Index (RSI). Whenever RSI crosses into custom-defined thresholds, the indicator highlights the chart background and triggers alerts, making it easier to time entries or exits.
⚙️ Key Features
Customizable RSI length, Overbought, and Oversold levels
Clear visual markers for RSI values and threshold lines
Background color zones for quick visual recognition
Built-in alert conditions to notify you in real-time
Clean, minimalist design suitable for any asset class
🧠 How to Use
Add the indicator to your chart (supports crypto, forex, stocks, etc.)
Adjust the RSI period and OB/OS levels to match your strategy
Watch for red background = overbought, green background = oversold
Enable alerts to receive real-time notifications when RSI crosses levels
💼 Best For
Intraday and swing traders
Scalpers and longer-term investors
All asset types (Crypto, Forex, Stocks, Indices)
🛡️ Disclaimer
⚠️ This indicator is for informational and educational purposes only. It does not constitute financial advice. Trading involves risk, and users should conduct their own analysis before making any financial decisions. The author is not responsible for any financial loss.
🙏 Credits & Thank You
Thank you for using the RSI OB/OS Alert Indicator by CongTrader.
If you find it helpful, please like ❤️, share, or follow me for more quality tools and indicators to level up your trading game! #RSI #Overbought #Oversold #RSIAlert #CongTrader #TradingIndicator #CryptoRSI #ForexIndicator #StockTrading #TechnicalAnalysis #TradingView
多時間框架MACD背離指標test test test test test test test test test test test test test test test test test test test
Metaplanet MSW Strike (Actual Schedule)This indicator displays the actual Moving Strike Warrant pricing schedule for Metaplanet Inc (3350.T), showing the precise strike prices that warrant holders can exercise at during each evaluation period.
Key Features
Accurate MSW Schedule: Reflects Metaplanet's actual warrant terms with the current strike price locked at 1,649 yen through July 1st, 2025, followed by 3-day re-evaluation cycles starting July 2nd.
Segmented Price Lines: Shows yellow horizontal lines only during their active periods, creating distinct blocks for each MSW window rather than continuous lines. Lines extend into the future to show when each strike price remains valid.
Automatic Calculations: Starting July 2nd, the indicator will automatically calculate new strike prices using the 3-day simple moving average of closing prices from the previous evaluation period.
Real-time Information: Displays current strike price on the right price scale and includes an information panel showing the active strike price and next evaluation date.
Visual Reference: Background colors indicate whether the current price is above (green) or below (red) the active strike price, helping traders quickly assess warrant profitability.
Z-Score Volume with CVD ConfirmationZ-Score Volume with CVD Confirmation is a volume-based confluence tool that enhances traditional volume analysis by combining Z-Score volume anomalies with Cumulative Volume Delta (CVD) confirmation. This indicator helps traders identify unusual volume activity that aligns with directional order flow, offering a cleaner signal for potential breakout or reversal scenarios.
🔍 Key Features:
Z-Score Calculation: Measures how extreme current volume is relative to its recent average, highlighting statistically significant surges or drops.
CVD Confirmation: Uses Cumulative Volume Delta candles (open/high/low/close) to assess buying vs. selling pressure in lower timeframes.
Bar Color Logic:
Green: High Z-Score volume confirmed by CVD bullish candle
Red: High Z-Score volume confirmed by CVD bearish candle
Other color bands show progressively strong or weak volume outliers
Real Volume Bar Heights: Volume bars retain true scale while color reflects underlying order flow strength and direction.
💡 Use Cases:
Breakout validation: Confirm price range breaks when volume surge is supported by CVD direction
Fade setups: Detect unsustainable high-volume moves lacking CVD support
Trend continuation: Spot momentum when both Z-Score and CVD align in the direction of the trend
⚙️ How to Use:
Adjust the Z-Score length to define how far back to measure average and deviation.
Select your anchor timeframe (typically 1D) and a lower timeframe for CVD calculations (e.g., 1-minute).
Use color-coded volume bars to assess volume significance and directional flow at a glance.
Add the standard volume indicator to the chart so one can compare the difference between the standard volume indicator and the Z-Score Volume with CVD Confirmation script. Useful at specific price levels and exiting ranges or not.
Manual VAH/VAL LevelsManual VAH/VAL Levels is a utility indicator that lets traders manually display the Value Area High (VAH) and Value Area Low (VAL) from the prior trading day, based on a Fixed Range Volume Profile tool.
This script is designed to:
Draw horizontal lines at the manually input VAH and VAL levels
Label each line with the corresponding price, aligned clearly to the right of the chart
Display levels only during the regular trading session for focused market context
Maintain a clean chart appearance with transparent label backgrounds
💡 How to Use:
Apply TradingView's Fixed Range Volume Profile tool to the prior day's session
Manually enter the VAH and VAL values into the script settings
The script will draw and label these levels dynamically during the NY market session
This tool is ideal for:
Traders using volume-based key levels for intraday decision-making
Contextualizing price action near areas of prior day value
Confluence analysis when paired with opening range, CVD, or breakout systems
Watermark Clarity V33🌟 Introducing Watermark Clarity V33 – Banner 🌟
Watermark Clarity V33 is a visual utility tool designed to enhance chart awareness, focus, and clean aesthetics without adding market noise. Unlike traditional indicators, this script does not generate buy/sell signals or perform technical analysis. Instead, it provides a customizable on-chart watermark banner that clearly communicates your current mindset, risk awareness, or trading bias directly on the chart — helping traders stay aligned with their pre-defined plans and reducing impulsive behavior.
Whether you’re a discretionary trader, scalper, or swing trader, Watermark Clarity V33 offers an adaptive display that blends clarity with minimalism, keeping your chart clean while remaining informative.
🛠 Customizable Parameters
• Dual Text Banners: Configure two independent headers to reflect trading goals, risk posture, or emotional cues.
• Smart Animation Toggle: Optionally animate between messages to help reinforce shifting market awareness or draw attention during high-alert periods.
• Size, Color & Positioning: Adjust the info box’s text size, banner dimensions, background color, transparency, and placement (top/middle/bottom – left/center/right).
• Transparent Mode: Switch to semi-transparent mode for cleaner overlays during live sessions or screen recording.
🚀 New Feature – Custom Alerts & Smart Animation Control
• Market-Aware Animation Logic:
When Enable Animation is turned on and both Heading 1 and Heading 2 are filled:
• 📈 During Market Hours → The banner alternates smoothly between both headings, helping maintain awareness and visual engagement.
• 💤 Outside Market Hours → The banner remains fixed on Heading 1. This acts as a subtle visual cue that markets are currently closed — giving you peace of mind and a cleaner screen.
✨ Visual Utility Use Cases
• Accountability Layer: Keep yourself accountable to your trading rules or session checklist.
• Mindset Anchor: Display motivational or tactical reminders that guide your trading behavior.
• Multi-Timeframe Syncing: Use different watermarks across charts to stay aligned across timeframes or instruments.
📘 How to Use
1. Add the Indicator: Apply “Watermark Clarity V33 – Banner” to your chart.
2. Configure Inputs: Adjust the banner texts, size, color scheme, and screen position to your liking.
4. Focus & Trade: Let the visual cue support your decision-making environment without interfering with price action.
❗ Important Notes
• This indicator does not analyze price data or generate signals. It is designed solely for visual clarity and trader discipline support.
• All display logic runs in real-time and responds to your settings only, no repainting or lookahead bias.
XAUT Box with RSI Div(Dynamic Adjustment + MA + Short + English)Strategy Overview: Box Range with RSI Divergence (Dynamic Adjustment - OKX Signal Format)
This Pine Script strategy, "XAUT Box with RSI Div (Dynamic Adjustment + MA + Short + English )", is designed for trading within a box range while leveraging RSI divergences and moving average trends. It is optimized for use with OKX signal credentials and integrates TradingView alerts for automated trading.
Optimal Configuration
Take-Profit: 18% return rate.
Initial Margin: $50.
Total Margin: $800 USDT.
Expected Monthly Return: 10%+.
Asset Statistics Analysis 📊📊 Asset Drawdown Statistics — Full Analysis & Recommendation Tool
This indicator provides an in-depth statistical analysis of an asset’s drawdown behavior over a custom period and offers dynamic trade recommendations based on price action and moving average alignment.
🔍 Main Features:
✅ Drawdown Classification: Real-time classification of the current drawdown into 4 levels:
🟢 Low
🟡 Moderate
🟠 High
🔴 Critical
(Levels are calculated dynamically based on the asset's max drawdown in the selected period.)
⏱️ Average & Max Durations: Tracks how long the asset stays in each drawdown level on average and records the longest streaks (in bars).
📈 Dynamic Price Thresholds: Visual lines on the chart show key drawdown levels derived from peak equity.
📋 Statistical Dashboard: A floating table shows:
Current drawdown and classification
Time spent in each drawdown level (percentage)
Average and max duration per level
Live recommendation based on drawdown context and MA trend
📌 Trade Recommendations:
Based on the current drawdown + position relative to 3 moving averages (SMA):
🟢 Strong Buy / Buy
🟡 Accumulate / Hold
🟠 Reduce
🔴 Sell / Strong Sell
⚙️ Inputs:
Drawdown Period: Defines the number of bars used for peak drawdown calculation
3 customizable moving averages: Short / Medium / Long
✅ How to Use:
Use the drawdown classification to assess long-term risk phases.
Check the "Recommendation" box for guidance on timing entries/exits.
Combine with your own strategy or trend-following approach.
⚠️ Disclaimer
This script is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice.
Always do your own research and consult with a qualified financial advisor before making any trading decisions.
The author assumes no responsibility for any losses or damages resulting from the use of this indicator.