Mean Reversion Scalping by XtramaskAvoid using this indicator in aggressively trending markets . Best in Non Treanding Markets
Göstergeler ve stratejiler
7 MM colored 3 BB clouded + MACD + RSI Zones7 MM colored 
3 BB clouded
MACD flèches rouges et vertes
RSI Zones sur vente étoile jaune
Hoko Quarterly Theory is it this Quarterly Theory but for faraz................................................................................................................................................................................................................
HOKO Doubling Theorythis script is like Quarterly theory but with bigger box .............................................................................................................................
Chart Info Display (HOKO)this script show you three information , symbol , date , time frame .........................................................................................................................................................
Volume Dry-Up Detector [CANSLIM]by the GPT, 
Volume ≤ 50% of 50-day average for ≥3 consecutive days
Highlights the stock as “ready for breakout” (green background + label)
Works on any ticker (WH Group, Smithfield, etc.)
Simple Market Structure Highs & Lows🟩 Simple Market Structure Highs & Lows
This indicator identifies basic swing highs and lows based on simple two-candle patterns, giving traders a clean visual view of short-term market structure shifts.
🔹 Logic
A Swing High (H) is marked when an up candle is followed by a down candle.
→ The high of the up candle (the first one) is plotted as a green triangle above the bar.
A Swing Low (L) is marked when a down candle is followed by an up candle.
→ The low of the down candle (the first one) is plotted as a red triangle below the bar.
🔹 Purpose
This tool helps visualize basic market turning points — useful for:
Spotting local tops and bottoms
Analyzing market structure changes
Identifying potential entry/exit zones
Building the foundation for BOS/CHoCH strategies
🔹 Notes
Works on any timeframe or asset.
No repainting — signals appear after the confirming candle closes.
Simple and lightweight — ideal for traders who prefer clean structure visualization.
ab 3 candle setup range This script identifies a 3-candle range breakout pattern. It looks for two consecutive inside candles following a base candle and triggers a buy or sell signal when price breaks the base candle’s high or low, confirming bullish or bearish momentum.
Simple Market Structure Highs & Lows🟩 Simple Market Structure Highs & Lows
This indicator identifies basic swing highs and lows based on simple two-candle patterns, giving traders a clean visual view of short-term market structure shifts.
🔹 Logic
A Swing High (H) is marked when an up candle is followed by a down candle.
→ The high of the up candle (the first one) is plotted as a green triangle above the bar.
A Swing Low (L) is marked when a down candle is followed by an up candle.
→ The low of the down candle (the first one) is plotted as a red triangle below the bar.
🔹 Purpose
This tool helps visualize basic market turning points — useful for:
Spotting local tops and bottoms
Analyzing market structure changes
Identifying potential entry/exit zones
Building the foundation for BOS/CHoCH strategies
🔹 Notes
Works on any timeframe or asset.
No repainting — signals appear after the confirming candle closes.
Simple and lightweight — ideal for traders who prefer clean structure visualization.
sensex  9-18-50 + VWAP (VWAP-close confirmation)Description:
This script plots EMA 9, 18, and 50 along with VWAP to identify directional bias in Sensex. A buy or sell signal is generated only when all three EMAs align in sequence and a confirmed 7-minute candle closes above or below the VWAP, helping filter trades with institutional bias confirmation.
Volatility Trend Indicator+Overview:
This indicator measures short-term volatility relative to its smoothed average. It helps visualize whether volatility is increasing or decreasing over time. The indicator is displayed in a separate pane below the main price chart for clarity
Visualization:
Line plot of V
Zero line for reference
Background color highlights trend:
Green → rising volatility
Red → falling volatility
Yellow → neutral
Price Movement Alert with Previous Close as ReferenceFunctionality of the Indicator
The "Price Movement Alarm with Previous Day Close as Reference" indicator is a tool that helps you monitor significant price levels based on the previous day's closing price. The indicator calculates both decline and rise thresholds in specified percentages to generate potential trade alerts. The lines on the chart represent these thresholds, and the corresponding labels show the exact percentage.
Usage Instructions:
Previous Day's Close: The indicator uses the previous trading day's close as the reference point.
Setting Decline and Rise Percentages: You can adjust the alarm levels for declines (e.g., 0.5%, 1.0%, 1.5%, 2.0%, 2.5%, 3.0%) and rises (e.g., 0.5%, 1.0%, 1.5%, 2.0%, 2.5%, 3.0%).
Lines and Labels: The indicator draws lines on the chart and displays labels that indicate the percentage of price movement.
Market Analysis: Analyze the price movements to make potential trading decisions.
Market in Equilibrium:
A market is in equilibrium when price movements remain within a narrow range (e.g., 0.5% to 1%). During this phase, volatility is low, and there are no significant price changes.
Market not in Equilibrium:
A market is not in equilibrium when price movements fall outside the narrow range (e.g., above 1%). During this phase, larger price movements can occur, often triggered by news or economic events.
Price Trend Indicator+🧠 What it does
It measures the ratio between average price change and average volatility, showing how strong and directional the trend is.
Higher positive values = steady uptrend, negative = downtrend
📊 How to interpret
P value	          Signal	                               Meaning
P > +0.5	        🟢 Strong Uptrend	              Steady upward movement
0 < P < +0.5	🟡 Mild Uptrend	              Weak upward bias
P ≈ 0	                ⚪ Sideways	                      No clear direction
-0.5 < P < 0	🟠 Mild Downtrend	              Slight downward bias
P < -0.5	        🔴 Strong Downtrend	      Consistent decline
FVGLibraryFVGLibrary
Script v6 library and a test indicator that implement Fair Value Gap (FVG) detection for both chart/HTF bars and lower timeframes (intrabar). The goal is to make the original indicator modular and reusable via a clean public API.
Tristan's Multi-Indicator Reversal StrategyMulti-Indicator Reversal Strategy - Buy Low, Sell High 
A comprehensive reversal detection system that  combines multiple proven technical indicators  to identify high-probability entry points for catching reversals at market extremes.
📊 Strategy Overview
This strategy is designed for traders who want to buy at lows and sell at highs by detecting when stocks are overextended and ready to reverse. It works by requiring multiple technical indicators to align before generating a signal, significantly reducing false entries.
 Best Used On: 
 
 Timeframe: 1-hour charts (also works on 15min, 30min, 4hour)
 Session: NY Trading Session (9:30 AM - 4:00 PM ET)
 Assets: Stocks, ETFs, Crypto (particularly volatile tech stocks like ZM, TSLA, AAPL)
 Trading Style: Swing trading, Intraday reversals
 
🔧 Technical Components
 The strategy combines FIVE powerful technical indicators: 
1. RSI (Relative Strength Index)
2. MACD (Moving Average Convergence Divergence)
3. Williams %R
4. Bollinger Bands
5. Volume Analysis
6. Divergence Detection (Optional)
🎨 Visual Signals
 Entry Signals: 
🟢 Green Triangle (below candle) = BUY LONG signal
🔴 Red Triangle (above candle) = SELL SHORT signal
 Exit Signals: 
🟣 Purple Label = Position closed (shows "x2", "x3" if multiple entries)
 Additional Indicators: 
💎 Aqua Diamond = Bullish divergence detected
💎 Fuchsia Diamond = Bearish divergence detected
🔵 Blue Background = NY Session active
🟡 Yellow Bar Tint = Volume spike detected
⚪ Small Circles = Near-signal conditions (2+ indicators aligned)
 Live Counter: 
 
 Top corner shows: "Bull: X/4" and "Bear: X/4"
 Indicates how many indicators currently align
 
⚙️ How to Use This Strategy
 For Beginners (More Signals): 
 
 Set "Min Indicators Aligned" to 2
 Turn OFF "Require Divergence"
 Turn OFF "Require Volume Spike"
 Turn OFF "Require Reversal Candle Pattern"
 Keep "Allow Multiple Entries" OFF
 
This gives you more frequent signals to learn from.
 For Advanced Traders (High Probability): 
 
 Set "Min Indicators Aligned" to 3 or 4
 Turn ON "Require Divergence"
 Turn ON "Require Volume Spike"
 Turn ON "Require Reversal Candle Pattern"
 Adjust stop loss to your risk tolerance
 
This filters for only the highest-quality setups.
 Recommended Settings for 1-Hour Charts: 
 
 Min Indicators Aligned: 3
 Stop Loss: 2.5%
 Take Profit: 5.0%
 RSI Length: 14
 Williams %R Length: 14
 Volume Multiplier: 1.5x
 Session: NY only (for stocks)
 
 BUY SIGNAL generated when:
2-4 indicators show oversold/bullish conditions: 
 
 RSI < 30 and turning up
 MACD crossing bullish or histogram positive
 Williams %R < -80 and turning up
 Price at/below lower Bollinger Band
 
Optional confirmations (if enabled):
 
 Bullish divergence detected
 Volume spike present
 Bullish reversal candle pattern
 
Session filter: Signals only during NY trading hours
 SELL SIGNAL Generated When:
2-4 indicators show overbought/bearish conditions: 
 
 RSI > 70 and turning down
 MACD crossing bearish or histogram negative
 Williams %R > -20 and turning down
 Price at/above upper Bollinger Band
 
Optional confirmations (if enabled):
 
 Bearish divergence detected
 Volume spike present
 Bearish reversal candle pattern
 
🛡️ Risk Management Features
 
 Automatic Stop Loss: Protects capital (default 2.5%)
 Take Profit Target: Locks in gains (default 5.0%)
 Pyramiding Control: Toggle to prevent position stacking
 Session Filter: Avoids overnight risk and low-liquidity periods
 Position Flipping: Automatically reverses when opposite signal appears
 
💡 Best Practices
✅ DO:
 
 Wait for candle close before entering (built into strategy)
 Use on volatile assets with clear trends
 Combine with your own analysis and risk management
 Backtest on your specific assets and timeframes
 Start with paper trading to learn the signals
 Adjust indicator requirements based on market conditions
 
❌ DON'T:
 
 Use on very low timeframes (<5 min) without adjustment
 Ignore the session filter on stocks
 Use maximum leverage - these are reversal trades
 Trade during major news events or earnings
 Expect 100% win rate - focus on risk/reward ratio
 
📊 Performance Notes
 This strategy prioritizes quality over quantity.  With default settings, you may see:
 
 2-5 signals per week on 1-hour charts
 Higher win rate with stricter settings (3-4 indicators aligned)
 Best performance during trending markets with clear reversals
 Reduced performance in choppy, sideways markets
 
Tip: Adjust "Min Indicators Aligned" based on market conditions:
 
 Trending markets: Use 3-4 (fewer but stronger signals)
 Range-bound markets: Use 2 (more signals, but watch for false breakouts)
Opposing Candle V2🟩 OC (Opposing Candle) Multi–Timeframe Framework
🔍 Overview
The OC Indicator automatically detects and displays Opposing Candles (OCs) across up to three timeframes.
An Opposing Candle is a candle that fully engulfs the previous one, signaling a potential shift in control — either a trend continuation or a trend reversal.
This multi–timeframe framework gives traders a structured way to visualize displacement, pullbacks, and momentum shifts between timeframes.
⚙️ How It Works
Each OC is drawn as a box showing:
High & Low → The candle’s full range
Open Line (black) → Key control level
Midline (white) → Candle equilibrium
Optional labels for timeframe and session
You can enable up to 3 timeframes (e.g., 30m / 1H / 4H) and adjust how many OCs to display for each.
📈 Trading Framework
🔹 Continuation Setup (Trend Following)
1. 4H Bias → Bullish or Bearish
Identify clear trend structure (HH/HL = bullish, LH/LL = bearish).
Confirm strong displacement and visible gaps between OCs — signs of momentum and healthy trend continuation.
2. 1H Confirmation OC
OC forms in the direction of the 4H bias, confirming control.
3. 30min Pullback OC
Opposite–colored OC appears → represents the pullback.
4. Entry Trigger
A yellow candle closes beyond the 30min OC open line, confirming the end of the pullback.
→ Enter in trend direction.
🎯 Targets
Target 1: Next 1H OC high or low (in trend direction)
Target 2: Next 4H OC high or low
🛑 Stop: Beyond the 30min OC’s opposite wick
🔹 Reversal Setup (Trend Shift)
1. 4H Structure → Extended or Losing Momentum
When there are no higher–timeframe gaps and no displacement, momentum weakens — often a sign of potential reversal.
2. Opposing OC Forms on HTF
A strong engulfing OC appears against the previous trend at a key structural level.
3. Lower–Timeframe Alignment
1H and 30min OCs begin forming in the new direction, confirming control shift.
4. Entry Trigger
Break of the lower–timeframe OC open line signals the reversal confirmation.
🟢 Example: Bullish Reversal
4H downtrend shows compression (no displacement)
4H bullish OC forms at support
30min breaks above a bearish OC’s open line → Go long
🔴 Example: Bearish Reversal
4H uptrend stalls at resistance
4H bearish OC forms
30min breaks below a bullish OC’s open line → Go short
🎯 Targets
Target 1: Nearest opposing 1H OC high/low
Target 2: Major 4H structural high/low
🛑 Stop: Beyond the reversal OC wick
🧠 Key Concepts
Displacement = Strength. Strong, impulsive moves with clear gaps between OCs show continuation.
Compression = Weakness. Overlapping candles and no HTF displacement often hint at reversal.
OC = Control Candle. The open line is the “line in the sand” — when price breaks it, control flips.
Multi–TF Confluence = Precision. 4H → 1H → 30m gives you structure → confirmation → entry accuracy.
🎨 Features
✅ Multi–Timeframe OC detection (default: 30m / 1H / 4H)
✅ Bullish & Bearish boxes with open and midlines
✅ Break candles highlighted yellow
✅ Optional labels (timeframe + session)
✅ Session filters (Asia, London, NYAM, NYPM)
✅ Fully customizable visuals and extension lengths
TLP Swing Chart V2// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// Sửa đổi trên code gốc của © meomeo105
// © meomeo105
//@version=5
indicator('TLP Swing Chart V2', shorttitle='TLP Swing V2', overlay=true, max_lines_count=500)
//-----Input-------
customTF = input.timeframe(defval="",title = "Show Other TimeFrame")
showTLP = input.bool(false, 'Show TLP', inline = "TLP1")
colorTLP = input.color(color.aqua, '', inline = "TLP1")
showSTLP = input.bool(true, 'Show TLP Swing', inline = "Swing1")
colorSTLP = input.color(color.aqua, '', inline = "Swing1")
showLabel = input.bool(true, 'Show Label TimeFrame')
lineSTLP = input.string(title="",options= ,defval="(─)", inline = "Swing1")
lineStyleSTLP = lineSTLP == "(┈)" ? line.style_dotted : lineSTLP == "(╌)" ? line.style_dashed : line.style_solid
//IOSB 
IOSB = "TLPInOutSideBarSetting"
ISB = input(true,group =IOSB, title="showISB")
colorISB = input.color(color.rgb(250, 171, 0), inline = "ISB")
OSB = input(true,group =IOSB, title="showOSB")
colorOSB = input.color(color.rgb(56, 219, 255), inline = "OSB")
ZoneColor = input(defval = color.new(color.orange, 90),group =IOSB, title = "Background Color")
BorderColor = input(defval = color.new(color.orange, 100),group =IOSB, title = "Border Color")
/////////////////
var aCZ = array.new_float(0)
float highest = high 
float lowest = low 
if (array.size(aCZ) > 0) 
    highest := array.get(aCZ, 0)
    lowest := array.get(aCZ, 1)
insideBarCondtion = low >= lowest and low <= highest and high >= lowest and high <= highest      
if ( insideBarCondtion == true )
    array.push(aCZ, high )
    array.push(aCZ, low )
if( array.size(aCZ) >= 2 and insideBarCondtion == false )
    float maxCZ = array.max(aCZ)
    float minCZ = array.min(aCZ)
    box.new(bar_index - (array.size(aCZ) / 2) - 1, maxCZ, bar_index - 1, minCZ, bgcolor = ZoneColor, border_color = BorderColor)
    array.clear(aCZ)
//////////////////////////Global//////////////////////////
var arrayLineTemp = array.new_line()
// Funtion
f_resInMinutes() => 
    _resInMinutes = timeframe.multiplier * (
      timeframe.isseconds ? 1. / 60. :
      timeframe.isminutes ? 1.       :
      timeframe.isdaily   ? 1440.    :
      timeframe.isweekly  ? 10080.   :
      timeframe.ismonthly ? 43800.   : na)
// Converts a resolution expressed in minutes into a string usable by "security()"
f_resFromMinutes(_minutes) =>
      _minutes   < 1       ? str.tostring(math.round(_minutes*60)) + "S" :
      _minutes   < 60         ? str.tostring(math.round(_minutes)) + "m" :
      _minutes   < 1440         ? str.tostring(math.round(_minutes/60)) + "H" :
      _minutes   < 10080        ? str.tostring(math.round(math.min(_minutes / 1440, 7))) + "D" :
      _minutes   < 43800        ? str.tostring(math.round(math.min(_minutes / 10080, 4))) + "W" :
      str.tostring(math.round(math.min(_minutes / 43800, 12))) + "M"
f_tfRes(_res,_exp) =>
    request.security(syminfo.tickerid,_res,_exp,lookahead=barmerge.lookahead_on)
var label labelError = label.new(bar_index, high, text = "", color = #00000000, textcolor = color.white,textalign = text.align_left)
sendError(_mmessage) =>
    label.set_xy(labelError, bar_index + 3, close )
    label.set_text(labelError, _mmessage)
var arrayLineChoCh = array.new_line()
var label labelTF = label.new(time, close, text = "",color = color.new(showSTLP ? colorSTLP : colorTLP,95), textcolor = showSTLP ? colorSTLP : colorTLP,xloc = xloc.bar_time, textalign = text.align_left)
//////////////////////////TLP//////////////////////////
var arrayXTLP = array.new_int(5,time)
var arrayYTLP = array.new_float(5,close)
var arrayLineTLP = array.new_line()
int drawLineTLP = 0
_high = high
_low = low
_close = close
_open = open
if(customTF != timeframe.period)
    _high := f_tfRes(customTF,high)
    _low := f_tfRes(customTF,low)
    _close := f_tfRes(customTF,close)
    _open := f_tfRes(customTF,open)
highPrev = _high
lowPrev = _low
// drawLineTLP => 2:Tiếp tục 1:Đảo chiều; // Outsidebar 2:Tiếp tục 3:Tiếp tục và Đảo chiều 4 : Đảo chiều 2 lần
drawLineTLP := 0
if(_high  > highPrev  and _low  > lowPrev )
    if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
        if(_high  <= high)
            array.set(arrayXTLP, 0, time)
        array.set(arrayYTLP, 0, _high )
        drawLineTLP := 2
    else
        array.unshift(arrayXTLP,time)
        array.unshift(arrayYTLP,_high )
        drawLineTLP := 1
    
else if(_high  < highPrev  and _low  < lowPrev )
    if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
        array.unshift(arrayXTLP,time)
        array.unshift(arrayYTLP,_low )
        drawLineTLP := 1
    else
        if(_low  >= low)
            array.set(arrayXTLP, 0, time)
        array.set(arrayYTLP, 0, _low )
        drawLineTLP := 2
else if(_high  >= highPrev  and _low  < lowPrev  or _high  > highPrev  and _low  <= lowPrev )
    if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
        if(_high  >= array.get(arrayYTLP,0) and array.get(arrayYTLP,1) < _low )
            if(_high  <= high)
                array.set(arrayXTLP, 0, time)
            array.set(arrayYTLP, 0, _high )
            drawLineTLP := 2
        else if(_high  >= array.get(arrayYTLP,0) and array.get(arrayYTLP,1) > _low )
            if(_close < _open)
                if(_high  <= high)
                    array.set(arrayXTLP, 0, time)
                array.set(arrayYTLP, 0, _high )
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_low )
                drawLineTLP := 3
             
            else
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_low )
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_high )
                drawLineTLP := 4
      
    else if(array.get(arrayYTLP,0) < array.get(arrayYTLP,1))
        if(_low  <= array.get(arrayYTLP,0) and _high  < array.get(arrayYTLP,1))
            if(_low  >= low)
                array.set(arrayXTLP, 0, time)
            array.set(arrayYTLP, 0, _low )
            drawLineTLP := 2
        else if(_low  <= array.get(arrayYTLP,0) and _high  > array.get(arrayYTLP,1))
            if(_close > _open)
                if(_low  >= low)
                    array.set(arrayXTLP, 0, time)
                array.set(arrayYTLP, 0, _low )
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_high )
                drawLineTLP := 3
            else
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_high )
                array.unshift(arrayXTLP,time)
                array.unshift(arrayYTLP,_low )
                drawLineTLP := 4
else if((_high  <= highPrev  and _low  >= lowPrev ))
    highPrev := highPrev 
    lowPrev := lowPrev 
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()) and drawLineTLP == 0)
    if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
        if(array.get(arrayYTLP,0) <= high)
            array.set(arrayXTLP, 0, time)
            drawLineTLP := 2
    else
        if(array.get(arrayYTLP,0) >= low)
            array.set(arrayXTLP, 0, time)
            drawLineTLP := 2
if((showSTLP or  showTLP) and f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
    if(drawLineTLP == 2)
        if(array.size(arrayLineTLP) >0)
            line.set_xy2(array.get(arrayLineTLP,0),array.get(arrayXTLP,0),array.get(arrayYTLP,0))
        else
            array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
    else if(drawLineTLP == 1)
        array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
    else if(drawLineTLP == 3)
        if(array.size(arrayLineTLP) >0)
            line.set_xy2(array.get(arrayLineTLP,0),array.get(arrayXTLP,1),array.get(arrayYTLP,1))
        else
            array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,2),array.get(arrayYTLP,2),array.get(arrayXTLP,1),array.get(arrayYTLP,1), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
        array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
    else if(drawLineTLP == 4)
        array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,2),array.get(arrayYTLP,2),array.get(arrayXTLP,1),array.get(arrayYTLP,1), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
        array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
//////////////////////////Swing TLP//////////////////////////
var arrayXSTLP = array.new_int(5,time)
var arrayYSTLP = array.new_float(5,close)
var arrayLineSTLP = array.new_line()
int drawLineSTLP = 0
int drawLineSTLP1 = 0
if(showSTLP)
    if(math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1)) < math.min(array.get(arrayYTLP,0),array.get(arrayYTLP,1)) or math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1)) > math.max(array.get(arrayYTLP,0),array.get(arrayYTLP,1)))
        //Khởi tạo bắt đầu
        drawLineSTLP1 := 5
        array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
        array.set(arrayYSTLP, 0, array.get(arrayYTLP,1))
        array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
        array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
    // drawLineSTLP kiểm tra điểm 1 => 13:Tiếp tục có sóng hồi // 12|19(reDraw):Tiếp tục không có sóng hồi  // 14:Đảo chiều
    if(array.get(arrayXTLP,0) == array.get(arrayXTLP,1))
        if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,2) and array.get(arrayYSTLP,0) != array.get(arrayYTLP,1) and ((array.get(arrayYTLP,1) > array.get(arrayYTLP,2) and array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1)) or (array.get(arrayYTLP,1) < array.get(arrayYTLP,2) and array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))))
            drawLineSTLP1 := 12
            array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
            array.set(arrayYSTLP, 0, array.get(arrayYTLP,1))
        else if(array.get(arrayXSTLP,0) <= array.get(arrayXTLP,2))
            if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) < array.get(arrayYSTLP,1)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) > array.get(arrayYSTLP,1)))
                drawLineSTLP1 := 14
                array.unshift(arrayXSTLP,array.get(arrayXTLP,1))
                array.unshift(arrayYSTLP,array.get(arrayYTLP,1))
            else if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) > array.get(arrayYSTLP,0)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) < array.get(arrayYSTLP,0)))
                drawLineSTLP1 := 13
                _max = math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
                _min = math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
                _max_idx = 0
                _min_idx = 0
                for i = 2 to array.size(arrayXTLP)
                    if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,i))
                        break
                    if(_min > array.get(arrayYTLP,i))
                        _min := array.get(arrayYTLP,i)
                        _min_idx := array.get(arrayXTLP,i)
                    if(_max < array.get(arrayYTLP,i))
                        _max := array.get(arrayYTLP,i)
                        _max_idx := array.get(arrayXTLP,i)
                if(array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1))
                    array.unshift(arrayXSTLP,_min_idx)
                    array.unshift(arrayYSTLP,_min)
                else if(array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))
                    array.unshift(arrayXSTLP,_max_idx)
                    array.unshift(arrayYSTLP,_max)
                array.unshift(arrayXSTLP,array.get(arrayXTLP,1))
                array.unshift(arrayYSTLP,array.get(arrayYTLP,1))
        if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
            if(array.get(arrayYSTLP,0) == array.get(arrayYTLP,1) and array.get(arrayXSTLP,0) != array.get(arrayXTLP,1))
                array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
                drawLineSTLP1 := 19
        if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
            if(drawLineSTLP1 == 12 or drawLineSTLP1 == 19)
                if(array.size(arrayLineSTLP) >0)
                    line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
                else
                    array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
            else if(drawLineSTLP1 == 14)
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
            else if(drawLineSTLP1 == 13)
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
            else if(drawLineSTLP1 == 15)
                if(array.size(arrayLineSTLP) >0)
                    line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1))
                else
                    array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
            
    // drawLineSTLP kiểm tra điểm 0 => 3:Tiếp tục có sóng hồi // 2|9(reDraw):Tiếp tục không có sóng hồi  // 4:Đảo chiều
    if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,1) and array.get(arrayYSTLP,0) != array.get(arrayYTLP,0) and ((array.get(arrayYTLP,0) > array.get(arrayYTLP,1) and array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1)) or (array.get(arrayYTLP,0) < array.get(arrayYTLP,1) and array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))))
        drawLineSTLP := 2
        array.set(arrayXSTLP, 0, array.get(arrayXTLP,0))
        array.set(arrayYSTLP, 0, array.get(arrayYTLP,0))
    else if(array.get(arrayXSTLP,0) <= array.get(arrayXTLP,1))
        if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) < array.get(arrayYSTLP,1)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) > array.get(arrayYSTLP,1)))
            drawLineSTLP := 4
            array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
            array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
        else if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) > array.get(arrayYSTLP,0)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) < array.get(arrayYSTLP,0)))
            drawLineSTLP := 3
            _max = math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
            _min = math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
            _max_idx = 0
            _min_idx = 0
            for i = 1 to array.size(arrayXTLP)
                if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,i))
                    break
                if(_min > array.get(arrayYTLP,i))
                    _min := array.get(arrayYTLP,i)
                    _min_idx := array.get(arrayXTLP,i)
                if(_max < array.get(arrayYTLP,i))
                    _max := array.get(arrayYTLP,i)
                    _max_idx := array.get(arrayXTLP,i)
            if(array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1))
                array.unshift(arrayXSTLP,_min_idx)
                array.unshift(arrayYSTLP,_min)
            else if(array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))
                array.unshift(arrayXSTLP,_max_idx)
                array.unshift(arrayYSTLP,_max)
            array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
            array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
    if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
        if(array.get(arrayYSTLP,0) == array.get(arrayYTLP,0) and array.get(arrayXSTLP,0) != array.get(arrayXTLP,0))
            array.set(arrayXSTLP, 0, array.get(arrayXTLP,0))
            drawLineSTLP := 9
    if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
        if(drawLineSTLP == 2 or drawLineSTLP == 9)
            if(array.size(arrayLineSTLP) >0)
                line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
            else
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
        else if(drawLineSTLP == 4)
            array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
        else if(drawLineSTLP == 3)
            array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
            array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
        else if(drawLineSTLP == 5)
            if(array.size(arrayLineSTLP) >0)
                line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1))
            else
                array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
            array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
        
///////////////////////Other//////////////////////////////////
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
    if(showSTLP)
    
        if(showLabel and (barstate.islast or barstate.islastconfirmedhistory))
            texLabel = f_resInMinutes() == f_tfRes(customTF,f_resInMinutes()) ? f_resFromMinutes(f_resInMinutes()) : f_resFromMinutes(f_tfRes(customTF,f_resInMinutes()))
            label.set_xy(labelTF,array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
            label.set_text(labelTF,texLabel)
            label.set_style(labelTF,array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) ? label.style_label_upper_right : label.style_label_lower_right)
        if(not showTLP)
            arrayLineTemp := array.copy(arrayLineTLP)
            for itemArray in arrayLineTemp
                if(line.get_x1(itemArray) < array.get(arrayXSTLP,0))
                    line.delete(itemArray)
                    array.remove(arrayLineTLP,array.indexof(arrayLineTLP, itemArray))
//Inside Bars - Outside Bars
insideBar() => ISB and high <= high  and low >= low  ? 1 : 0
outsideBar() => OSB and (high > high  and low < low ) ? 1 : 0
//Inside and Outside Bars
barcolor(insideBar() ? color.new(colorISB,0) : na )
barcolor(outsideBar() ? color.new(colorOSB,0) : na )
GTI BGTI: RSI Suite (Standard • Stochastic • Smoothed)
A three-layer momentum and trend toolkit that combines Standard RSI, Stochastic RSI, and a Smoothed/“Macro” RSI to help you read intraday swings, trend transitions, and high-probability reversal/continuation spots.
All in one pane with intuitive coloring and optional divergence markers and alerts.
Why this works
* Stochastic RSI (K/D) visualizes fast momentum swings and timing.
* Standard RSI moves more gradually, helping confirm trend transitions that may span several Stochastic cycles.
* Smoothed RSI (Average → Macro) adds a second-pass filter and slope persistence to reveal the macro direction while suppressing noise.
Used together, Stochastic guides entries/exits around local highs/lows, while the RSI layers improve confidence when a small swing is likely part of a larger turn.
What you’ll see
* Standard RSI (yellow; pink above Bull line, aqua below Bear line).
* Stochastic RSI (K/D) with contextual colors:
    * Greens when RSI is weak/oversold (bearish conditions → watch for bullish reversals/continuations).
    * Reds when RSI is strong/overbought (bullish conditions → watch for bearish reversals/continuations).
* Smoothed (Macro) RSI with trend color:
    * Red when macro is ascending (bullish),
    * Aqua when macro is descending (bearish).
* Divergences (optional markers):
    * Bearish: RSI Lower High + Price Higher High (red ⬇).
    * Bullish: RSI Higher Low + Price Lower Low (green ⬆).
    * No repaint: pivots confirm after the chosen right-bars window.
How to use it
* Bullish Reversal
    * Macro RSI is reversing at a higher low after price has been in a overall downtrend
    * Stochastic RSI is switching from green to red in an overall downtrend
* Bullish Oversold
    * Macro RSI is reversing from a significantly low level after price has a short but strong dip during an overall uptrend
    * Stochastic RSI is switching from green to red in an overall uptrend
* Bullish Continuation
    * Macro RSI is ascending with a strong slope or forming a higher low above the 50 line
    * Stochastic RSI is reaching a bottom but still painted red
* Bearish Reversal
    * Macro RSI is reversing at a lower high after price has been in a overall uptrend
    * Stochastic RSI is switching from red to green in an overall uptrend
* Bearish Overbought
    * Macro RSI is reversing from a significantly high level after price has a short but strong jump during an overall downtrend
    * Stochastic RSI is switching from red to green in an overall downtrend
* Bearish Continuation
    * Macro RSI is descending with a strong slope or forming a lower high below the 50 line
    * Stochastic RSI is reaching a top but still painted green
* Divergences: Use as signals of exhaustion—best when aligned with Macro RSI color/slope and key levels (e.g., Bull/Bear lines, 50 midline).
*** IMPORTANT ***
* Stack confluence, don’t single-signal trade. Look for:
    * 1) Macro RSI color & slope (red = ascending/bullish, aqua = descending/bearish)
    * 2) Standard RSI location (above/below Bull/Bear lines or 50)
    * 3) Stoch flip + direction
    * 4) Price structure (HH/HL vs LH/LL)
    * 5) Divergence type (regular vs hidden) at meaningful levels
* Trade with the macro
    * Prioritize longs when Macro RSI is red or just flipped up
    * Prioritize shorts when Macro RSI is aqua or just flipped down
        * Counter-trend setups = smaller size and faster management.
* Location > signal
    * The same crossover/divergence is higher quality near Bull (~60)/Bear(~40) or extremes than in the mid-range chop around 50.
* Early vs confirmed
    * Use the early pivot heads-up for anticipation, but scale in only after the confirmed pivot (right-bars complete). If early signal fails to confirm, stand down.
* Define invalidation upfront
    * For divergence entries, place stops beyond the pivot extreme (LL/HH). If Macro RSI flips against your trade or RSI breaks back through 50 with slope, exit or tighten.
* Multi-timeframe alignment
    * Best results come when entry timeframe (e.g., 1H) aligns with higher-TF macro (e.g., 4H/D). If they disagree, treat it as mean-reversion only.
* Avoid common traps
    * Skip: isolated Stochastic flips without RSI support, divergences without price HH/LL confirmation, and serial divergences when Macro RSI slope is strong against the idea.
* Parameter guidance
    * Start with defaults; then tune: confirmBars 3–7, minSlope 0.05–0.15 RSI pts/bar, pivot left/right tighter for faster but noisier signals, wider for cleaner but fewer.
* Alerts = workflow, not auto-trades
    * Use Macro Flip + Divergence alerts as a checklist trigger; enter only when your confluence rules are met and risk is defined.
Key inputs (tweak to your market/timeframe)
* RSI / Stochastic lengths and K/D smoothing.
* Bull / Bear Lines (default 61.1 / 43.6).
* Average RSI Method/Length (SMA/EMA/RMA/WMA) + Macro Smooth Length.
* Trend confirmation: bars of persistence and minimum slope to reduce flip noise.
* Pivot look-back (left/right) for divergence confirmation strictness.
Alerts included
* Macro Flip Up / Down (Smoothed RSI regime change).
* RSI Bullish/Bearish Divergence (confirmed at pivot).
* Stochastic RSI continuation/divergence (optional).
Tips
* Level + Slope matter. High/low RSI level flags conditions; slope confirms impulse/continuation.
* Let Stochastic time the swing; let Macro RSI filter the trend.
* Tighten or loosen pivot windows to trade fewer/cleaner vs. more/faster signals.
AG Pro Dynamic ChannelsAG Pro Dynamic Channels V2  
 Discover a new lens through which to view market structure with the AG Pro Dynamic Channels V2. This advanced indicator moves beyond simple trendlines, automatically identifying, classifying, and drawing eight distinct types of support and resistance channels directly on your chart.
Built on a sophisticated pivot-point detection engine, this script intelligently distinguishes between Major and Minor price structures, as well as Internal and External channels. This provides a comprehensive and multi-dimensional map of the market's flow, helping you identify trend continuations, corrections, and potential reversals.
The indicator is complete with a powerful, fully customizable alert system designed to notify you of the two most critical events: channel breakouts and price reactions.
 Key Features 
 
 Fully Automatic Channels:  The script automatically analyzes price action to find pivot highs and lows, using them to construct relevant channels without any manual drawing required.
 8-Channel Classification:  Gain deep market insight by viewing eight distinct channel types:
  Major External (Up/Down)
  Major Internal (Up/Down)
  Minor External (Up/Down)
  Minor Internal (Up/Down)
 Advanced Pivot Engine:  The core logic classifies pivots into categories like Higher Highs (MHH/mHH), Lower Lows (MLL/mLL), Higher Lows (MHL/mHL), and Lower Highs (MLH/mLH) to determine the precise start and end points for each channel.
 Deep Customization:  Take full control of your chart's appearance. You can individually toggle the visibility, color, line style (solid, dashed, dotted), and line width for all eight channel types.
 Chart Clarity:  A "Delete Previous" option is available for each channel type, allowing you to keep your chart clean and focused on only the most current and relevant market structures.
 
 Comprehensive Alert System 
Never miss a key price interaction. The AG Pro Dynamic Channels V2 features a robust, built-in alert module.
 
 Dual-Alert Conditions:  Get notifications for two distinct events:
 Break Alert: Triggers when price confirms a close outside of a channel, signaling a potential breakout.
 React Alert: Triggers when price touches or interacts with a channel line before closing back inside, signaling a test or rejection.
 16 Unique Alerts:  You have full control to enable or disable "Break" and "React" alerts for all 8 channel types individually, giving you 16 unique alert conditions to monitor.
 Professional Alert Messages:  The embedded alert sender provides detailed messages that include the asset, timeframe, and the specific event, such as "Break Major External Up Channel" or "React Minor Internal Down Channel".
 Alert Configuration:  Easily set your global Alert Name, Message Frequency (e.g., Once Per Bar, Once Per Bar Close), and Alert Time Zone from the script's settings.
 
 How to Use 
 
 Trend Identification:  Use the Major External Channels (drawn from MHH and MLL pivots) to identify the primary, long-term trend direction.
 Pullback & Entry Zones:  Use the Internal Channels (drawn from MHL and MLH pivots) to spot corrections and potential entry zones within an established trend.
 Breakout Trading:  Set Break Alerts on Major channels to be notified of significant, structure-shifting moves.
 Short-Term & Counter-Trend:  Utilize the Minor Channels to identify shorter-term price swings and potential reversal points.
RVOL CandlesRvol indicator shows relative volume on each candle and can be adjusted and color change.
Custom Session Background Highlighter (Asia / London / NY)This was something i am used to using with Motivewave, and did not see a good one with TV. You can set any time frame, and change the background color to any color you want. I like to have a lightly different color background for Asia (6pm to 3am),, London, (3am to 9:30 am) and NY (9:30am to 5 pm). You can set your time as you wish, and change the colors as you like. This was created with the help of ChatGPT and seems to be working perfectly fine, but if you encounter any issues copy and paste the code to chatgpt and ask to revise it as needed. 






















