Sterke Trendwissel SignalenOverview
The indicator combines three technical analysis tools to generate strong buy and sell signals:
Moving Averages (MA): Short-term (9-period) and long-term (21-period) simple moving averages.
Relative Strength Index (RSI): A 14-period RSI to measure overbought and oversold conditions.
Volume: A volume multiplier (1.2x) compared to the average volume over 20 periods.
Signals
The indicator generates two types of signals:
Strong Buy: When the short-term MA crosses above the long-term MA (bullish crossover), the relative volume is above the threshold (1.2x average), and the RSI is oversold (< 30).
Strong Sell: When the short-term MA crosses below the long-term MA (bearish crossover), the relative volume is above the threshold (1.2x average), and the RSI is overbought (> 70).
Visualizations
The indicator plots:
The short-term MA (blue line)
The long-term MA (orange line)
"STRONG BUY" labels (green) below the bar when a strong buy signal is generated
"STRONG SELL" labels (red) above the bar when a strong sell signal is generated
Alerts
The indicator sets up alerts for strong buy and sell signals, which can be configured in TradingView's alert system.
In summary, this indicator aims to identify strong trend changes by combining moving average crossovers, high volume, and RSI overbought/oversold conditions.
指標和策略
HTF 3rd Weekly High/LowThis indicator plots horizontal lines for the high and low of a selected past weekly candle, allowing traders to visualize higher time frame (HTF) structure on lower time frame charts (e.g., 1H, 4H, etc.).
Features:
Custom Weekly Range Selection: Use the dropdown to choose which weekly candle to reference — from the current week (0) to up to five weeks back.
Clean Horizontal Lines: High and low levels of the selected week are drawn as persistent horizontal lines.
Automatic Text Labels: Labels like Week-3H and Week-3L are shown on the right side of the chart, matching the week selected.
Customization:
Line colors
Line width and style (solid, dotted, dashed)
Text label offset
Automatic Refresh: Levels and labels are redrawn at the start of each new week to stay current with your selection.
Gold $15 Trend Continuation Alert🔔 Gold $15 Trend Continuation Alert (EMA Filtered)
This script helps identify high-probability trend continuation setups on XAUUSD (Gold), using price action + EMA confluence.
🔹 Logic:
Detects a $15+ directional move in the past hour
Confirms shallow pullback (<33%)
Price must align with EMA13, EMA50, and EMA200 in the same direction
Plots a single BUY (green label) or SELL (red label) alert only once per move
Includes visual EMA overlay
✅ Buy Conditions:
Price has risen $15 from local low
Pullback is shallow
Price is above all 3 EMAs
✅ Sell Conditions:
Price has dropped $15 from local high
Pullback is shallow
Price is below all 3 EMAs
Use this with caution on volatile news days. Best suited during trending London/NY sessions.
EMA20-EMA50 DifferenceThe indicator shows whether the EMA20 is above or below the EMA50.
If the curve is above the zero line, the EMA20 is above the EMA50.
If the curve is below the zero line, the EMA20 is below the EMA50.
The greater the distance from the zero line is, the further apart the EMA20 and EMA50 are.
Candle Color Counter with Date RangeThis will allow you to check the number of specific red or green candles within a certain time frame
Andean Pulse Oscillator [APO] Andean Pulse Oscillator (APO)
The Andean Pulse Oscillator (APO) is a momentum-based technical indicator designed to detect early shifts in bullish and bearish pressure using adaptive exponential envelopes. Inspired by the original Andean Oscillator concept, this upgraded version maintains the spirit of the tool while improving clarity, responsiveness, and usability.
🧠 Key Features:
Two core components:
🔹 Bullish Component (green) – Measures strength of downward volatility (bullish momentum).
🔻 Bearish Component (red) – Measures strength of upward volatility (bearish momentum).
A Signal Line (orange) smooths the dominant component to help filter out noise.
Background shading provides at-a-glance trend bias: green for bullish dominance, red for bearish.
Optional Buy/Sell Signal Arrows when bullish and bearish lines cross.
⚙️ Inputs:
Length – Controls smoothing sensitivity of the envelope-based momentum calculation.
Signal Length – Controls smoothing of the dominant component (signal line).
Show Buy/Sell Signals – Toggle crossover arrows on or off.
🔍 Usage Tips:
Look for bullish crossovers (green crosses above red) below the zero-line during corrections for potential long setups.
Look for bearish crossunders (red crosses above green) near tops for potential short setups.
Can be combined with price structure, trend filters, or divergence analysis for added confirmation.
👨🎨 Credit:
Originally conceptualized by @Andean, the APO version enhances it with modern visuals, cleaner signals, and modular structure — a tribute to a powerful and underutilized oscillator.
Smart Session ConceptSmart Session Concept — Intelligent Trading Session Overlay
Smart Session Concept is designed to detect major reversal points and key price pivots formed on higher timeframes, particularly during high-volume periods of the day — often marking the footprints of institutional orders and whales.
🔍 Key Features:
Displays standard sessions (Asian, London, New York) and allows adding custom time sessions.
Offers two visualization modes:
Time session table
Visual session boxes plotted on the chart
Auto-sync with seasonal time changes (Summer/Winter), supports Daylight Saving Time (DST)
Full flexibility:
Toggle table, boxes, and labels on/off
Customize colors for all session elements
Choose which months are considered summer/winter
💡 Suggested Use Case:
Use Smart Session Sync to pinpoint critical price structures such as:
Peaks and troughs of trending waves
Highs/lows in Wyckoff trading ranges
Liquidity sweeps or untouched liquidity zones
----------------------
AlphaFlow: Oscillator PanelAlphaFlow: Oscillator Panel
The AlphaFlow: Oscillator Panel indicator is a versatile multi-tool designed to provide a comprehensive view of momentum, volatility, and trend strength across different timeframes. This script combines several popular technical analysis tools into a single dashboard for faster decision-making.
Key Features:
WaveTrend Oscillator (WT1 and WT2): Tracks price momentum to help identify potential reversals or trend continuations.
RSI and BBWP : Measures relative strength and volatility compression/expansion.
VWAP-MACD and OBV : Includes volume-based momentum insights and higher timeframe confirmations.
Multi-Timeframe Confluence : Highlights if various oscillators align across multiple timeframes.
Dynamic Table : A dashboard that updates in real time, providing numeric values and playful narratives for easier reading.
Configurable Text Size : Customize the table’s text size for better visibility.
Anchor, Trigger, Snake Eye Labels : These markers appear when WT1 crosses significant thresholds:
Anchor (A): Marks a potential base or bottoming signal.
Trigger (T): Confirms a potential momentum reversal.
Snake Eyes: Indicates particularly strong or rare reversal conditions.
How to Use:
Load the indicator on your chart.
Adjust input parameters like RSI length, BBWP length, CMF length, and others to suit your market and timeframe.
Use the Decision Table: It updates automatically on the latest bar to show oscillator readings, trend state, and multi-timeframe confluence.
Monitor for alignment: Bullish or bearish signals are highlighted when all components agree.
Look for Anchor, Trigger, Snake Eye labels: These help identify key turning points.
Combine with your trading strategy: This indicator is a decision-support tool and should be used with other forms of analysis and risk management.
Important:
This script does not provide financial advice. It’s a technical analysis tool designed to aid traders in decision-making and should be used at your own risk.
Volume Dominance Indexan indexed version of the volume dominance indicator.
the original volume dominance indicator plotted 2 lines, one upwards volume and one for downwards volume.
this subtracts one from the other, and calculates the absolute difference as a percent of the sum of the upwards and downwards volumes.
MES Scalping AI IndicatorScalping the MES (Micro E-mini S&P 500) futures market on a 1-5 minute timeframe requires a disciplined, high-speed approach to capture small price movements. Below is a straightforward and effective scalping strategy tailored for MES futures, focusing on technical indicators, precise entry/exit rules, and robust risk management. This strategy is designed for traders comfortable with fast-paced environments and assumes access to a reliable trading platform with real-time data
Smart Bar Counter with Alerts🚀 Smart Bar Counter with Alerts 🚀
-----------------------------------------------------
Overview
-----------------------------------------------------
Ever wanted to count a specific number of bars from a key point on your chart—such as after a Break of Structure (BOS), the start of a new trading session, or from any point of interest— without having to stare at the screen?
This "Smart Bar Counter" indicator was created to solve this exact problem. It's a simple yet powerful tool that allows you to define a custom "Start Point" and a "Target Bar Count." Once the target count is reached, it can trigger an Alert to notify you immediately.
-----------------------------------------------------
Key Features
-----------------------------------------------------
• Manual Start Point: Precisely select the date and time from which you want the count to begin, offering maximum flexibility in your analysis.
• Custom Bar Target: Define exactly how many bars you want to count, whether it's 50, 100, or 200 bars.
• On-Chart Display: A running count is displayed on each bar after the start time, allowing you to visually track the progress.
• Automatic Alerts: Set up alerts to be notified via TradingView's various channels (pop-up, mobile app, email) once the target count is reached.
-----------------------------------------------------
How to Use
-----------------------------------------------------
1. Add this indicator to your chart.
2. Go to the indicator's Settings (Gear Icon ⚙️).
- Select Start Time: Set the date and time you wish to begin counting.
- Number of Bars to Count: Input your target number.
3. Set up the Alert ( Very Important! ).
- Right-click on the chart > Select " Add alert ."
- In the " Condition " dropdown, select this indicator: Smart Bar Counter with Alerts .
- In the next dropdown, choose the available alert condition.
- Set " Options " to Once Per Bar Close .
- Choose your desired notification methods under " Alert Actions ."
- Click " Create ."
-----------------------------------------------------
Use Cases
-----------------------------------------------------
• Post-Event Analysis: Count bars after a key event like a Break of Structure (BOS) or Change of Character (CHoCH) to observe subsequent price action.
• Time-based Analysis: Use it to count bars after a market open for a specific session (e.g., London, New York).
• Strategy Backtesting: Useful for testing trading rules that are based on time or a specific number of bars.
-----------------------------------------------------
Final Words
-----------------------------------------------------
Hope you find this indicator useful for your analysis and trading strategies! Feel free to leave comments or suggestions below.
AMF_LibraryLibrary "AMF_Library"
Adaptive Momentum Flow (AMF) Library - A comprehensive momentum oscillator that adapts to market volatility
@author B3AR_Trades
f_ema(source, length)
Custom EMA calculation that accepts a series length
Parameters:
source (float) : (float) Source data for calculation
length (float) : (float) EMA length (can be series)
Returns: (float) EMA value
f_dema(source, length)
Custom DEMA calculation that accepts a series length
Parameters:
source (float) : (float) Source data for calculation
length (float) : (float) DEMA length (can be series)
Returns: (float) DEMA value
f_sum(source, length)
Custom sum function for rolling sum calculation
Parameters:
source (float) : (float) Source data for summation
length (int) : (int) Number of periods to sum
Returns: (float) Sum value
get_average(data, length, ma_type)
Get various moving average types for fixed lengths
Parameters:
data (float) : (float) Source data
length (simple int) : (int) MA length
ma_type (string) : (string) MA type: "SMA", "EMA", "WMA", "DEMA"
Returns: (float) Moving average value
calculate_adaptive_lookback(base_length, min_lookback, max_lookback, volatility_sensitivity)
Calculate adaptive lookback length based on volatility
Parameters:
base_length (int) : (int) Base lookback length
min_lookback (int) : (int) Minimum allowed lookback
max_lookback (int) : (int) Maximum allowed lookback
volatility_sensitivity (float) : (float) Sensitivity to volatility changes
Returns: (int) Adaptive lookback length
get_volatility_ratio()
Get current volatility ratio
Returns: (float) Current volatility ratio vs 50-period average
calculate_volume_analysis(vzo_length, smooth_length, smooth_type)
Calculate volume-based buying/selling pressure
Parameters:
vzo_length (int) : (int) Lookback length for volume analysis
smooth_length (simple int) : (int) Smoothing length
smooth_type (string) : (string) Smoothing MA type
Returns: (float) Volume analysis value (-100 to 100)
calculate_amf(base_length, smooth_length, smooth_type, signal_length, signal_type, min_lookback, max_lookback, volatility_sensitivity, medium_multiplier, slow_multiplier, vzo_length, vzo_smooth_length, vzo_smooth_type, price_vs_fast_weight, fast_vs_medium_weight, medium_vs_slow_weight, vzo_weight)
Calculate complete AMF oscillator
Parameters:
base_length (int) : (int) Base lookback length
smooth_length (simple int) : (int) Final smoothing length
smooth_type (string) : (string) Final smoothing MA type
signal_length (simple int) : (int) Signal line length
signal_type (string) : (string) Signal line MA type
min_lookback (int) : (int) Minimum adaptive lookback
max_lookback (int) : (int) Maximum adaptive lookback
volatility_sensitivity (float) : (float) Volatility adaptation sensitivity
medium_multiplier (float) : (float) Medium DEMA length multiplier
slow_multiplier (float) : (float) Slow DEMA length multiplier
vzo_length (int) : (int) Volume analysis lookback
vzo_smooth_length (simple int) : (int) Volume analysis smoothing
vzo_smooth_type (string) : (string) Volume analysis smoothing type
price_vs_fast_weight (float) : (float) Weight for price vs fast DEMA
fast_vs_medium_weight (float) : (float) Weight for fast vs medium DEMA
medium_vs_slow_weight (float) : (float) Weight for medium vs slow DEMA
vzo_weight (float) : (float) Weight for volume analysis component
Returns: (AMFResult) Complete AMF calculation results
calculate_amf_default()
Calculate AMF with default parameters
Returns: (AMFResult) AMF result with standard settings
amf_oscillator()
Get just the main AMF oscillator value with default parameters
Returns: (float) Main AMF oscillator value
amf_signal()
Get just the AMF signal line with default parameters
Returns: (float) AMF signal line value
is_overbought(overbought_level)
Check if AMF is in overbought condition
Parameters:
overbought_level (float) : (float) Overbought threshold (default 70)
Returns: (bool) True if overbought
is_oversold(oversold_level)
Check if AMF is in oversold condition
Parameters:
oversold_level (float) : (float) Oversold threshold (default -70)
Returns: (bool) True if oversold
bullish_crossover()
Detect bullish crossover (main line crosses above signal)
Returns: (bool) True on bullish crossover
bearish_crossover()
Detect bearish crossover (main line crosses below signal)
Returns: (bool) True on bearish crossover
AMFResult
AMF calculation results
Fields:
main_oscillator (series float) : The main AMF oscillator value (-100 to 100)
signal_line (series float) : The signal line for crossover signals
dema_fast (series float) : Fast adaptive DEMA value
dema_medium (series float) : Medium adaptive DEMA value
dema_slow (series float) : Slow adaptive DEMA value
volume_analysis (series float) : Volume-based buying/selling pressure (-100 to 100)
adaptive_lookback (series int) : Current adaptive lookback length
volatility_ratio (series float) : Current volatility ratio vs average
BreakoutLibrary "Breakout"
init()
method run(state, opts)
Namespace types: BreakoutState
Parameters:
state (BreakoutState)
opts (BreakoutOpts)
BreakoutState
Fields:
levelUps (array)
levelDowns (array)
levelUpTargets (array)
levelDownTargets (array)
levelUpConfirmed (array)
levelDownConfirmed (array)
levelUpNumLevels (array)
levelDownNumLevels (array)
breakoutSignalUp (series bool)
breakoutSignalDown (series bool)
BreakoutOpts
Fields:
canConfirmUp (series bool)
canConfirmDown (series bool)
numLevelMinToConfirm (series int)
numLevelMaxToConfirm (series int)
zigZagPeriod (series int)
rsi (series float)
rsiMA (series float)
Lucy – 3-Bar Reversal with EMA50 Trend Filter📛 Lucy – 3-Bar Reversal with EMA50 Trend Filter
Purpose:
To detect and highlight bullish and bearish 3-bar reversal patterns on the chart, but only when they align with the dominant trend, defined by the EMA 50.
✅ How It Works
🟢 Bullish 3-Bar Reversal (Buy Setup):
Bar 1 is bearish (close < open)
Bar 2 makes a lower low than Bar 1
Bar 3 is bullish (close > open) and closes above Bar 2’s high
Price must be above EMA 50 (trend filter)
✅ Result: Shows a green triangle below the bar
🔴 Bearish 3-Bar Reversal (Sell Setup):
Bar 1 is bullish (close > open)
Bar 2 makes a higher high than Bar 1
Bar 3 is bearish (close < open) and closes below Bar 2’s low
Price must be below EMA 50
✅ Result: Shows a red triangle above the bar
📊 What It Plots:
🔼 Green triangle below bullish signal bar
🔽 Red triangle above bearish signal bar
🟠 Orange line = EMA50 (trend filter)
🔔 Built-in Alerts:
You’ll get an alert if:
A bullish reversal pattern forms above EMA50
A bearish reversal pattern forms below EMA50
🧠 Use Cases:
Great for trend-following traders who want clean, price-action entries
Works well on intraday (15m/1h) or swing (4h/daily) timeframes
Can be used for manual entries, or converted to strategy for automation
quanstocThe quanstoc2 indicator is designed to detect rare and potentially high-probability reversal or trend initiation signals using Stochastic RSI. It identifies a double cross event: two consecutive crosses between %K and %D lines (on back-to-back candles), following a quiet period of at least three candles without any crossover. The signal is marked clearly on the chart and can trigger custom alerts. Supports all timeframes.
Momentum Trend Bands (MTB)📌 What Is the Momentum Trend Bands (MTB) Indicator?
The Momentum Trend Bands (MTB) is a custom-built trend detection indicator that blends momentum and volatility into a dynamic, visual system. Its core goal is to help traders identify the beginning and strength of a trend earlier than traditional tools like moving averages, while filtering out market noise.
🧠 What Is It Built On?
The indicator is built on two foundational concepts:
1. Rate of Change (ROC): This measures the speed at which the price is moving. We use a fast and a slow version of ROC and then calculate their difference. This difference gives us a momentum signal — it shows whether the price is gaining upward or downward strength.
2. Standard Deviation (Volatility): This shows how much the price fluctuates. By calculating it over a certain period, we can measure market noise and filter out weak, insignificant moves that might otherwise cause false signals.
Together, momentum shows direction, and volatility shows confidence.
🛠️ How Does It Work?
• The core of the indicator is a smoothed momentum signal, representing the net difference between fast and slow momentum.
• Around this signal, we build upper and lower bands — these are dynamic boundaries that expand or contract based on volatility.
• When the momentum breaks above or below these bands, it signals a strong directional move — suggesting the start or continuation of a trend.
The bands also serve a visual filter:
• If momentum stays within the bands, it implies the market is consolidating or ranging.
• When it exits the bands decisively, it implies strength in that direction.
📈 How to Use It?
1. Trend Entry:
o When the momentum signal rises above the upper band, it suggests a strong bullish trend may be starting.
o When the signal drops below the lower band, it indicates a bearish trend.
2. Stay Out of Chop:
o If the signal moves sideways within the bands, it’s best to avoid trading — the market is likely consolidating or ranging.
3. Visual Confirmation:
o The background color changes with the trend: green for bullish, red for bearish, gray for neutral. This makes it quick to read visually.
4. Signal Arrows:
o Small up or down arrows appear when trends begin, serving as early entry points.
⚙️ What Kind of Market Does It Work Best In?
• Trending Markets: MTB shines in markets with strong directional movement — whether up or down. It's designed to pick up momentum early and hold through trend continuation.
• Volatile Instruments: The built-in volatility filter helps in markets like crypto or commodities where price action is fast and erratic.
• Avoid Flat or Low-Volume Conditions: In sideways markets, MTB may stay gray or flip often — these are not ideal times to trade using this indicator alone.
💎 Why Is It Unique?
Unlike many indicators that react slowly (like moving averages) or trigger too often (like raw momentum), MTB balances early detection with reliability. Its unique combination of:
• ROC difference for directional intent,
• Smoothing for signal clarity,
• Bands scaled by volatility for robustness,
…makes it stand apart from commonly available indicators on platforms like TradingView.
SDCALibraryMy Valuation Library for mostly crypto currency use, but some can be applied to other assets.
There are technical and on-chain indicator functions for use.
Technical Indicators:
1. **drawdown_zscore**
- **Summary**: Calculates the z-score of drawdowns over a specified lookback period.
- **Inputs**:
- `lookback_length` (int): Period for drawdown calculation.
- `zScoreLen` (int): Length for z-score calculation.
2. **sharpe_zscore**
- **Summary**: Computes the z-score of the Sharpe ratio using returns over a period and a smoothing length.
- **Inputs**:
- `length` (int): Period for returns calculation.
- `smalen` (int): Smoothing length for returns.
- `zScoreLen` (int): Length for z-score calculation.
3. **rsi_zscore**
- **Summary**: Calculates the z-score of the Relative Strength Index (RSI) with smoothing.
- **Inputs**:
- `length` (int): Period for RSI calculation.
- `smalen` (int): Smoothing length for RSI.
- `zScoreLen` (int): Length for z-score calculation.
4. **DFATH_zscore**
- **Summary**: Computes the z-score for a specific DFATH metric (details not specified).
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
5. **RTI_zscore**
- **Summary**: Calculates the z-score of a trend indicator based on data count and sensitivity.
- **Inputs**:
- `trend_data_count` (int): Number of data points for trend analysis.
- `trend_sensitivity_percentage` (int): Sensitivity threshold for trend detection.
- `zScoreLen` (int): Length for z-score calculation.
On-Chain (Crypto only, mostly BTC, ETH)
6. **SOPR_zscore**
- **Summary**: Computes the z-score of Spent Output Profit Ratio (SOPR) for a specific coin.
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
- `coin_sopr` (string): SOPR data for the specified coin.
7. **thermocap_zscore**
- **Summary**: Calculates the z-score of the Thermocap metric using moving average and coin-specific data.
- **Inputs**:
- `ma_len` (int): Length of the moving average.
- `ma_type` (string): Type of moving average.
- `zScoreLen` (int): Length for z-score calculation.
- `coin_index` (string): Coin index data.
- `coin_blocks_mined` (string): Data on blocks mined for the coin.
8. **MVRV_zscore**
- **Summary**: Computes the z-score of the Market Value to Realized Value (MVRV) ratio.
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
- `coin_MC` (string): Market capitalization data.
- `coin_MC_real` (string): Realized market capitalization data.
9. **supplyinprofit_zscore**
- **Summary**: Calculates the z-score of the percentage of coin supply in profit or loss, optionally adjusted for alpha decay.
- **Inputs**:
- `isAlphaDecayAdjusted` (bool): Whether to apply alpha decay adjustment.
- `zScoreLen` (int): Length for z-score calculation.
- `coin_profit_address_percent` (string): Percentage of addresses in profit.
- `coin_loss_address_percent` (string): Percentage of addresses in loss.
10. **realized_price_zscore**
- **Summary**: Computes the z-score of the realized price based on realized market cap and supply.
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
- `coin_MC_real` (string): Realized market capitalization data.
- `coin_supply` (string): Coin supply data.
11. **CVVD_zscore**
- **Summary**: Calculates the z-score of Cumulative Value Days Destroyed (CVVD) metric.
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
- `coin_MC_real` (string): Realized market capitalization data.
- `coin_total_volume` (string): Total volume data for the coin.
12. **NUPL_zscore**
- **Summary**: Computes the z-score of Net Unrealized Profit and Loss (NUPL) metric.
- **Inputs**:
- `zScoreLen` (int): Length for z-score calculation.
- `coin_MC` (string): Market capitalization data.
- `coin_MC_real` (string): Realized market capitalization data.
Simple Position CalculatorThis indicator provides a real-time position sizing calculator designed for fast momentum trading. It instantly calculates optimal trade size based on your risk parameters, entry/exit prices, and exchange conditions (fees/slippage). Perfect for high-speed entries during candle closes and breakouts.
DJZS Session Tracker (PDT-Aligned)//@version=5
indicator("DJZS Session Tracker (PDT-Aligned)", overlay=true, max_lines_count=500)
// Extract current date/time
var int y = year(time)
var int mo = month(time)
var int d = dayofmonth(time)
// Convert local session times (PDT = UTC-7)
asia_start = timestamp("America/Los_Angeles", y, mo, d, 17, 0)
asia_end = timestamp("America/Los_Angeles", y, mo, d + 1, 2, 0)
london_start = timestamp("America/Los_Angeles", y, mo, d + 1, 0, 0)
london_end = timestamp("America/Los_Angeles", y, mo, d + 1, 9, 0)
ny_start = timestamp("America/Los_Angeles", y, mo, d + 1, 5, 0)
ny_end = timestamp("America/Los_Angeles", y, mo, d + 1, 14, 0)
in_session(start, end) =>
time >= start and time < end
asia = in_session(asia_start, asia_end)
london = in_session(london_start, london_end)
ny = in_session(ny_start, ny_end)
// Plot background for sessions
bgcolor(asia ? color.new(color.aqua, 85) : na)
bgcolor(london ? color.new(color.green, 85) : na)
bgcolor(ny ? color.new(color.orange, 85) : na)
// Track session highs/lows
var float asiaHigh = na
var float asiaLow = na
var float londonHigh = na
var float londonLow = na
var float nyHigh = na
var float nyLow = na
if asia
asiaHigh := na(asiaHigh) ? high : math.max(asiaHigh, high)
asiaLow := na(asiaLow) ? low : math.min(asiaLow, low)
else
asiaHigh := na
asiaLow := na
if london
londonHigh := na(londonHigh) ? high : math.max(londonHigh, high)
londonLow := na(londonLow) ? low : math.min(londonLow, low)
else
londonHigh := na
londonLow := na
if ny
nyHigh := na(nyHigh) ? high : math.max(nyHigh, high)
nyLow := na(nyLow) ? low : math.min(nyLow, low)
else
nyHigh := na
nyLow := na
// Plot session highs/lows
plot(asiaHigh, "Asia High", color=color.aqua, style=plot.style_linebr, linewidth=1)
plot(asiaLow, "Asia Low", color=color.aqua, style=plot.style_linebr, linewidth=1)
plot(londonHigh, "London High", color=color.green, style=plot.style_linebr, linewidth=1)
plot(londonLow, "London Low", color=color.green, style=plot.style_linebr, linewidth=1)
plot(nyHigh, "NY High", color=color.orange, style=plot.style_linebr, linewidth=1)
plot(nyLow, "NY Low", color=color.orange, style=plot.style_linebr, linewidth=1)