Rolling 250-Day Sharpe RatioThis Pine Script indicator, “Rolling 250-Day Sharpe Ratio”, computes the trailing Sharpe Ratio for any traded asset over a 250-session window, equivalent to approximately one trading year. The script first derives daily log returns and adjusts them by subtracting the daily equivalent of the 3-month US Treasury yield to obtain the excess return. It then calculates the rolling mean and standard deviation of these excess returns to produce the annualized Sharpe Ratio, which is displayed as a continuous time series on the chart. This allows traders and analysts to assess how the asset’s risk-adjusted performance evolves over time relative to a risk-free benchmark.
A persistently high Sharpe Ratio can indicate strong risk-adjusted returns, but it is essential to approach extreme values with caution. Elevated Sharpe readings can sometimes reflect unsustainable trends, excessive leverage, or periods of unusually low volatility that may revert abruptly. Conversely, a low or negative Sharpe Ratio does not automatically imply an asset should be avoided; it might signal an opportunity if the risk environment normalizes.
Cicli
Session Makers v1
Session Makers v1 - Professional Trading Session Visualizer
This advanced indicator highlights key trading sessions and market structure levels, helping traders identify optimal trading times and important price levels.
Key Features:
Session Time Markers
- Vertical dotted lines at major market opens (London/New York)
- Appears 30 minutes before each session for early preparation
Interactive Session Boxes
- Asia Session (22:00-06:00 GMT) - Blue shaded area
- London AM (08:00-09:00 GMT) - Gray shaded area
- London/New York Overlap (14:00-15:00 GMT) - Gray shaded area
Key Reference Levels
- Yesterday's high/low (with touch alerts)
- Previous week's high/low (with touch alerts)
- Asia session high/low/mid lines
Smart Visual Design
- Clean, non-cluttered visuals that adapt to your chart
- Customizable colors and transparency for all elements
- Optimized for all timeframes (M1-H4)
only use in timeframes <= 15 min
Hourly Markers 09:00 - 20:00 Adjusted for UTC+2A line for every hour from 0900 to 2200
Description:
This TradingView Pine Script plots small red markers (downward arrows) at the top of the chart for every full hour between 09:00 AM and 08:00 PM (20:00) based on UTC+2 time. The markers appear precisely at the opening minute of each hour within the defined range, helping traders visually track key time intervals during the day.
Features:
✔ Displays markers from 09:00 to 20:00 local time (UTC+2 adjustment)
✔ Only plots markers at the first minute of each hour
✔ Uses clear, unobtrusive triangle-down symbols above the bars
✔ Works on any chart timeframe that captures hourly intervals
Use Case:
Ideal for traders who want a quick visual reference of hourly intervals during the main trading hours, especially when working with charts set to UTC or different time zones.
Macro+ ExtMacros+ (Time Sessions & Alerts)
Macros+ is a powerful and highly customizable tool designed to highlight specific time windows—often referred to as "macros"—directly on your chart. It is built for traders who operate on time-based strategies, such as those targeting specific liquidity periods like the ICT Silver Bullet or other institutional timeframes.
By visualizing these key sessions historically and in real-time, traders can better anticipate market volatility, identify potential trade setups, and maintain discipline. The script is clean, efficient, and built with flexibility in mind.
Key Features
This indicator goes beyond simple time boxes and includes several advanced features to fit your specific trading style:
1. Historical & Real-Time Display
The script is designed to plot all selected macro sessions across the entire historical data loaded on your chart, not just the current day. This allows for comprehensive backtesting and analysis of how price behaves during these specific time windows.
2. Fully Customizable Macro Sessions
You have full control over which time sessions you want to display. The indicator includes 14 pre-configured 20-minute sessions, which you can easily toggle on or off from the settings menu. This allows you to focus only on the timeframes that are relevant to your strategy.
3. Adjustable "Extended Macro" Time
Flexible Time Extension: Instead of a fixed session duration, you can now dynamically extend the start and end times of all macros.
Numerical Input: In the settings, under "Time Settings," you'll find an "Extend Minutes" input. This number lets you add minutes to both the beginning and the end of each session.
Example: A standard macro from 09:50 - 10:10 with an "Extend Minutes" value of 5 will be automatically adjusted to 09:45 - 10:15. Setting it to 0 will keep the default 20-minute sessions.
4. Multiple Display Styles
Adapt the indicator's appearance to your preference for a clean and readable chart. All styles are designed to span the full vertical height of the chart for maximum visibility.
Solid Line: Clear, solid vertical lines marking the start and end of a session.
Dashed Line: A more subtle, dashed-line alternative.
Dotted Line: The most subtle line style for a minimalist chart.
Background: Fills the entire session window with a semi-transparent color.
Outline: Draws a colored border around the session window without filling it.
5. Real-Time Alerts
Never miss the start of a key session again. You can enable an alert that will trigger once at the beginning of any active macro session. This is perfect for traders who may not be watching the charts constantly.
6. Timezone Correction
All times are calculated based on the timezone you select in the settings (default is "America/New_York"). This ensures the sessions are always plotted accurately according to the market you are trading (e.g., New York session times).
How to Use
Add to Chart: Add the "Macros+" indicator to your chart.
Open Settings:
General Settings: Choose your preferred Timezone, Display Style, and Color.
Active Macro Sessions: Check the boxes for the time sessions you wish to monitor.
Time Settings: Enter a value in Extend Minutes if you want to widen the time windows. A value of 5 will create 30-minute sessions.
Alert Settings: Enable the Alert On Macro Start option if you wish to receive alerts.
Create Alert: To activate the pop-up alert, click the clock icon on the TradingView right-hand panel, select "Macros+" in the "Condition" dropdown, choose "Sesi Makro Dimulai," and set it to trigger "Once Per Bar."
This tool was designed to be both powerful and user-friendly. I hope it becomes a valuable part of your trading toolkit. Happy trading!
z-score-calkusi-v1.14z-scores incorporate the moment of N look-back bars to allow future price projection.
z-score = (X - mean)/std.deviation ; X = close
z-scores update with each new close print and with each new bar. Each new bar augments the mean and std.deviation for the N bars considered. The old Nth bar falls away from consideration with each new historical bar.
The indicator allows two other options for X: RSI or Moving Average.
NOTE: While trading use the "price" option only.
The other two options are provided for visualisation of RSI and Moving Average as z-score curves.
Use z-scores to identify tops and bottoms in the future as well as intermediate intersections through which a z-score will pass through with each new close and each new bar.
Draw lines from peaks and troughs in the past through intermediate peaks and troughs to identify projected intersections in the future. The most likely intersections are those that are formed from a line that comes from a peak in the past and another line that comes from a trough in the past. Try getting at least two lines from historical peaks and two lines from historical troughs to pass through a future intersection.
Compute the target intersection price in the future by clicking on the z-score indicator header to see a drag-able horizontal line to drag over the intersection. The target price is the last value displayed in the indicator's status bar after the closing price.
When the indicator header is clicked, a white horizontal drag-able line will appear to allow dragging the line over an intersection that has been drawn on the indicator for a future z-score projection and the associated future closing price.
With each new bar that appears, it is necessary to repeat the procedure of clicking the z-score indicator header to be able to drag the drag-able horizontal line to see the new target price for the selected intersection. The projected price will be different from the current close price providing a price arbitrage in time.
New intermediate peaks and troughs that appear require new lines be drawn from the past through the new intermediate peak to find a new intersection in the future and a new projected price. Since z-score curves are sort of cyclical in nature, it is possible to see where one has to locate a future intersection by drawing lines from past peaks and troughs.
Do not get fixated on any one projected price as the market decides which projected price will be realised. All prospective targets should be manually updated with each new bar.
When the z-score plot moves outside a channel comprised of lines that are drawn from the past, be ready to adjust to new market conditions.
z-score plots that move above the zero line indicate price action that is either rising or ranging. Similarly, z-score plots that move below the zero line indicate price action that is either falling or ranging. Be ready to adjust to new market conditions when z-scores move back and forth across the zero line.
A bar with highest absolute z-score for a cycle screams "reversal approaching" and is followed by a bar with a lower absolute z-score where close price tops and bottoms are realised. This can occur either on the next bar or a few bars later.
The indicator also displays the required N for a Normal(0,1) distribution that can be set for finer granularity for the z-score curve.This works with the Confidence Interval (CI) z-score setting. The default z-score is 1.96 for 95% CI.
Common Confidence Interval z-scores to find N for Normal(0,1) with a Margin of Error (MOE) of 1:
70% 1.036
75% 1.150
80% 1.282
85% 1.440
90% 1.645
95% 1.960
98% 2.326
99% 2.576
99.5% 2.807
99.9% 3.291
99.99% 3.891
99.999% 4.417
9-Jun-2025
Added a feature to display price projection labels at z-score levels 3, 2, 1, 0, -1, -2, 3.
This provides a range for prices available at the current time to help decide whether it is worth entering a trade. If the range of prices from say z=|2| to z=|1| is too narrow, then a trade at the current time may not be worth the risk.
Added plot for z-score moving average.
28-Jun-2025
Added Settings option for # of Std.Deviation level Price Labels to display. The default is 3. Min is 2. Max is 6.
This feature allows likelihood assessment for Fibonacci price projections from higher time frames at lower time frames. A Fibonacci price projection that falls outside |3.x| Std.Deviations is not likely.
Added Settings option for Chart Bar Count and Target Label Offset to allow placement of price labels for the standard z-score levels to the right of the window so that these are still visible in the window.
Target Label Offset allows adjustment of placement of Target Price Label in cases when the Target Price Label is either obscured by the price labels for the standard z-score levels or is too far right to be visible in the window.
Practice makes perfect.
Use this indicator at your own risk
X HL QA market structure tool designed to frame price action within a defined context of prior session dynamics. It accomplishes this by anchoring a set of reference levels to the high, low, and open prices of a user-specified higher timeframe (e.g., 4H, 1D, etc.) and projecting those levels onto the current chart for ongoing analysis.
At its core, the indicator establishes a reference range—derived from the previous completed instance of the selected timeframe—and overlays this on the current timeframe. This range serves as a foundational structure for price interpretation in the current session.
Building upon this framework, the script constructs a set of symmetrical quadrants (or deviation zones) both inside and outside of the prior range. These include:
The midpoint (EQ) of the prior range
Levels at ±0.25x, ±0.75x, ±1.0x, ±1.5x, and ±2.0x the range height
These levels act as contextual zones that traders can use to interpret price behavior—whether it's consolidating within the prior range, approaching fair value (EQ), or expanding into directional continuation or reversal zones beyond the range.
The script operates in both real-time and historical contexts. On live bars, it dynamically updates the key levels to provide an evolving view of current price positioning. Simultaneously, it supports the display of historical levels for past sessions, enabling robust backtesting and comparative analysis of price behavior relative to previous quadrant structures.
Ultimately, this tool serves as a positional map, helping traders assess where price is trading relative to significant levels from the prior session, offering insights into potential support/resistance, overextension, or mean reversion scenarios.
Key Technical Features
Multi-Timeframe Support:
request.security() is used to pull data from a user-defined higher timeframe regardless of the current chart interval.
Visual Flexibility:
Toggle between "line" and "channel" mode.
Line color, width, and visibility are all user-controlled.
Anchoring Options:
Deviation levels can be calculated from either the previous period's open or its EQ (midpoint), giving flexibility depending on analytical preference.
Efficient Labeling:
Labels are only rendered on the last bar and are automatically cleared and redrawn to prevent duplication.
Label style, size, text color, and background color are all user-configurable.
Trading Application
This indicator is especially suited for:
1. Mean Reversion Strategies
When price moves beyond +1.0 or +1.5 deviations from the EQ or open, it may signal overextension and a potential snap back to the midpoint or range.
2. Breakout Confirmation
Sustained price action beyond ±1.0 levels may indicate trend strength or continuation beyond historical balance zones.
3. Contextual Range Awareness
EQ and Open provide structure from which traders can judge whether price is in a state of balance or imbalance.
Labels offer at-a-glance interpretation of key levels across any chosen timeframe.
4. Fractal and Multi-Session Analysis
Analysts can layer daily, weekly, and monthly versions of this indicator to observe confluence or divergence of higher timeframe structure.
unprofitable stratThe indicator is a comprehensive trend-following indicator for TradingView. It's designed to identify and trade in the direction of the market's primary trend while using a dynamic, volatility-based system for exits. It filters out counter-trend noise and provides a clear visual dashboard of market conditions.
Core Trading Strategy
The indicator's logic is based on a two-part confirmation system to ensure trades are only taken in favorable conditions.
Master Trend Filter: The indicator first determines the "master trend" by checking if the price is above or below a long-term (200-period) Exponential Moving Average (EMA). It will only look for BUY signals when the price is above this EMA (in a master bullish trend) and only look for SELL signals when the price is below it. This prevents fighting the main market current.
Entry Trigger: Once the master trend is confirmed, the indicator doesn't enter immediately. It waits for a secondary confirmation: a breakout above a recent swing high (for a BUY) or a breakdown below a recent swing low. This ensures that short-term momentum has aligned with the long-term trend before a signal is generated.
Dynamic Exit Strategy
Exits are not based on a fixed target. Instead, the indicator uses a professional-grade ATR-based Trailing Stop Loss.
This "smart" stop loss automatically trails behind a profitable trade. It moves up to lock in gains during a BUY trade but never moves down.
The distance of the stop from the price is determined by the Average True Range (ATR), meaning it gives the trade more room to breathe in volatile markets and tightens up to protect profits in calm markets.
An "EXIT" signal appears on the chart when the price finally pulls back and hits this trailing stop line.
Visual Features on the Chart
The indicator provides several visual aids to make the trading process clear and intuitive.
Custom-Plotted Candles: The indicator draws its own candlesticks that are colored based on the trade status:
Blue: An active BUY trade is in progress.
Purple: An active SELL trade is in progress.
Gray: The indicator is flat with no active trade.
Signal Labels: Clear "BUY", "SELL", and "EXIT" labels are plotted directly on the chart at the moment they occur.
Trailing Stop Line: A bright orange line appears and follows the price during a trade, showing you the exact level of your trailing stop loss.
Multi-Timeframe Table: An optional dashboard in the top-right corner displays the master trend status ("Bullish" or "Bearish") on the 1m, 5m, 15m, 1-hour, and 4-hour timeframes simultaneously.
Trend Background: An optional feature allows you to color the entire chart background light blue or purple to match the master trend direction.
X PD&FVVisualizes the price's premium or discount relative to a moving average benchmark, highlighting mean-reversion and trend-continuation opportunities. While the underlying math is simple, the application is nuanced and can enhance decision-making in both trending and ranging market conditions.
Core Logic:
This tool calculates a custom **spread value**, defined as the distance between the current price and a chosen exponential moving average (EMA). Specifically:
When the current price is **above** the EMA, the spread is calculated as `low - EMA`.
When the price is **below** the EMA, the spread is calculated as `high - EMA`.
This approach creates a dynamic spread that reflects deviation from the EMA, with histogram bars:
Green when the spread is positive (suggesting a price premium),
Red when the spread is negative (suggesting a discount).
A secondary EMA (default 9-period) is applied to the spread itself, plotted as a smoother line over the histogram. This "EMA of spread" line can be interpreted as a moving reference level for detecting directional shifts in momentum.
Interpretation:
Zero Line = Fair Value: The horizontal zero axis represents equilibrium relative to the moving average. Movement toward or away from this line signals potential shifts in market bias.
Trend Following Use: In trending markets, traders can:
Buy when the spread dips below its EMA (discount within uptrend),
Sell when the spread rises above its EMA (premium within downtrend).
Mean Reversion Use: A return to the zero line (fair value) often acts as an **inflection point**, which traders can monitor for either:
Trend continuation (bounce away from zero), or
Reversal (cross through zero).
Customization:
EMA length (default 50) is adjustable to fit different timeframes or asset volatility.
HMA Crossover + ATR + Curvature (Long & Short)📏 Hull Moving Averages (Trend Filters)
- fastHMA = ta.hma(close, fastLength)
- slowHMA = ta.hma(close, slowLength)
These two HMAs act as dynamic trend indicators:
- A bullish crossover of fast over slow HMA signals a potential long setup.
- A bearish crossunder triggers short interest.
⚡️ Curvature (Acceleration Filter)
- curv = ta.change(ta.change(fastHMA))
This calculates the second-order change (akin to the second derivative) of the fast HMA — effectively the acceleration of the trend. It serves as a filter:
- For long entries: curv > curvThresh (positive acceleration)
- For short entries: curv < -curvThresh (negative acceleration)
It helps eliminate weak or stagnating moves by requiring momentum behind the crossover.
📈 Volatility-Based Risk Management (ATR)
- atr = ta.atr(atrLength)
- stopLoss = atr * atrMult
- trailStop = atr * trailMult
These define your:
- Initial stop loss: scaled to recent volatility using ATR and atrMult.
- Trailing stop: also ATR-scaled, to lock in gains dynamically as price moves favorably.
💰 Position Sizing via Risk Percent
- capital = strategy.equity
- riskCapital = capital * (riskPercent / 100)
- qty = riskCapital / stopLoss
This dynamically calculates the position size (qty) such that if the stop loss is hit, the loss does not exceed the predefined percentage of account equity. It’s a volatility-adjusted position sizing method, keeping your risk consistent regardless of market conditions.
📌 Execution Logic
- Long Entry: on bullish HMA crossover with rising curvature.
- Short Entry: on bearish crossover with falling curvature.
- Exits: use ATR-based trailing stops.
- Position is closed when trend conditions reverse (e.g., bearish crossover exits the long).
This framework gives you:
- Trend-following logic (via HMAs)
- Momentum confirmation (via curvature)
- Volatility-aware execution and exits (via ATR)
- Risk-controlled dynamic sizing
Want to get surgical and test what happens if we use curvature on the difference between HMAs instead? That might give some cool insights into trend strength transitions.
Global Risk Matrix [QuantAlgo]🟢 Overview
The Global Risk Matrix is a comprehensive macro risk assessment tool that aggregates multiple global financial indicators into a unified risk sentiment framework. It transforms diverse economic data streams (from currency strength and liquidity measures to volatility indices and commodity prices) into standardized Z-Score readings to identify market regime shifts across risk-on and risk-off conditions.
The indicator displays both a risk oscillator showing weighted average sentiment and a dynamic 2D matrix visualization that plots signal strength against momentum to reveal current market phase and historical evolution. This helps traders and investors understand broad market conditions, identify regime transitions, and align their strategies with prevailing macro risk environments across all asset classes.
🟢 How It Works
The indicator employs Z-Score normalization across various global macro components, each representing distinct aspects of market liquidity, sentiment, and economic health. Raw data from sources like DXY, S&P 500, Fed liquidity, global M2 money supply, VIX, and commodities undergoes statistical standardization. Several components are inverted (USDT.D, DXY, VIX, credit spreads, treasury bonds, gold) to align with risk-on interpretation, where positive values indicate bullish conditions.
This unique system applies configurable weights to each component based on selected asset class presets (Crypto Investor/Trader, Stock Trader, Commodity Trader, Forex Trader, Risk Parity, or Custom), creating a weighted average Z-Score. It then analyzes both signal strength and momentum direction to classify market conditions into four distinct phases: Risk-On (positive signal, rising momentum), Risk-Off (negative signal, falling momentum), Recovery (negative signal, rising momentum), and Weakening (positive signal, falling momentum). The 2D matrix visualization plots these dimensions with historical trail tracking to show regime evolution over time.
🟢 How to Use
1. Risk Oscillator Interpretation and Phase Analysis
Positive Territory (Above Zero) : Indicates risk-on conditions with capital flowing toward growth assets and higher risk tolerance
Negative Territory (Below Zero) : Signals risk-off sentiment with capital seeking safety and defensive positioning
Extreme Levels (±2.0) : Represent statistically significant deviations that often precede regime reversals or trend exhaustion
Zero Line Crosses : Mark critical transitions between risk regimes, providing early signals for portfolio rebalancing
Phase Color Coding : Green (Risk-On), Red (Risk-Off), Blue (Recovery), Yellow (Weakening) for immediate regime identification
2. Risk Matrix Visualization and Trail Analysis
Current Position Marker (⌾) : Shows real-time location in the risk/momentum space for immediate situational awareness
Historical Trail : Connected path showing recent market evolution and regime transition patterns
Quadrant Analysis : Risk-On (upper right), Risk-Off (lower left), Recovery (lower right), Weakening (upper left)
Trail Patterns : Clockwise rotation typically indicates healthy regime cycles, while erratic movement suggests uncertainty
3. Pro Tips for Trading and Investing
→ Portfolio Allocation Filter : Use Risk-On phases to increase exposure to growth assets, small caps, and emerging markets while reducing defensive positions during confirmed green phases
→ Entry Timing Enhancement : Combine Recovery phase signals with your technical analysis for optimal long entry points when macro headwinds are clearing but prices haven't fully recovered
→ Risk Management Overlay : Treat Weakening phase transitions as early warning systems to tighten stop losses, reduce position sizes, or hedge existing positions before full Risk-Off conditions develop
→ Sector Rotation Strategy : During Risk-On periods, favor cyclical sectors (technology, consumer discretionary, financials) while Risk-Off phases favor defensive sectors (utilities, consumer staples, healthcare)
→ Multi-Timeframe Confluence : Use daily matrix readings for strategic positioning while applying your regular technical analysis on lower timeframes for precise entry and exit execution
→ Divergence Detection : Watch for situations where your asset shows bullish technical patterns while the matrix shows Risk-Off conditions—these often provide the highest probability short opportunities and vice versa
Opening Range Breakout (ORB) with Fib RetracementOverview
“ORB with Fib Retracement” is a Pine Script indicator that anchors a full Fibonacci framework to the first minutes of the trading day (the opening-range breakout, or ORB).
After the ORB window closes the script:
Locks-in that session’s high and low.
Calculates a complete ladder of Fibonacci retracement levels between them (0 → 100 %).
Projects symmetric extension levels above and below the range (±1.618, ±2.618, ±3.618, ±4.618 by default).
Sub-divides every extension slice with additional 23.6 %, 38.2 %, 50 %, 61.8 % and 78.6 % mid-lines so each “zone” has its own inner fib grid.
Plots the whole structure and—optionally—extends every line into the future for ongoing reference.
**Session time / timezone** – Defines the ORB window (defaults 09:30–09:45 EST).
**Show All Fib Levels** – Toggles every retracement and extension line on or off.
**Show Extended Lines** – Draws dotted, extend-right projections of every level.
**Color group** – Assigns colors to buy-side (green), sell-side (red), and internal fibs (gray).
**Extension value inputs** – Allows custom +/- 1.618 to 4.618 fib levels for personalized projection zones.
Quarterly Cycles [EETrade]The idea of Quarterly Theory is -
Each timeframe is split into 4 "quarters", derived based on logical subdivisions:
- Year: Divided into calendar quarters (Jan-Mar, Apr-Jun, etc.).
- Tertiary (sub-year): Each year quarter is subdivided into 4 parts dynamically based on timestamp deltas.
- Month: Weekly-based logic using Sunday cutoffs and session switch time (18:00 US/Eastern).
- Week: Divided using daily boundaries starting from Sunday 18:00 (based on US futures session logic).
- Day: Split into 4 blocks (Asia, London, AM, PM) using 6-hour segments.
- Session and Macro Quarters: Session is divided further into 4 quarters of 6 hours, then each of those into 15-minute blocks for ultra-granular cycle mapping.
Where we split them into Q1, Q2, Q3 and Q4.
Usually we address
Q1 as accumulation,
Q2 as manipulation
Q3 as Distribution
Q4 as Continuation/Reversal
If we trade Q3 for example, we'd like to use price action mainly from previous Q3s.
Plus there are Semi Cycles which we can utilize
- Q1 with Q3
- Q2 with Q4
- Q3 with Q1
- Q4 with Q2
So we can also use Q1 price action when we are trading Q3
True Open Logic:
The open candle price of the second quarter is the true open for us, it will help us understand if we're on premium or discount area.
Plus this indicator providers a table to dynamically show the premium and discount
We can use this indicator to understand optimal times to trade as we'd like to trade mostly Q3
Previous 2 Days High/LowCan you give me a summary of this indicator
The "Previous 2 Days High/Low" indicator, written in Pine Script v5 for TradingView, plots horizontal lines representing the combined high and low prices of the previous two trading days on a chart. Here's a summary of its functionality, purpose, and key features:
Purpose
The indicator helps traders identify significant price levels by displaying the highest high and lowest low from the previous two days, which can act as potential support or resistance levels. These levels are plotted as lines that extend across the current trading day, making it easier to visualize key price zones for trading decisions.
Key Features
Calculates Combined High and Low:
Retrieves the high and low prices of the previous day and the day before using request.security on the daily timeframe ("D").
Computes the combined high as the maximum of the two days' highs and the combined low as the minimum of the two days' lows.
Dynamic Line Plotting:
Draws two horizontal lines:
Red Line: Represents the combined high, plotted at the highest price of the previous two days.
Green Line: Represents the combined low, plotted at the lowest price of the previous two days.
Lines are created at the start of a new trading day and extended to the right edge of the chart using line.set_x2, ensuring they span the entire current day.
Labels for Clarity:
Adds labels to the right of the chart, displaying the exact price values of the combined high ("Combined High: ") and combined low ("Combined Low: ").
Labels are updated to move with the lines, maintaining alignment at the current bar.
Clutter Prevention:
Deletes old lines and labels at the start of each new trading day to avoid overlapping or excessive objects on the chart.
Dynamic Requests:
Uses dynamic_requests=true in the indicator() function to allow request.security calls within conditional blocks (if ta.change(time("D"))), enabling daily data retrieval within the script's logic.
First Candle🕯️ First Candle Indicator (First 5-Minute Candle High/Low)
The First Candle indicator automatically marks the high and low of the first 5-minute candle of the U.S. trading session . These levels can act as key intraday support and resistance zones, often used in breakout, scalping, or opening-range trading strategies.
📌 Key Features:
Automatic detection of the first candle of the U.S. session based on the selected timeframe (default is 5 minutes).
Horizontal lines are plotted at the high and low of that candle, with fully customizable colors and thickness.
Labels show the exact level and timeframe used for the high and low.
Resets daily, removing previous session data at the start of a new session.
Displays a visual marker (blue triangle) when the first candle is detected.
Allows users to select different timeframes for defining the "first candle" (e.g., 1, 5, 15 minutes).
⚙️ Customizable Inputs:
Show First Candle Lines: toggle the display of high/low lines.
Timeframe for Marking: choose the timeframe to detect the first candle (e.g., 5 minutes).
High Line Color / Low Line Color: set the color of each level line.
Line Thickness: adjust the width of the lines (1 to 5 pixels).
🧠 Strategic Applications:
Identify breakout zones right after the market opens.
Define opening range for pullback or continuation setups.
Set clear reference levels for intraday trading decisions.
Predictive Time & AlertsPredictive Time Engine (ICT Macros)
Summary
The Predictive Time Engine is a visual tool designed specifically for traders who utilize Time & Price based methodologies, particularly those inspired by ICT (Inner Circle Trader) concepts.
The primary purpose of this indicator is to visualize the critical "time windows" where market liquidity is most likely to be significantly manipulated or distributed. Instead of only appearing in real-time, this indicator is predictive: at the beginning of each day, it will automatically calculate and draw all selected macro sessions for the day ahead, serving as your daily time roadmap.
With this tool, you will no longer miss these crucial moments and can be better prepared to anticipate price action.
Key Features
Predictive Visualization: Automatically projects and draws all macro time windows for the current trading day, giving you a forward-looking view of where the action is likely to occur.
ICT Macro Time Filter: Based on the "Hourly-Macros" concept, which are specific 20-minute periods within each hour (e.g., 09:50 - 10:10) where the price delivery algorithm (IPDA) is often active. You can select and enable each macro window you wish to monitor.
Full Customization: You have complete control over how the information is displayed. Choose between:
Outline: A clean, transparent box frame.
Background: A solid, colored background for the time zone.
Vertical Lines (Dotted, Dashed, Solid): Marks the beginning of each macro session with a vertical line in your chosen style.
Real-time Alerts: Set up notifications in TradingView to get an alert precisely when the price enters one of your selected Macro Time windows.
Automatic Management: Drawings from previous days are automatically cleared to keep your chart clean and focused on the current day's schedule.
The Concept Behind the Indicator
This indicator is inspired by the concept that the market moves in fractal Time Cycles, from yearly down to 90-minute periods. Each of these time cycles often follows a pattern of AMD (Accumulation, Manipulation, Distribution).
Accumulation: A phase of order gathering.
Manipulation: Price is often driven in the opposite direction of its true intent to sweep liquidity (stop losses).
Distribution: The true price move towards a liquidity target (Draw On Liquidity).
The Macro Time windows marked by this indicator are often the stage where the Manipulation phase or the beginning of the Distribution phase occurs. By knowing when these times are approaching, traders can be on high alert and look for confirming trade setups in the most potent areas and times.
How to Use
Configure Sessions: Open the indicator's Settings.
In the "1. General Settings" tab, ensure the Timezone matches your chart's local time (Default: "America/New_York").
In the "2. Active Macro Sessions" tab, check the box for each macro time window you want to monitor.
Choose Display Style: In "General Settings", select your preferred "Display Style" (Outline, Background, or various Line types). You can also change the color.
Set Up Alerts (Optional):
Click the "Alert" clock icon in the TradingView toolbar.
In the "Condition" section, select this indicator: Predictive Time Engine.
From the dropdown below it, ensure "Sesi Makro Dimulai" (Macro Session Start) is selected.
Set your desired notification options and click "Create".
Chart Interpretation: Use the marked time zones as high-alert areas. Pay close attention to how price reacts when entering or leaving these zones to find potential entry opportunities that align with your trading strategy.
Disclaimer: This tool is provided for educational and analytical purposes only. It is not financial advice. All trading decisions are solely your responsibility. Conduct your own research and manage your risk appropriately.
Altcoins vs Stablecoins (with signals)This indicator visualizes the ratio of altcoin market dominance (excluding the top 10) to the combined dominance of the two largest stablecoins (USDT + USDC).
📊 Formula:
OTHERS.D / (USDT.D + USDC.D)
🔍 Purpose:
Rising values indicate increasing capital flow into altcoins — a potential altseason signal
Falling values suggest capital rotation into stablecoins — risk-off behavior
🟢 Bullish Signal:
When the ratio crosses above 1.3, a green arrow appears — signaling possible altcoin momentum
🔴 Bearish Signal:
When the ratio crosses below 0.9, a red arrow appears — signaling capital flight into stablecoins
✅ Useful for:
Timing market phases
Spotting early altseason entries
Portfolio rotation and risk monitoring
200 SMA + VWAP + Manual ADX Entry Signal200 SMA + VWAP + Manual ADX Entry Signal – Indicator Description
This custom indicator is designed for trend-following intraday traders who want a powerful, rules-based entry confirmation system. It combines three proven tools—the 200-period Simple Moving Average (SMA), Volume-Weighted Average Price (VWAP), and a manually coded ADX (Average Directional Index)—to identify high-probability long entries in strong, directional markets.
By filtering trades through a combination of trend direction, mean-reversion reference, and momentum strength, this indicator helps traders avoid false breakouts, whipsaws, and low-quality setups. It’s particularly well-suited for traders using 15-minute charts, leveraged ETFs, or high-beta stocks, where precision entries and trend confirmation are critical to consistent profitability.
⸻
✅ What This Indicator Does
This indicator visually displays:
• The 200-period SMA (orange line) – a long-term trend filter.
• The VWAP (blue line) – a dynamic intraday price average used by institutions.
• A buy signal triangle below the price bar – when all bullish criteria are met.
• It also includes an alert condition so traders can be notified when a new buy signal appears in real time.
Behind the scenes, the indicator calculates trend and strength conditions and plots a BUY signal only when all three tools agree that a bullish move is in play.
⸻
🔍 The Three-Pillar Entry System
1. 200 SMA Filter – Defining Market Bias
The 200 SMA is a widely used institutional benchmark that represents long-term trend direction. In this indicator:
• A trade is only considered valid if price is above the 200 SMA.
• This helps eliminate trades in downtrending or range-bound markets.
• It ensures that entries are aligned with broader directional bias.
By filtering out trades below the 200 SMA, you instantly remove a majority of low-probability setups and whipsaw environments.
⸻
2. VWAP – Institutional Mean Price Anchor
VWAP (Volume-Weighted Average Price) is often used by hedge funds and algorithmic systems to judge whether price is considered “expensive” or “cheap” within a given trading session.
• This version of VWAP is anchored to the current intraday session.
• Trades are only considered valid if price is above the VWAP, which shows market consensus is favoring the upside.
• VWAP provides both confirmation and support levels, helping ensure your entry isn’t into overextended territory.
By combining the 200 SMA and VWAP filters, the indicator ensures that trades are only taken when price is strong on both the macro and micro timeframes.
⸻
3. ADX – Confirming Momentum Strength
ADX (Average Directional Index) is used to measure trend strength without regard to direction. However, TradingView has limited functionality with the ta.adx() call in some environments, so this script includes a custom-coded version of ADX that follows standard Wilder’s smoothing and directional movement logic.
• A BUY signal only triggers if ADX is above a user-defined threshold (default is 20) and rising from the previous bar.
• This means not only is the market trending — but the trend is strengthening.
This final filter prevents entries in chop or decaying rallies, and ensures you’re catching the strongest part of a move, not the tail end.
⸻
⚙️ Logic Summary
A BUY signal is plotted when:
• Price > 200 SMA ✅
• Price > VWAP ✅
• ADX > 20 and rising ✅
Only when all three conditions are true does the indicator plot a green triangle below the price bar.
This visual simplicity makes it ideal for fast trade decisions, and the alert function allows hands-free monitoring during busy sessions.
⸻
🧠 Recommended Use
This indicator works best on:
• 15-minute to 1-hour charts
• Intraday leveraged ETFs (e.g., TQQQ, SPYU, SQQQ)
• Trend-following strategies
• Breakout continuation trades
⸻
📉 Limitations
• This is a long-only system by design. If you want to trade short, you’ll need to invert the logic (e.g., price < 200 SMA, price < VWAP, ADX > threshold).
• It doesn’t generate exit signals. You should pair this with your own take-profit or trailing stop strategy.
• While it works great for momentum entries, it may underperform in range-bound or news-driven chop markets.
⸻
🛠️ Settings Customization
• SMA Length: default is 200; adjust for faster or slower trend confirmation.
• ADX Length: default is 14; shorter periods = more sensitive, longer = smoother.
• ADX Threshold: default is 20; raise to 25 or 30 to only catch very strong moves.
These settings give you flexibility to match the indicator to your trading style.
⸻
🚀 Final Thoughts
The 200 SMA + VWAP + Manual ADX Entry Signal is a battle-tested, rule-based tool to help you:
• Enter only when the trend, mean, and momentum align
• Avoid fakeouts and poor risk-reward entries
• Automate part of your setup process without overcomplication
This is the kind of filter used by professional traders to reduce screen time and improve trade quality. If you’re looking to build confidence in your intraday trading with clear, logical entries — this indicator will help you stay consistent and systematic.
Happy trading!
Breakouts with Trailing Stops V6 + AlertsBreakouts with Trailing Stops in Trading
Breakout trading is a strategy where traders aim to profit from an asset's price moving outside a defined support or resistance level, signaling a potential new trend. Trailing stops are a key risk management tool often used with breakouts to protect profits and limit potential losses.
What is a breakout?
A breakout occurs when an asset's price moves decisively above a resistance level (for a bullish breakout) or below a support level (for a bearish breakdown). This often signals increased momentum and potential for a significant price movement in the direction of the breakout.
Why use trailing stops with breakouts?
Trailing stops are particularly useful in breakout trading because they allow traders to capture potential profits as the price moves in their favor, while automatically adjusting to protect against sudden reversals.
How do trailing stops work with breakouts?
Initial Stop-Loss: When entering a breakout trade, a traditional stop-loss order is placed at a predetermined level to limit potential losses if the price reverses. For example, in a long position after a resistance breakout, the initial stop-loss might be placed below the former resistance level (which can now act as support).
Trailing Stop Activation: Once the price moves a favorable distance beyond the entry point, the trailing stop loss is activated. As highlighted by StoneX, it is a dynamic order that follows the price as it continues to move in the desired direction, maintaining a set distance below (for a long position) or above (for a short position) the current market price.
Profit Locking: If the price continues to rise (or fall for a short position), the trailing stop will move with it, "locking in" profits by raising the stop-loss level.
Exit Strategy: If the price reverses and hits the trailing stop, the position is automatically closed, ensuring that the trader retains a portion of the gains made while in the trade.
Advantages of using trailing stops with breakouts:
Locks in profits: Trailing stops help protect profits generated from successful breakout trades.
Automates exits: They automate the exit process, helping traders avoid emotional decision-making when the price reverses.
Allows for potential gains: They allow traders to stay in profitable trades as long as the trend continues.
Disadvantages of using trailing stops with breakouts:
Whipsaw risk: In volatile markets, the trailing stop may be triggered prematurely by minor price fluctuations.
Potential for missed gains: If the trailing stop is set too tightly, it may prevent the trader from capturing the maximum potential gains if the price experiences a minor pullback before continuing in the desired direction.
Tips for using trailing stops with breakouts:
Consider the asset's volatility: Adjust the trailing stop distance based on the asset's volatility to minimize the risk of premature stops.
Test different trailing stop methods: Experiment with different trailing stop methods to find what works best for your trading style and the specific asset you are trading.
Backtest your strategy: Before applying a trailing stop strategy to live trading, backtest it on historical data to evaluate its performance under different market conditions.
Combine with other indicators: Use other technical indicators, such as volume or momentum oscillators, to confirm the validity of breakouts and improve the effectiveness of your trailing stop strategy.
By carefully considering the market dynamics, using appropriate indicators, and implementing proper risk management techniques, traders can effectively utilize trailing stops with breakouts to capture potential profits while minimizing risk.
Have a good trade.
LANZ Strategy 1.0 [Backtest]🔷 LANZ Strategy 1.0 — Time-Based Session Trading with Smart Reversal Logic and Risk-Controlled Limit Orders
This backtest version of LANZ Strategy 1.0 brings precision to session-based trading by using directional confirmation, pre-defined risk parameters, and limit orders that execute overnight. Designed for the 1-hour timeframe, it allows traders to evaluate the system with configurable SL, TP, and risk settings in a fully automated environment.
🧠 Core Strategy Logic:
1. Directional Confirmation at 18:00 NY:
At 18:00 NY, the system compares the 08:00 open vs the 18:00 close:
If the direction matches the previous day, the signal is reversed.
If the direction differs, the current day's trend is kept.
This logic is designed to avoid momentum exhaustion and capture corrective reversals.
2. Entry Level Definition:
Based on the confirmed direction:
For BUY, the Low of the day is used as Entry Point (EP).
For SELL, the High of the day becomes EP.
The system plots a Stop Loss and Take Profit based on user-defined pip inputs (default: SL = 18 pips, TP = 54 pips → RR 1:3).
3. Time-Limited Entry Execution (LIMIT Orders):
Orders are sent after 18:00 NY and can be triggered anytime between 18:00 and 08:00 NY.
If EP is not touched before 08:00, the order is automatically cancelled.
4. Manual Close Feature:
If the trade is still open at the configured hour (default 09:00 NY), the system closes all positions, simulating realistic intraday exit scenarios.
5. Lot Size Calculation Based on Risk:
Lot size is dynamically calculated using the account size, risk percentage, and SL distance.
This ensures consistent risk exposure regardless of market volatility.
⚙️ Step-by-Step Flow:
08:00 NY → Captures the open of the day.
18:00 NY → Confirms direction and defines EP, SL, and TP.
After 18:00 NY → If conditions are met, a LIMIT order is placed at EP.
Between 18:00–08:00 NY → If price touches EP, the trade is executed.
At 08:00 NY → If EP wasn’t touched, the order is cancelled.
At Configured Manual Close Time (default 09:00 NY) → All open positions are force-closed if still active.
🧪 Backtest Settings:
Timeframe: 1-hour only
Order Type: strategy.entry() with limit=
SL/TP Configurable: Yes, in pips
Risk Input: % of capital per trade
Manual Close Time: Fully adjustable (default 09:00 NY)
👨💻 Credits:
Developed by LANZ
Strategy logic and trading concept built with clarity and precision.
Code structure and documentation by Kairos, your AI trading assistant.
Designed for high-confidence execution and clean backtesting performance.
LANZ Strategy 1.0🔷 LANZ Strategy 1.0 — Session-Based Directional Logic with Visual Multi-Account Risk Management
LANZ Strategy 1.0 is a structured and disciplined trading strategy designed for the 1-hour timeframe, operating during the NY session and executing trades overnight. It uses the directional behavior between 08:00 and 18:00 New York time to define precise limit entries for the following night. Ideal for traders who prefer time-based execution, clear visuals, and professional risk management across multiple accounts.
🧠 Core Components:
1. Session Direction Confirmation:
At 18:00 NY, the system evaluates the market direction by comparing the open at 08:00 vs the close at 18:00:
If the direction matches the previous day, it is reversed.
If it differs, the current day’s direction is kept.
This logic is designed to avoid trend exhaustion and favor potential reversal opportunities.
2. EP Level & Risk Definition:
Once direction is defined:
For BUY, EP is set at the Low of the session.
For SELL, EP is set at the High of the session.
The system automatically plots:
SL fixed at 18 pips from EP
TP at 3.00× the risk → 54 pips from EP
All levels (EP, SL, TP) are shown with visual lines and price labels.
3. Time-Restricted Entry Execution:
The entry is only valid if price touches the EP between 19:00 and 08:00 NY.
If EP is not touched before 08:00 NY, the trade is automatically cancelled.
4. Multi-Account Lot Sizing:
Traders can configure up to five different accounts, each with its own capital and risk percentage.
The system calculates and displays the lot size per account, based on SL distance and pip value, in a dynamic floating label.
5. Outcome Tracking:
If TP is hit, a +3.00% profit label is displayed along with a congratulatory alert.
If SL is hit, a -1.00% label appears with a loss alert.
If the trade is still open by 09:00 NY, it is manually closed, and the result is shown as a percentage of the initial risk.
📊 Visual Features:
Custom-colored angle and guide lines.
Dynamic angle line starts at 08:00 NY and tracks price until 18:00.
Shaded backgrounds for key time zones (e.g., 08:00, 18:00, 19:00).
BUY/SELL signals shown at 19:00 based on match/divergence logic.
Label panel showing risk metrics and lot size for each active account.
⚙️ How It Works:
08:00 NY: Marks the session open and initiates a dynamic angle line.
18:00 NY: Evaluates the session direction and calculates EP/SL/TP based on outcome.
19:00 NY: Activates limit order monitoring.
During the night (until 08:00 NY): If EP is touched, the trade is triggered.
At 08:00 NY: If no touch occurred, trade is cancelled.
Overnight: TP/SL logic is enforced, showing percentage outcomes.
At 09:00 NY: If still open, trade is closed manually and result is labeled visually.
🔔 Alerts:
🚀 EP execution alert when touched
💢 Stop Loss hit alert
⚡ Take Profit hit alert
✅ Manual close at 09:00 NY with performance result
🔔 Daily reminder at 19:00 NY to configure and prepare the trade
📝 Notes:
Strategy is exclusive to the 1-hour timeframe.
Works best on assets with clean NY session movement.
Perfect for structured, semi-automated swing/overnight trading styles.
Fully visual, self-explanatory, and backtest-friendly.
👨💻 Credits:
Developed by LANZ
A strategy created with precision, discipline, and a vision for traders who value time-based entries, clean execution logic, and visual confidence on the chart.
Special thanks to Kairos — your AI assistant — for the detailed structure, scripting, and documentation of the strategy.
Price-EMA Z-Score Backgroundhe “Price‑to‑EMA Z‑Score Background” indicator is designed to give you a clear, visual sense of when price has moved unusually far away from its smoothed trend, and to highlight those moments as potential overextension or mean‑reversion opportunities. Under the hood, it first computes a standard exponential moving average (EMA) of your chosen lookback length, then measures the raw difference between the current close and that EMA on every bar. To make that raw deviation comparable across different markets and timeframes, it converts the series of differences into a z‑score—subtracting the rolling mean of the deviations and dividing by their rolling standard deviation over a second lookback window.
Once you’ve normalized price‑to‑EMA distance into z‑score units, you can set two simple trigger levels: one upper threshold and one lower threshold. Whenever the z‑score climbs above the upper threshold, the chart background glows green, signaling that price is extended far above its EMA (and might be ripe for a pullback). Whenever the z‑score falls below the lower threshold, the background turns red, calling out an equally extreme move below the EMA (and a possible oversold bounce). Between those bands, no shading appears, letting you know price is trading within its “normal” range around the trend.
By adjusting the EMA period, the z‑score lookback, and the two trigger levels, you can dial in early warning signals (e.g. ±1 σ) or wait for very stretched moves (±2 σ or more). Used in concert with your favorite momentum or pattern tools—or even as a standalone visual cue—this simple background‑shading approach makes it easy to spot when a market is running too hot or too cold relative to its own recent average.
Yield Curve Regime Shading with LegendTakes two symbols (e.g. two futures contracts, two FX pairs, etc.) as inputs.
Calculates the “regime” as the sign of the change in their difference over an n‑period lookback.
Lets you choose whether you want to color the bars themselves or shade the background.
How it works
Inputs
symbolA, symbolB: the two tickers you’re comparing.
n: lookback in bars to measure the change in the spread.
mode: pick between “Shading” or “Candle Color”.
Data fetching
We use request.security() to pull each series at the chart’s timeframe.
Regime calculation
spread = priceA – priceB
spreadPrev = ta.valuewhen(not na(spread), spread , 0) (i.e. the spread n bars ago)
If spread > spreadPrev → bullish regime
If spread < spreadPrev → bearish regime
Plotting
Shading: apply bgcolor() in green/red.
Candle Color: use barcolor() to override the bar color.
BTC Transaction Indicator Name: "Bitcoin On-Chain Volume & Dynamic Parabolic Curve Signals"
Purpose:
This indicator is designed for Bitcoin traders and long-term holders. It combines the analysis of Bitcoin's on-chain transaction volume with price action to generate "Whale" and "Bear" signals. Additionally, it features a unique dynamic parabolic curve that acts as a visual support line, adapting its visibility based on price interaction with a key Exponential Moving Average (EMA).
Key Components:
On-Chain Volume Analysis:
Utilizes Estimated Transaction Volume (ETRAV) data from the Bitcoin blockchain.
Calculates fast and slow Simple Moving Averages (SMAs) of this volume.
Identifies volume trends (up/down) and significant volume increases/decreases.
Employs fixed thresholds (2,500,000 for low volume and 25,000,000 for high volume) to define key activity levels, similar to how historical on-chain analysis defined accumulation and distribution zones.
Price Action Analysis:
Calculates fast and slow SMAs of the price.
Detects price trends (up/down), recoveries, and declines based on these price SMAs.
"Whale" and "Bear" Signals:
Whale Signals (Buy-side): Generated when there's an upward volume trend, significant volume increase, and a downward price trend followed by price recovery. These indicate potential accumulation phases.
Bear Signals (Sell-side): Generated when there's a downward volume trend, significant volume decrease, and an upward price trend followed by price decline. These indicate potential distribution phases.
Visuals: Both types of signals are plotted as small, colored circles directly on the price chart, with corresponding text labels ("Whale," "Buy," "Bear," "Sell," "Price Recovering," "Price Declining").
Dynamic Parabolic Curve:
Concept: A green parabolic (exponential) curve that serves as a dynamic visual support line.
Activation: The curve starts drawing automatically only when the price crosses over the EMA 500 (Exponential Moving Average of 500 periods). The curve's starting point is set at a user-defined percentage below the EMA 500 value at that exact crossover point.
Visibility: The curve remains visible and continues its trajectory only as long as the price stays above the EMA 500.
Deactivation: The curve disappears instantly if the price falls below or equals the EMA 500. It will only reappear if the price crosses above the EMA 500 again.
Customization: The curve's steepness (Tasa Crecimiento Curva) and its initial distance from the EMA 500 (Inicio Curva % por debajo de EMA500) are adjustable.
Dynamic Label: A "Parabólico" text label is plotted near the center of the active curve segment, with an adjustable vertical offset to ensure it stays visually appealing below the curve.
What is PLOTTED on the chart:
The small, colored circle signals for Whale/Buy and Bear/Sell activity.
The green dynamic parabolic curve.
What is NOT PLOTTED:
EMA 200, EMA 500 lines (though they are calculated internally for logic).
Raw volume data or volume Moving Averages (these are only used for signal calculation, not plotted).
Ideal for:
Bitcoin traders and investors focused on long-term trends and cycle analysis, who want visual cues for accumulation/distribution phases based on on-chain activity, complemented by a unique, dynamically appearing parabolic support curve.
Important Notes:
Relies on the availability of external on-chain data (QUANDL:BCHAIN) within TradingView.
Functions best on a daily timeframe for optimal on-chain data relevance.