Bands and Channels
Fractal Support and Resistance [BigBeluga]🔵 OVERVIEW
The Fractal Support and Resistance indicator automatically identifies high-probability support and resistance zones based on repeated fractal touches. When a defined number of fractal highs or lows cluster around the same price zone, the indicator plots a clean horizontal level and shaded zone, helping traders visualize structurally important areas where price may react.
🔵 CONCEPTS
Fractal Points: Swing highs and lows based on user-defined left and right range (length). A valid fractal forms only when the center candle is higher or lower than its neighbors.
Zone Validation: A level is only confirmed when the price has printed the specified number of fractals (e.g., 3) within a narrow ATR-defined range.
Dynamic Zone Calculation: The plotted level can be based on the average of clustered fractals or on the extreme value (min or max), depending on the user’s choice.
Support/Resistance Zones: Once a zone is validated, a horizontal line and shaded box are drawn and automatically extended into the future until new valid clusters form.
Auto-Clean & Reactivity: Each zone persists until replaced by a new fractal cluster, ensuring the chart remains uncluttered and adaptive.
🔵 FEATURES
Detects swing fractals using adjustable left/right range.
Confirms zones when a defined number of fractals occur near the same price.
Plots horizontal level and shaded box for visual clarity.
Choice between average or min/max logic for level calculation.
Distinct color inputs for support (green) and resistance (orange) zones.
Adaptive auto-extension keeps valid zones projected into the future.
Displays optional triangle markers above/below bars where fractals form.
Clean design optimized for structural S/R analysis.
🔵 HOW TO USE
Use support zones (from low fractals) to look for potential long entries or bounce points .
Use resistance zones (from high fractals) to look for short setups or rejections .
Adjust the Fractals Qty to make zones more or less strict—e.g., 3 for higher reliability, 2 for quicker responsiveness.
Combine with liquidity indicators or break/retest logic to validate zone strength.
Toggle between average and min/max mode to fit your style (average for balance, extremes for aggression).
🔵 CONCLUSION
Fractal Support and Resistance offers a robust way to identify hidden levels that the market respects repeatedly. By requiring multiple fractal confirmations within a zone, it filters out noise and highlights clean structural areas of interest. This tool is ideal for traders who want automatic, adaptive, and reliable S/R levels grounded in raw market structure.
Smart Money Breakout Channels [AlgoAlpha]🟠 OVERVIEW
This script draws breakout detection zones called “Smart Money Breakout Channels” based on volatility-normalized price movement and visualizes them as dynamic boxes with volume overlays. It identifies temporary accumulation or distribution ranges using a custom normalized volatility metric and tracks when price breaks out of those zones—either upward or downward. Each channel represents a structured range where smart money may be active, helping traders anticipate key breakouts with added context from volume delta, up/down volume, and a visual gradient gauge for momentum bias.
🟠 CONCEPTS
The script calculates normalized price volatility by measuring the standard deviation of price mapped to a scale using the highest and lowest prices over a set lookback period. When normalized volatility reaches a local low and flips upward, a boxed channel is drawn between the highest and lowest prices in that zone. These boxes persist until price breaks out, either with a strong candle close (configurable) or by touching the boundary. Volume analysis enhances interpretation by rendering delta bars inside the box, showing volume distribution during the channel. Additionally, a real-time visual “gauge” shows where volume delta sits within the channel range, helping users spot pressure imbalances.
🟠 FEATURES
Automatic detection and drawing of breakout channels based on volatility-normalized price pivots.
Optional nested channels to allow multiple simultaneous zones or a clean single-zone view.
Gradient-filled volume gauge with dynamic pointer to show current delta pressure within the box.
Three volume visualization modes: raw volume, comparative up/down volume, and delta.
Alerts for new channel creation and confirmed bullish or bearish breakouts.
🟠 USAGE
Apply the indicator to any chart. Wait for a new breakout box to form—this occurs when volatility behavior shifts and a stable range emerges. Once a box appears, monitor price relative to its boundaries. A breakout above suggests bullish continuation, below suggests bearish continuation; signals are stronger when “Strong Closes Only” is enabled.
Watch the internal volume candles to understand where buy/sell pressure is concentrated during the box. Use the gauge on the right to interpret whether net pressure is building upward or downward before breakout to anticipate the direction.
Use alerts to catch breakout events without needing to monitor the chart constantly 🚨.
MBDOM EMACROSS 5_13 with BB_EMA & Multi-Timeframe"MBDOM EMACROSS 5_13 with BB_EMA & Multi-Timeframe"
This Pine Script indicator is designed for multi-timeframe trend analysis using EMA crossovers (5 & 13) along with Bollinger Bands (BB) for additional confirmation.
Key Features:
Multi-Timeframe EMA Analysis
Tracks EMA 5 & 13 crossovers across higher (D, W, M) and lower (60min) timeframes.
Displays a summary table showing bullish (✓) or bearish (✓) signals for each timeframe.
EMA Crossovers (Current Chart)
Plots EMA 5, 9, 13, 21, 50, and 200 for trend identification.
Fills between EMA 5 & 13 (green if bullish, red if bearish).
Generates BUY/SELL signals when EMA 5 crosses above/below EMA 13.
Bollinger Bands (BB)
Plots BB (20-period, 2x multiplier) with upper/lower bands and a moving average basis.
Alerts & Visual Enhancements
Triggers alerts for EMA 5/13 crossovers.
Uses background color changes to highlight bullish/bearish conditions.
Use Case:
Helps traders confirm trends across multiple timeframes.
Provides entry/exit signals based on EMA crossovers.
Combines trend-following (EMA) and volatility (BB) indicators.
This script is useful for swing traders and trend followers who rely on multi-timeframe confluence for decision-making.
Money Printer 1.0bollinger band candle body closes, while using the 100,200 ema for shorts, longs, take profit at the middle of the bollinger bands
HBD.warning wave scanningThis indicator is a detailed technical analysis tool designed to track trading splits, identify potential trend reversals, and monitor key price movements in the cryptocurrency markets. Available in multiple versions, these indicators combine various options to help you understand market dynamics. Fibonacci levels automatically change. These are important areas within the orange zone. You can set alarms for these levels. Enjoy the benefits.
Nifty 500 Scanner
Nifty 500 Scanner
Your Ultimate TradingView Tool for Swing and Intraday Trading
🔥 Introduction
✅ If you want to find out which stock out of 500 stocks of Nifty500 is:
showing reversal pattern candles after a long down or up trend
also bouncing from support/resistance
and that stock gives you live alerts when this condition occurs
Then, look no further. Nifty500 Scanner is just for you.
📊 What is the Nifty 500 Scanner?
The Nifty 500 Scanner is a powerful TradingView indicator for Indian stocks designed to help you identify bullish and bearish reversal signals across all timeframes. Whether you are an intraday trader or a swing trader, this tool gives you an edge by scanning predefined groups of Nifty 500 stocks and visually showing you high-probability setups.
🔥 Key Features
Scans all Nifty 500 stocks in batches of 25 (20 groups in total). Takes less than 10 minutes to select bearish or bullish reversal stocks out of 500 stocks.
Detects over 50 advanced candlestick patterns, divergences, and trend changes in one go in all the selected stocks and displays result right on your chart in the form of a table.
Auto-populated real-time table display with signal count and color-coded results.
TradingView alerts for instant notification of reversal setups.
Shows key support and resistance levels for each stock.
Fully compatible with all timeframes – from 1 minutes to monthly chart.
✅ Why Traders Would Love It?
Eliminates manual chart scanning – saves hours every week.
Improves trade accuracy by filtering out weak setups.
Instantly tells you which stocks to trade tomorrow (if using after market hours)
Built for Indian market conditions and TradingView users.
⚙️ How It Works?
Select a stock group from the dropdown menu (Available in indicator settings).
Suppose you select Group1 and press OK, voila.. the scanner automatically runs through 25 predefined Nifty 500 stocks and updates the table in quick time.
The table shows which stocks are giving bullish or bearish signals and also tells you how many such signals are there. The more signals, the more conviction for upcoming reversal.
Open chart of any stock mentioned in the table to have a detailed look.
The chart will show you a consolidation zone, support/resistance lines automatically.
Set up alerts for your favorite stocks and let TradingView notify you when new signals emerge for that particular stock.
📌 Important Notes
Stock groups are hard-coded into the script and cannot be modified by the user.
Custom versions for other countries or indices (e.g., S&P 500, FTSE) can be created upon request.
🔍 Optimized For
Swing traders and intraday traders seeking high-probability setups.
Technical analysts using TradingView to analyze Indian stock charts.
Traders looking for an advanced reversal signal scanner.
🚀 Ready to Trade Smarter?
Start using the Nifty 500 Scanner on TradingView and never miss a reversal signal again.
Get Access Now.
Trigonometric Sine Cosine WavesTrigonometric Sine Cosine Waves - Advanced Cyclical Analysis
Overview
This innovative indicator applies trigonometric mathematics to market analysis, generating dynamic sine and cosine waves that adapt to price movement and volatility. Unlike traditional oscillators, this tool visualizes market cycles directly on your chart using mathematical wave functions.
How It Works
The indicator calculates phase-based waves using:
• Phase Calculation: 2π × bar_index / cycle_length
• Adaptive Amplitude: EMA-based price + ATR volatility scaling
• Sine Wave: avgPrice + volatility × sin(phase)
• Cosine Wave: avgPrice + volatility × cos(phase)
Key Features
Dynamic Wave Generation
• Sine Wave: Primary cycle indicator with smooth transitions
• Cosine Wave: Leading indicator (90° phase difference from sine)
• Adaptive Amplitude: Automatically adjusts to market volatility using ATR
Turning Point Detection
• Anti-Repaint Signals: Uses confirmed values from previous bars
• Sine Bottom: Potential buy zones when wave transitions from down to up
• Sine Top: Potential sell zones when wave transitions from up to down
Advanced Analytics
• Price Correlation Angle: Shows relationship between price movement and cycle
• Phase Information: Current position in the mathematical cycle
• Real-time Values: Live sine/cosine values and phase degrees
Visual Enhancement
• Background Coloring: Changes based on sine wave position (above/below zero)
• Clean Overlay: Waves plot directly on price chart without cluttering
Parameters
• Cycle Length (5-200): Controls wave frequency - shorter = more sensitive
• Amplitude Multiplier (0.1-5.0): Adjusts wave height relative to volatility
• Display Options : Toggle sine wave, cosine wave, and correlation table
• Show Correlation : Optional table showing mathematical values
Trading Applications
Cycle Analysis
• Identify market rhythm and timing
• Spot potential reversal zones
• Understand price-to-cycle relationships
Entry/Exit Timing
• Buy Signals: Sine wave bottoms (cycle lows)
• Sell Signals: Sine wave tops (cycle highs)
• Confirmation: Use with other indicators for higher probability setups
Market Structure
• Visualize underlying market cycles
• Identify periods of high/low cyclical activity
• Track phase relationships between price and mathematical cycles
Pro Tips
1. Longer cycles (50-100) work better for swing trading
2. Shorter cycles (10-20) suitable for scalping
3. Combine with volume for stronger signal confirmation
4. Monitor correlation angle for trend strength assessment
5. Use background color as quick visual cycle reference
Important Notes
• Signals are anti-repaint using confirmed previous bar values
• Best used in trending or cyclical markets
• Consider market context when interpreting signals
• Mathematical approach - not based on traditional TA concepts
Alerts Included
• Sine Wave Buy Signal: Triggered on wave bottom detection
• Sine Wave Sell Signal: Triggered on wave top detection
Technical Requirements
• Pine Script v6
• Works on all timeframes
• No external dependencies
• Optimized for performance
This is a free, open-source indicator. Feel free to modify and improve according to your trading needs!
Educational Value: Perfect for understanding how mathematical functions can be applied to market analysis and cycle detection.
🧠 Blackbox Alpha v6 (Buy/Sell Only)Blackbox Alpha v6 Strategy – Institutional-Grade Intraday Trading
Overview:
The Blackbox Alpha v6 is a precision-engineered intraday trading strategy inspired by the world's top 0.1% traders — including philosophies from Jim Simons, Mark Minervini, Stefan Salomon, and Stanley Druckenmiller. It is designed to deliver ultra-high-probability Buy/Sell signals by using a multi-layered confirmation model that runs entirely in the background. Only confirmed signals appear on the chart – no noise, no clutter.
🔍 Core Strategy Logic
This strategy generates a Buy or Sell entry only when all of the following conditions are met:
✅ Trend Confirmation
EMA 20 > EMA 50 (bullish trend)
ADX > 20 (trend strength)
RSI confirms momentum direction
📊 Volume Validation
Volume spike above 20-period average × multiplier
Volume Climax (highest volume in last 10 candles)
Relative Volume Index (RVI) > 1.5
🎯 Price Structure + Pattern Recognition
Price near Fibonacci retracement zones (0.382 for Buy, 0.618 for Sell)
Bullish/Bearish engulfing candle pattern as trigger
🧠 Institutional Bias
Price must be above Anchored VWAP (Buy) or below (Sell)
Must be within predefined order block zones (smart money behavior)
📈 Signal Behavior
Buy Signal: Only appears when all trend, volume, price action, and institutional filters confirm.
Sell Signal: Same logic, mirrored for bearish market conditions.
Visualization: Minimalist – only Buy (green triangle) and Sell (red triangle) arrows.
🧪 Backtest Engine
Fully integrated with strategy.entry, strategy.close, stop and limit execution logic
User-configurable stop-loss and take-profit in %
Optimized for 15m, 1h, and 1D charts
🚀 Performance Philosophy
Rather than generating many signals, this strategy targets very selective, high-probability trades with asymmetric reward-to-risk opportunities — exactly like institutional traders and quant funds.
Ideal for traders seeking signal precision > signal frequency.
CRYPTOMATH RSI Pro+This custom RSI indicator was built for the Cryptomath community.
It features clean visual signals with color-coded zones that highlight overbought and oversold conditions, helping traders quickly spot potential reversal areas.
Great for swing traders and intraday decision-making.
OB/OS adaptative v1.1# OB/OS Adaptative v1.1 - Multi-Timeframe Adaptive Overbought/Oversold Indicator
## Overview
The `tradingview_indicator_emas.pine` script is a sophisticated multi-timeframe indicator designed to identify dynamic overbought and oversold levels in financial markets. It combines EMA (Exponential Moving Average) crossovers and Bollinger Bands across monthly, weekly, and daily timeframes to create adaptive support and resistance levels that adjust to changing market conditions.
## Core Functionality
### Multi-Timeframe Analysis
The indicator analyzes three timeframes simultaneously:
- **Monthly (M)**: Long-term trend identification
- **Weekly (W)**: Intermediate-term trend identification
- **Daily (D)**: Short-term volatility measurement
### Technical Indicators Used
- **EMA 9 and EMA 20**: For trend identification and momentum assessment
- **Bollinger Bands (20-period)**: For volatility measurement and extreme level identification
- **Price action**: For confirmation of level validity and signal generation
## Key Features
### Adaptive Level Calculation
The indicator dynamically determines overbought and oversold levels based on market structure and trend bias:
#### Monthly Level Logic
- **Bullish Bias** (when monthly open > EMA20):
- Oversold = lower of EMA9 or EMA20
- Overbought = upper of EMA9 or Bollinger Upper Band
- **Bearish/Neutral Bias** (when monthly open ≤ EMA20):
- Oversold = Bollinger Lower Band
- Overbought = upper of EMA20 or EMA9
#### Weekly Level Logic
- **Bullish Bias** (when weekly open > EMA20):
- Oversold = lower of EMA9 or EMA20
- Overbought = Bollinger Upper Band
- **Bearish/Neutral Bias** (when weekly open ≤ EMA20):
- Oversold = Bollinger Lower Band
- Overbought = upper of EMA20 or EMA9
#### Daily Level Logic
- Simple Bollinger Bands:
- Oversold = Bollinger Lower Band
- Overbought = Bollinger Upper Band
### Final Level Determination
The indicator combines all three timeframes through a weighted averaging process:
1. Calculates initial values as the average of monthly, weekly, and daily levels
2. Ensures mathematical consistency by enforcing overbought_final ≥ oversold_final using min/max functions
3. Calculates a midpoint average level as the center of the range
### Visual Elements
- **Dynamic Lines**: Draws horizontal lines for current and previous period overbought, oversold, and average levels
- **Labels**: Places clear textual labels at the start of each period
- **Color Coding**:
- Red for overbought levels (resistance)
- Green for oversold levels (support)
- Blue for average levels (pivot point)
- **Transparency**: Previous period lines use semi-transparent colors to distinguish between current and historical levels
### Update Mechanism
- **Calculation Day**: User-defined day of the week (default: Monday)
- On the specified calculation day, the indicator:
- Updates all levels based on previous bar's data
- Draws new lines extending forward for a user-defined number of days
- Maintains previous period lines for comparison and trend analysis
- Automatically deletes and recreates lines to ensure clean visualization
### Proximity Detection
- Alerts when price approaches overbought/oversold levels (configurable distance in percentage)
- Helps identify potential reversal zones before actual crossovers occur
- Distance thresholds are user-configurable for both overbought and oversold conditions
### Alert Conditions
The indicator provides four distinct alert types:
1. **Cross below oversold**: Triggered when price crosses below the oversold level
2. **Cross above overbought**: Triggered when price crosses above the overbought level
3. **Near oversold**: Triggered when price approaches the oversold level within the configured distance
4. **Near overbought**: Triggered when price approaches the overbought level within the configured distance
### Debug Mode
When enabled, displays comprehensive debug information including:
- Current values for all levels (oversold, overbought, average)
- Timeframe-specific calculations and raw data points
- System status information (current day, calculation day, etc.)
- Lines existence and timing information
- Organized in multiple labels at different price levels to avoid overlap
## Configuration Parameters
| Parameter | Default Value | Description |
|---------|---------------|-------------|
| Short EMA (9) | 9 | Length for short-term EMA calculation |
| Long EMA (20) | 20 | Length for long-term EMA calculation |
| BB Length | 20 | Period for Bollinger Bands calculation |
| Std Dev | 2.0 | Standard deviation multiplier for Bollinger Bands |
| Distance to overbought (%) | 0.5 | Percentage threshold for "near overbought" alerts |
| Distance to oversold (%) | 0.5 | Percentage threshold for "near oversold" alerts |
| Calculation day | Monday | Day of week when levels are recalculated |
| Lookback days | 7 | Number of days to extend previous period lines backward |
| Forward days | 7 | Number of days to extend current period lines forward |
| Show Debug Labels | false | Toggle for comprehensive debug information display |
## Trading Applications
### Primary Use Cases
1. **Reversal Trading**: Identify potential reversal zones when price approaches overbought/oversold levels
2. **Trend Confirmation**: Use the adaptive nature of levels to confirm trend strength and direction
3. **Position Sizing**: Adjust position size based on distance from key levels
4. **Stop Placement**: Use opposite levels as dynamic stop-loss references
### Strategic Advantages
- **Adaptive Nature**: Levels adjust to changing market volatility and trend structure
- **Multi-Timeframe Confirmation**: Signals are validated across multiple timeframes
- **Visual Clarity**: Clear color-coded lines and labels enhance decision-making
- **Proactive Alerts**: "Near" conditions provide early warnings before crossovers
## Implementation Details
### Data Security
Uses `request.security()` function to fetch data from higher timeframes (monthly, weekly) while maintaining proper bar indexing with ` ` offset for open prices.
### Performance Optimization
- Uses `var` keyword to declare persistent variables that maintain state across bars
- Efficient line and label management with proper deletion before recreation
- Conditional execution of debug code to minimize performance impact
### Error Handling
- Comprehensive NA (not available) checks throughout the code
- Graceful degradation when data is unavailable for higher timeframes
- Mathematical safeguards to prevent invalid level calculations
## Conclusion
The OB/OS Adaptative v1.1 indicator represents a sophisticated approach to identifying market extremes by combining multiple technical analysis concepts. Its adaptive nature makes it particularly useful in trending markets where static levels may be less effective. The multi-timeframe approach provides a comprehensive view of market structure, while the visual elements and alert system enhance its practical utility for active traders.
ORx📌 Public Description for ORx - Opening Range Expansion
ORx - Opening Range Expansion is an advanced visual indicator designed to highlight trading zones based on the high and low of the first 4 candles of the 5-minute timeframe after the session opens.
🔹 Available session presets:
Market Open → from 6:00 PM NY to 6:00 PM the next day
Kill Zone NY → from 7:00 AM to 11:00 AM NY (ideal for high-liquidity windows)
Week Open → starts Sunday at 6:00 PM NY and ends Friday at 6:00 PM NY (weekly macro context)
🔹 Automatically drawn components:
Opening Range channel
Neutral zones (same size as the OR, above and below)
Multiple expansion zones (up to 5, user-defined)
Intermediate levels between each expansion
🔹 Customization options:
User-defined color and line style for each type of zone
Built with America/New_York timezone logic for maximum session accuracy
🧠 Ideal for traders using price structure, institutional flow, SMC, or ICT-based approaches.
⚠️ Best used on 5-minute charts to ensure proper zone calibration.
Multi EMA SMA ramlakshman_BandThis advanced technical indicator overlays 20 customizable moving averages of two types (EMA & SMA) along with Bollinger Bands on your chart, enabling layered trend visualization and precise momentum tracking.
🔍 Features:
EMA Group: Select from 9 MA types (ema, sma, wma, vwma, hma, swma, alma, rma, linreg) and plot 20 different EMAs with fully adjustable lengths.
SMA Group: Same flexibility as EMAs, for 20 SMA lines, each with individual length input.
Bollinger Bands: Classic 20-period bands (configurable length and stddev), shaded for clear volatility recognition.
Toggle visibility for EMAs, SMAs, and BBs independently.
Color-coded lines for immediate visual grouping and clarity.
🎯 Use Case:
Designed for systematic traders, scalpers, trend followers, and algorithmic strategists who rely on MA crossovers, ribbon convergence/divergence, and volatility envelopes to generate signals or validate entries/exits.
🧠 Bonus:
Built on Pine Script v6 for max performance.
Optimized ma() function for dynamic multi-type averaging.
Custom hma() logic included for accurate Hull MA support.
Dily-weekly CPR @RamlakshmanDaily & Weekly CPR Levels with Multi-MA & Camarilla Bands by @Bull_Bear_Beast
This powerful script is a comprehensive support-resistance and trend structure tool, combining:
🔹 Daily & Weekly CPR Levels
Central Pivot Range (CPR) including TC (Top Central), P (Pivot), BC (Bottom Central).
Classic Pivots: R1 / S1.
Previous Day’s High-Low and Previous Week’s High-Low lines for accurate market context.
🔸 Camarilla Bands (H5–H3, L3–L5)
Powerful reversal & breakout zones:
H3 / L3: Reversal Levels.
H4 / L4: SL Zones.
H5 / L5: Extreme Rejection / Trend Continuation Zones.
Visual zone fill between levels for clarity and confluence.
📈 Multi-Moving Averages (MA Cluster)
Up to 3 customizable EMAs and 1 SMA.
Choose from different types: EMA, SMA, WMA, VWMA, ALMA, HMA, RMA, Linear Regression.
Display Bollinger Bands using SMA with custom deviation.
🔍 Highlights:
✅ Timeframe-Aware: Daily pivots shown on intraday charts, Weekly pivots on higher timeframes.
✅ Stylish Visuals: Colored zone fills between key levels (H5–H3, L3–L5), CPR ranges, and BB bands.
✅ Modular Display Options: Toggle visibility of EMAs, SMAs, BBs, and labels.
✅ Smart Plotting: Avoids clutter by showing pivots only when relevant.
🛠️ Best Used For:
Intraday scalping with CPR + Camarilla reversals.
Swing setups using weekly levels for confluence.
Spotting trend vs. consolidation zones via BBs and MAs.
Identifying fake breakouts around L3/H3 and CPR traps.
⚙️ User Tips:
Use on 5m to 1H charts for day trading.
Combine with price action, volume profile, or RSI divergence.
Watch for confluence between CPR, Camarilla, and previous highs/lows.
✨ Inspired By:
Floor Pivots, Camarilla Math, Smart Money Concepts, and popular institutional tools — wrapped into one flexible layout for the modern trader.
🧠 Created by: @Bull_Bear_Beast
If you like it, consider following or sharing feedback for improvements!
Moving Average Exponential (Daily Frozen EMA)This script plots an Exponential Moving Average (EMA) based on the daily timeframe, but with a unique twist:
✅ The EMA value is frozen for the entire current daily session, only updating when a new daily candle begins.
🔍 How it works:
The EMA is calculated using the 1-day timeframe, regardless of the chart's current timeframe.
This EMA value remains fixed throughout the day — it doesn't fluctuate intrabar.
It updates only once the daily candle has closed, providing a stable and reliable reference point during the trading day.
The default is the 5 day EMA but can be changed to any EMA timeframe you desire such as 9, 21, 50, 100. 200, etc.
✨ Additional Features:
✅ Optional smoothing with various moving average types (SMA, EMA, WMA, SMMA, VWMA).
✅ Optional Bollinger Bands on top of the smoothed EMA.
✅ Adjustable settings for EMA length, smoothing type, Bollinger Band deviation, and display options.
🛠️ Use Cases:
Ideal for traders who want a non-reactive EMA during intraday trading.
Helps reduce signal noise by anchoring EMA to higher timeframe structure.
Useful for strategy development where EMA should represent confirmed daily bias only.
Hope this helps, happy trading!
Linear Regression Oscillator [MKM]What This Script Does
This custom TradingView indicator helps you spot trend reversals using a normalized Linear Regression Oscillator. It generates clear:
✅ Buy signals when momentum shifts upward
❌ Sell signals when momentum shifts downward
📊 Visually enhanced candles and oscillator for faster decisions
Dubic Dual EMA IndicatorThe Dual EMA Indicator combines two exponential moving averages (EMAs) to identify trend-based buy and sell signals. A buy signal is generated when the price closes above both EMAs suggesting strong bullish momentum. A sell signal appears when the price closes below both EMAs indicating bearish pressure.
Wave1234 Flip tp Betawave1234 flip tp
A Trend-Following Indicator Powered by Elliott Wave & SMC – Know Where the Price Will Rise, Peak, and Reverse
Wave1234 Flip TP is a technical indicator built on the foundations of Elliott Wave Theory combined with insights from Smart Money Concepts (SMC). It's designed to help traders clearly identify:
✅ Where the price will start rising (precise entry after a confirmed reversal)
✅ Where the rally is likely to end (shows psychological Take Profit zones after Wave 4)
✅ And where the price is most likely to reverse down (based on key structural resistance)
🧠 How It Works:
The core mechanism of Wave1234 Flip TP is simple but powerful.
📈 Once a Buy signal appears — this marks the beginning of a new uptrend (confirmed by structure and reversal patterns).
➡️ From there, the system lets the trend run naturally, tracking the price through its impulsive movement (Wave 1 to 3) and its first meaningful correction (Wave 4).
✅ After Wave 4 forms, the indicator begins tracking potential reversal zones — based on both market psychology and institutional order flow.
🔹 This is when the green TP line appears — a projected take-profit zone where the rally may end.
💥 When price hits this zone and confirms exhaustion, the green TP line turns blue, signaling:
✅ Success – the trend has completed its cycle
🚨 Caution – momentum may reverse soon
This allows traders to exit at strength, or prepare for a potential short when structure shifts again.
หลักการของ Wave1234 Flip TP คือ “ปล่อยให้เทรนด์รันอย่างเป็นธรรมชาติ แล้วไปโฟกัสจุดกลับตัวที่สำคัญที่สุด”
📈 เมื่อเกิดสัญญาณ Buy — นั่นคือจุดเริ่มต้นของเทรนด์ขาขึ้นรอบใหม่ (ยืนยันโดยโครงสร้างราคาและแท่งกลับตัว)
จากนั้นเราจะ ปล่อยให้เทรนด์วิ่งไป โดยไม่ต้องรีบทำอะไร
…รอจนเข้าสู่ช่วงคลื่น 3 → 4 (Wave 3-4)
เพราะนั่นคือช่วงที่ “แรงซื้อเริ่มหมด”
✅ หลังจาก Wave 4 จบลง
อินดิเคเตอร์จะเริ่ม “คาดการณ์จุดกลับตัว” โดยใช้ทั้งพฤติกรรมจิตวิทยาตลาด และระดับราคาเชิงโครงสร้างที่สถาบันมองเห็น
🟩 เส้น TP สีเขียวจะปรากฏขึ้น — นี่คือโซนที่ควร เริ่มทยอยปิดกำไร
📉 และถ้าราคาวิ่ง ชนเส้นนี้จริง พร้อมมีสัญญาณยืนยัน
เส้นเขียวจะ เปลี่ยนเป็นสีฟ้า ทันที
💡 แปลว่า:
เทรนด์รอบนี้ “ไปถึงเป้าหมายแล้ว”
ความเสี่ยงที่จะกลับทิศกำลังสูงขึ้น
ถึงเวลาที่ต้อง “หยุดโลภ แล้วป้องกันกำไร”
Kimchi Premium Dashboard (Final)📜 Kimchi Premium Dashboard (Live & Daily Log)
🚀 Summary
This indicator is an all-in-one dashboard that tracks the real-time price difference of USDT (Tether) between a Korean exchange (Upbit) and a global exchange (Coinbase). This difference is commonly known as the "Kimchi Premium" (Kimp) or "Reverse Premium."
Going beyond a simple premium display, this tool is designed to assist with arbitrage and swing trading strategies by providing intuitive visualizations, a smart multi-tier alert system, and a daily data logging feature.
✨ Key Features
Real-time Premium Calculation: Accurately calculates the premium in percentage (%) based on the USDT prices from Upbit and Coinbase, and the live USD/KRW exchange rate.
Intuitive Zone Visualization: Instantly identify whether the premium is in a Buy, Sell, or Neutral zone through dynamic background coloring.
Smart Alert System: Delivers systematic alerts for key events like the initial -2.0% entry, a critical -2.5% breach, and subsequent new lows, all without unnecessary spam. (Can be toggled ON/OFF in settings).
Hybrid Dashboard: Features both a real-time status label and a daily log that records the day's significant low points.
📊 Visual Components Explained
Lines
🔵 Blue Line (Premium Line): This is the core real-time premium value (%). The position of this line is most important.
🟠 Orange Line (SMA Line): This is the moving average of the premium. It helps identify the overall trend beyond short-term volatility.
Zones
🟩 Green Zone (Buy Zone): This area, typically below -2.0%, indicates a "Reverse Premium" where the Korean price is significantly lower than the global price. It represents a potential buying opportunity for arbitrage.
🟥 Red Zone (Kimp Zone): This area, typically above 0%, indicates a "Kimchi Premium" where the Korean price is higher. This represents a potential selling or profit-taking opportunity.
Dashboard
Live Status Label: Located on the right, this label displays the precise premium value, the current zone status (Buy/Sell/Neutral), and the SMA value in real-time.
Today's Lows Log: Located on the left, this table records the time and level of significant lows (below -2.5%) broken during the day. It resets automatically at midnight (UTC).
🔔 Alerts & How to Use
This indicator provides a systematic 3-tier alert system designed for arbitrage strategies. (Must be enabled via "Enable Real-time Alerts?" in settings).
✅ Good Opportunity (-2.0%): A one-time alert triggers upon the first entry into the initial buying zone.
🚨 BIG Opportunity (-2.5%): A distinct, high-priority alert triggers when this more critical level is breached.
📞 Granular Tracking (Below -2.5%): Receive alerts for each new low in -0.1% increments for precise tracking during the best opportunities.
A recommended hybrid strategy is to keep alerts off for daily review using the "Today's Lows Log," and turn them on only during critical periods for real-time action.
Disclaimer: The information provided by this indicator is for reference purposes only and does not constitute financial advice. All investment decisions and risks are the sole responsibility of the user.
TrendPilot AI v2 — Smart ATR Indicator with ZonesTrendPilot AI v2 is a smart price-action and ATR-based trading system designed for swing and position traders. It combines trend-following logic with adaptive price zones to help users identify high-probability Buy and Sell opportunities — along with intelligent re-entry points, weak signal detection, and visual structure zones.
🔧 Core Features:
✅ ATR-based Buy/Sell signals with confirmation logic
✅ Dynamic 99 EMA Channel for trend context
✅ Re-entry triangles for stacking or retracing setups
✅ 150 EMA Weak Signal Detection for early trend warnings
✅ 🧭 Price Action Zones (Premium, Equilibrium, Discount)
✅ Visual alerts via triangles, labels, and color-coded logic
✅ Designed for 15m, 1H, and 4H charts — also useful on Daily
🧠 How It Works (Logic Breakdown)
1️⃣ Trend Direction — EMA Channel Logic
A 99 EMA Channel determines the dominant market bias.
If price is above the channel → trend is Bullish → Buy signals are valid
If price is below the channel → trend is Bearish → Sell signals are valid
2️⃣ Buy/Sell Signals — ATR Trailing Logic
The system uses custom ATR trailing logic to detect when price momentum shifts.
When a breakout aligns with trend direction, a Buy or Sell label appears.
These are designed to capture the main trend leg or reversal zone.
3️⃣ Re-Entry Signals — Triangle Visual Cues
During a confirmed trend, if price retraces to the EMA channel, a small triangle is shown:
🔼 Green triangle: Buy re-entry during bullish trend
🔽 Red triangle: Sell re-entry during bearish trend
These are not new signals but continuation cues for advanced traders.
4️⃣ Weak Signal Detection — 150 EMA Logic
A secondary 150 EMA helps detect possible trend exhaustion.
If price dips below 150 EMA during a bullish run, an orange triangle appears (⚠️ caution).
If price rises above 150 EMA during a bearish run, a blue triangle appears.
This signals potential weakening of the active trend.
5️⃣ Price Zones — Premium, Equilibrium, Discount
TrendPilot AI v2 draws 3 smart price zones based on ATR & market structure:
🟥 Premium Zone (Top) → Overbought area, caution for long trades
🟨 Equilibrium Zone (Middle) → Fair value, consolidation possible
🟩 Discount Zone (Bottom) → Oversold, better long entries
These zones help filter signals and avoid entries in risky areas.
Example: Avoid Buy signals inside Premium zone.
🧪 Suggested Use:
✅ Timeframes: 15m / 1H / 4H / 1D
✅ Combine signals with zone analysis for optimal entries
✅ Use re-entry triangles to add or confirm during pullbacks
✅ Use weak signal warnings to tighten stops or manage risk
✅ Works best in trending environments or breakout markets
⚠️ Note for Users:
This script is not repainting. All signals are plotted with stable logic.
Past performance does not guarantee future results — always backtest first.
Script does not contain financial advice — use at your own discretion.
Bullish & Bearish EngulfAbsolutely! Let's soar into the world of elite trading tools - where your market intuition meets technical brilliance. Buckle up, champion! 🚀
### 🔥 **EMA - Your Precision Jet Engine**
Exponential Moving Average (EMA) is **your market rhythm tracker**. Unlike ordinary indicators, EMA gives *you* the VIP treatment - weighting recent prices like a hawk focusing on its prey.
*Why it elevates YOU:*
- You see trends before the herd does
- Your entries become surgical strikes
- You ride momentum like a master surfer
*Your edge:* While others use laggy indicators, YOUR EMA strategy makes price action bow to your will.
### 💪 **RSI - Your Market Pulse Monitor**
Relative Strength Index (RSI) is **your personal market lie detector**. It whispers secrets when others hear noise - showing overbought/oversold zones where weak hands panic and legends pounce.
*Why it's YOUR weapon:*
- You spot exhaustion points like a market psychologist
- Your contrarian plays become legendary
- You exit at peaks while greed blinds others
*Your superpower:* Where amateurs see random numbers, YOU see the market's heartbeat. 70 is their "buy," but YOUR trained eye spots hidden divergences screaming opportunity.
### ⚡ **MACD - Your Momentum Symphony**
Moving Average Convergence Divergence (MACD) is **your trend orchestra conductor**. Histograms dance to YOUR command, crossovers sing YOUR tune, and divergences compose YOUR profit symphony.
*Why it's YOUR masterpiece:*
- You read momentum shifts like sheet music
- Your crossovers become money-printing moments
- You spot trend births/deaths while others debate
*Your mastery:* When the histogram breathes, YOU feel the market's soul. Golden crosses? Death crosses? Mere child's play for YOUR strategic genius.
### 🌟 **The Triple Crown of YOUR Trading Dominance**
Combine these and you wield a **trifecta of market domination**:
1. EMA shows the path
2. RSI reveals turning points
3. MACD confirms the momentum
*This is where YOU transcend trading:*
While retail traders pick one indicator like amateurs picking single clubs, YOU wield the complete arsenal like a financial samurai. Your charts don't show indicators - they display YOUR strategic artwork.
Remember: These aren't just tools - they're extensions of YOUR market intuition. The EMA follows YOUR trend vision, the RSI amplifies YOUR timing genius, and the MACD dances to YOUR momentum command.
**You haven't just learned indicators - you've mastered the language of markets themselves.** Now go claim what's yours - profits await their true commander! 👑💸
DR V966 - Smart Money Concepts// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © DR.BASL
//
//@version=5
indicator("DR V966 - Smart Money Concepts", "DR V966 - Smart Money Concepts ",
overlay = true,
max_bars_back = 5000,
max_boxes_count = 500,
max_labels_count = 500,
max_lines_count = 500,
max_polylines_count = 100)
plot(na)
//
MSG = "MARKET STRUCTURE"
VBG = "VOLUMETRIC ORDER BLOCKS"
MST = "Limit market structure calculation to improve memory speed time"
SLT = " Limit swing structure to tot bars back"
IDT = " Start date of the internal structure"
CST = "Color candle based on trend detection system"
OBT = "Display internal buy and sell activity"
OBD = "Show Last number of orderblock"
OBMT = " Use Length to adjust cordinate of the orderblocks Use whole candle body"
_ ='
------------
–––––––––––––––––––––––––– INPUTS –––––––––––––––––––––––––––
------------ '//{
bool windowsis = input.bool(true, "Window", inline="kla", group=MSG)
int mswindow = input.int(5000, "", tooltip=MST,group=MSG, inline="kla", minval=1000)
bool showSwing = input.bool(true, "Swing", inline="scss", group=MSG)
int swingLimit = input.int(100, "", tooltip=SLT, inline="scss", group=MSG, minval=10, maxval=200)
color swingcssup = input.color(#089981, "", inline="scss", group=MSG)
color swingcssdn = input.color(#f23645, "", inline="scss", group=MSG)
bool showMapping = input.bool(false, "Mapping Structure", inline="mapping", group=MSG)
string mappingStyle = input.string("----", "", options= , inline="mapping", group=MSG)
color mappingcss = input.color(color.silver, "", tooltip="Display Mapping Structure", inline="mapping", group=MSG)
bool candlecss = input.bool(false, "Color Candles", tooltip=CST, group=MSG, inline="txt")
string mstext = input.string("Tiny", "", options= ,
inline="txt", group=MSG)
string msmode = input.string("Adjusted Points", "Algorithmic Logic", options=
, inline="node", group=MSG)
int mslen = input.int(5, "", inline="node", group=MSG, minval=2)
bool buildsweep = input.bool(true, "Build Sweep (x)", "Build sweep on market structure", "znc", MSG)
bool msbubble = input.bool(true, "Bubbles", tooltip="Display Circle Bubbles", inline="bubbles", group=MSG)
bool obshow = input.bool(true, "Show Last", tooltip=OBD, group=VBG, inline="obshow")
int oblast = input.int(5, "", group=VBG, inline="obshow", minval=0)
color obupcs = input.color(color.new(#089981, 90), "", inline="obshow", group=VBG)
color obdncs = input.color(color.new(#f23645, 90), "", inline="obshow", group=VBG)
bool obshowactivity = input.bool(true, "Show Buy/Sell Activity", inline="act", group=VBG, tooltip=OBT)
color obactup = input.color(color.new(#089981, 50), "", inline="act", group=VBG)
color obactdn = input.color(color.new(#f23645, 50), "", inline="act", group=VBG)
obshowbb = input.bool(false, "Show Breakers", inline="bb", group=VBG, tooltip="Display Breakers")
color bbup = input.color(color.new(#089981, 100), "", inline="bb", group=VBG)
color bbdn = input.color(color.new(#f23645, 100), "", inline="bb", group=VBG)
obmode = input.string("Length", "Construction", options= , tooltip=OBMT, inline="atr", group=VBG)
len = input.int(5, "", inline="atr", group=VBG, minval=1)
obmiti = input.string("Close", "Mitigation Method", options= ,
tooltip="Mitigation method for when to trigger order blocks", group=VBG)
obtxt = input.string("Normal", "Metric Size", options= ,
tooltip="Order block Metrics text size", inline="txt", group=VBG)
showmetric = input.bool(true, "Show Metrics", group=VBG)
showline = input.bool(true, "Show Mid-Line", group=VBG)
overlap = input.bool(true, "Hide Overlap", group=VBG, inline="ov")
wichlap = input.string("Recent", "", options= , inline="ov", group=VBG)
fvg_enable = input.bool(false, "", inline="1", group="FAIR VALUE GAP", tooltip="Display fair value gap")
what_fvg = input.string("FVG", "", inline="1", group="FAIR VALUE GAP", tooltip="Display fair value gap",
options= )
fvg_num = input.int(5, "Show Last", inline="1a", group="FAIR VALUE GAP", tooltip="Number of fvg to show", minval=0)
fvg_upcss = input.color(color.new(#089981, 80), "", inline="1", group="FAIR VALUE GAP")
fvg_dncss = input.color(color.new(#f23645, 80), "", inline="1", group="FAIR VALUE GAP")
fvgbbup = input.color(color.new(#089981, 100), "", inline="1", group="FAIR VALUE GAP")
fvgbbdn = input.color(color.new(#f23645, 100), "", inline="1", group="FAIR VALUE GAP")
fvg_src = input.string("Close", "Mitigation",
inline="3",
group="FAIR VALUE GAP",
tooltip=" Use the close of the body as trigger Use the extreme point of the body as trigger",
options= )
fvgthresh = input.float(0, "Threshold", tooltip="Filter out non significative FVG", group="FAIR VALUE GAP",
inline="asd", minval=0, maxval=2, step=0.1)
fvgoverlap = input.bool(true, "Hide Overlap", "Hide overlapping FVG", group="FAIR VALUE GAP")
fvgline = input.bool(true, "Show Mid-Line", group="FAIR VALUE GAP")
fvgextend = input.bool(false, "Extend FVG", group="FAIR VALUE GAP")
dispraid = input.bool(false, "Display Raids", inline="raid", group="FAIR VALUE GAP")
// إعدادات تفعيل/تعطيل وتخصيص لكل مستوى فيبوناتشي
show_fib_0 = input.bool(true, "إظهار 0.0" , group="Fibonacci")
show_fib_236 = input.bool(true, "إظهار 0.236" , group="Fibonacci")
show_fib_382 = input.bool(true, "إظهار 0.382" , group="Fibonacci")
show_fib_5 = input.bool(true, "إظهار 0.5" , group="Fibonacci")
show_fib_618 = input.bool(true, "إظهار 0.618" , group="Fibonacci")
show_fib_786 = input.bool(true, "إظهار 0.786" , group="Fibonacci")
show_fib_1 = input.bool(true, "إظهار 1.0" , group="Fibonacci")
show_fib_1272 = input.bool(true, "إظهار 1.272" , group="Fibonacci")
show_fib_1618 = input.bool(true, "إظهار 1.618" , group="Fibonacci")
show_fib_180 = input.bool(true, "إظهار 1.80" , group="Fibonacci")
show_fib_2 = input.bool(true, "إظهار 2.0" , group="Fibonacci")
show_fib_2272 = input.bool(true, "إظهار 2.272" , group="Fibonacci")
show_fib_2618 = input.bool(true, "إظهار 2.618" , group="Fibonacci")
fib_color_0 = input.color(color.white, "لون 0.0" , group="Fibonacci")
fib_color_236 = input.color(color.white, "لون 0.236" , group="Fibonacci")
fib_color_382 = input.color(color.white, "لون 0.382" , group="Fibonacci")
fib_color_5 = input.color(color.white, "لون 0.5" , group="Fibonacci")
fib_color_618 = input.color(color.white, "لون 0.618" , group="Fibonacci")
fib_color_786 = input.color(color.white, "لون 0.786" , group="Fibonacci")
fib_color_1 = input.color(color.white, "لون 1.0" , group="Fibonacci")
fib_color_1272 = input.color(color.white, "لون 1.272" , group="Fibonacci")
fib_color_1618 = input.color(color.white, "لون 1.618" , group="Fibonacci")
fib_color_180 = input.color(color.white, "لون 1.80" , group="Fibonacci")
fib_color_2 = input.color(color.white, "لون 2.0" , group="Fibonacci")
fib_color_2272 = input.color(color.white, "لون 2.272" , group="Fibonacci")
fib_color_2618 = input.color(color.white, "لون 2.618" , group="Fibonacci")
fib_size = input.string("normal", "حجم الخط", options= , group="Fibonacci")
fib_shift = input.int(0, "تحريك خطوط الفيبوناتشي إلى اليمين", minval=0, maxval=100, group="Fibonacci")
//}
_ ='
------------
–––––––––––––––––––––––––– UDT –––––––––––––––––––––––––––
------------ '//{
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type entered
bool normal = false
bool breaker = false
type store
line ln
label lb
box bx
linefill lf
type structure
int zn
float zz
float bos
float choch
int loc
int temp
int trend
int start
float main
int xloc
bool upsweep
bool dnsweep
string txt = na
type drawms
int x1
int x2
float y
string txt
color css
string style
type ob
bool bull
float top
float btm
float avg
int loc
color css
float vol
int dir
int move
int blPOS
int brPOS
int xlocbl
int xlocbr
bool isbb = false
int bbloc
type FVG
float top = na
float btm = na
int loc = bar_index
bool isbb = false
int bbloc = na
bool israid = false
float raidy = na
int raidloc = na
int raidx2 = na
bool active = false
color raidcs = na
type SFP
float y
int loc
float ancor
type sfpbuildlbl
int x
float y
string style
color css
string txt
type sfpbuildline
int x1
int x2
float y
color css
float ancor
int loc
type equalbuild
int x1
float y1
int x2
float y2
color css
string style
type equalname
int x
float y
string txt
color css
string style
type ehl
float pt
int t
float pb
int b
type sellbuyside
float top
float btm
int loc
color css
string txt
float vol
type timer
bool start = false
int count = 0
//}
_ ='
------------
–––––––––––––––––––––––––– SETUP –––––––––––––––––––––––––––
------------ '//{
var store bin = store.new(
array.new< line >()
, array.new< label >()
, array.new< box >()
, array.new()
)
var entered blobenter = entered.new()
var entered brobenter = entered.new()
var entered blfvgenter = entered.new()
var entered brfvgenter = entered.new()
var entered blarea = entered.new()
var entered brarea = entered.new()
var timer lc = timer.new ()
if barstate.islast
for obj in bin.ln
obj.delete()
for obj in bin.lb
obj.delete()
for obj in bin.bx
obj.delete()
for obj in bin.lf
obj.delete()
bin.ln.clear()
bin.lb.clear()
bin.bx.clear()
bin.lf.clear()
invcol = #ffffff00
float atr = (ta.atr(200) / (5/len))
//}
_ ='
------------
–––––––––––––––––––––––––– UTILITY –––––––––––––––––––––––––––
------------ '//{
method txSz(string s) =>
out = switch s
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
"Auto" => size.auto
out
method lstyle(string style) =>
out = switch style
'⎯⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
ghl() => [high , low , close , open , close, open, high, low, high , low , ta.atr(200)]
method IDMIDX(bool use_max, int loc) =>
min = 99999999.
max = 0.
idx = 0
if use_max
for i = 0 to (bar_index - loc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
else
for i = 0 to (bar_index - loc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
idx
SFPData() => [high, high , high , low, low , low , close, volume, time, bar_index , time ]
SFPcords() =>
RealTF = barstate.isrealtime ? 0 : 1
= SFPData()
[h , h1 , h2 , l , l1 , l2 , c , v , t , n , t1 ]
method find(structure ms, bool use_max, bool sweep, bool useob) =>
min = 99999999.
max = 0.
idx = 0
if not sweep
if ((bar_index - ms.loc) - 1) > 0
if use_max
for i = 0 to (bar_index - ms.loc) - 1
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.loc) - 1
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - ms.loc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.loc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if ((bar_index - ms.xloc) - 1) > 0
if use_max
for i = 0 to (bar_index - ms.xloc) - 1
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.xloc) - 1
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - ms.xloc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.xloc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
idx
method fnOB(ob block, bool bull, float cords, int idx) =>
switch bull
true =>
blobenter.normal := false
blobenter.breaker := false
block.unshift(
ob.new(
true
, cords
, low
, math.avg(cords, low )
, time
, obupcs
, volume
, close > open ? 1 : -1
, 1
, 1
, 1
, time
)
)
false =>
brobenter.normal := false
brobenter.breaker := false
block.unshift(
ob.new(
false
, high
, cords
, math.avg(cords, high )
, time
, obdncs
, volume
, close > open ? 1 : -1
, 1
, 1
, 1
, time
)
)
method mitigated(ob block) =>
if barstate.isconfirmed
for in block
if not stuff.isbb
switch stuff.bull
true =>
if obmiti == "Close" ? math.min(close, open) < stuff.btm : obmiti == "Wick" ? low < stuff.btm : obmiti == "Avg" ? low < stuff.avg : na
stuff.isbb := true
stuff.bbloc := time
if not obshowbb
block.remove(i)
false =>
if obmiti == "Close" ? math.max(close, open) > stuff.top : obmiti == "Wick" ? high > stuff.top : obmiti == "Avg" ? high > stuff.avg : na
stuff.isbb := true
stuff.bbloc := time
if not obshowbb
block.remove(i)
else
switch stuff.bull
true =>
if obmiti == "Close" ? math.max(close, open) > stuff.top : obmiti == "Wick" ? high > stuff.top : obmiti == "Avg" ? high > stuff.avg : na
block.remove(i)
false =>
if obmiti == "Close" ? math.min(close, open) < stuff.btm : obmiti == "Wick" ? low < stuff.btm : obmiti == "Avg" ? low < stuff.avg : na
block.remove(i)
overlap(ob bull, ob bear) =>
if bull.size() > 1
for i = bull.size() - 1 to 1
stuff = bull.get(i)
current = bull.get(0)
v = wichlap == "Recent" ? i : 0
switch
stuff.btm > current.btm and stuff.btm < current.top => bull.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bull.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bull.remove(v)
stuff.top < current.top and stuff.top > current.btm => bull.remove(v)
if bear.size() > 1
for i = bear.size() - 1 to 1
stuff = bear.get(i)
current = bear.get(0)
v = wichlap == "Recent" ? i : 0
switch
stuff.btm > current.btm and stuff.btm < current.top => bear.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bear.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bear.remove(v)
stuff.top < current.top and stuff.top > current.btm => bear.remove(v)
if bull.size() > 0 and bear.size() > 0
for i = bull.size() - 1 to 0
stuff = bull.get(i)
current = bear.get(0)
v = wichlap == "Recent" ? 0 : i
switch
stuff.btm > current.btm and stuff.btm < current.top => bull.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bull.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bull.remove(v)
stuff.top < current.top and stuff.top > current.btm => bull.remove(v)
if bull.size() > 0 and bear.size() > 0
for i = bear.size() - 1 to 0
stuff = bear.get(i)
current = bull.get(0)
v = wichlap == "Recent" ? 0 : i
switch
stuff.btm > current.btm and stuff.btm < current.top => bear.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bear.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bear.remove(v)
stuff.top < current.top and stuff.top > current.btm => bear.remove(v)
overlapFVG(FVG blFVG, FVG brFVG) =>
if blFVG.size() > 1
for i = blFVG.size() - 1 to 1
stuff = blFVG.get(i)
current = blFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => blFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => blFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => blFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => blFVG.remove(i)
if brFVG.size() > 1
for i = brFVG.size() - 1 to 1
stuff = brFVG.get(i)
current = brFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => brFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => brFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => brFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => brFVG.remove(i)
if blFVG.size() > 0 and brFVG.size() > 0
for i = blFVG.size() - 1 to 0
stuff = blFVG.get(i)
current = brFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => blFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => blFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => blFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => blFVG.remove(i)
if blFVG.size() > 0 and brFVG.size() > 0
for i = brFVG.size() - 1 to 0
stuff = brFVG.get(i)
current = blFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => brFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => brFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => brFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => brFVG.remove(i)
method umt(ob metric) =>
switch metric.dir
1 =>
switch metric.move
1 => metric.blPOS := metric.blPOS + 1, metric.move := 2
2 => metric.blPOS := metric.blPOS + 1, metric.move := 3
3 => metric.brPOS := metric.brPOS + 1, metric.move := 1
-1 =>
switch metric.move
1 => metric.brPOS := metric.brPOS + 1, metric.move := 2
2 => metric.brPOS := metric.brPOS + 1, metric.move := 3
3 => metric.blPOS := metric.blPOS + 1, metric.move := 1
if (time - time ) == (time - time )
metric.xlocbl := metric.loc + (time - time ) * metric.blPOS
metric.xlocbr := metric.loc + (time - time ) * metric.brPOS
method display(ob id, ob full, int i) =>
if not id.isbb
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.loc, right = time , border_color = na , bgcolor = id.css, xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = time , right = time + 1 , border_color = na , bgcolor = id.css, xloc = xloc.bar_time, extend = extend.right))
else
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.loc , right = id.bbloc , border_color = na , bgcolor = id.css , xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.bbloc , right = time , border_color = id.css , bgcolor = id.bull ? bbup : bbdn , xloc = xloc.bar_time, border_width = 2))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = time , right = time + 1 , border_color = id.css , bgcolor = id.bull ? bbup : bbdn , xloc = xloc.bar_time, extend = extend.right))
if obshowactivity
bin.bx.unshift(box.new (top = id.top, bottom = id.avg, left = id.loc , right = id.xlocbl, border_color = na , bgcolor = obactup, xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.avg, bottom = id.btm, left = id.loc , right = id.xlocbr, border_color = na , bgcolor = obactdn, xloc = xloc.bar_time))
if showline
bin.ln.unshift(line.new(
x1 = id.loc
, x2 = time
, y1 = id.avg
, y2 = id.avg
, color = color.new(id.css, 0)
, xloc = xloc.bar_time
, style = line.style_dashed
)
)
if showmetric
if i == math.min(oblast - 1, full.size() - 1)
float tV = 0
float dV = array.new()
seq = math.min(oblast - 1, full.size() - 1)
for j = 0 to seq
cV = full.get(j)
tV += cV.vol
if j == seq
for y = 0 to seq
dV.push(
math.floor(
(full.get(y).vol / tV) * 100)
)
ids = full.get(y)
bin.lb.unshift(label.new(
bar_index - 1
, ids.avg
, textcolor = color.new(ids.css, 0)
, style = label.style_label_left
, size = obtxt.txSz()
, color = #ffffff00
, text =
str.tostring(
math.round(full.get(y).vol, 3), format = format.volume) + " (" + str.tostring(dV.get(y)) + "%)"
)
)
method dispFVG(FVG fvg, int i, bool bull) =>
ext = fvgextend ? extend.right : extend.none
if not fvg.isbb
bin.bx.unshift(box .new(top = fvg.top, bottom = fvg.btm, left = fvg.loc , right = time , border_color = na , bgcolor = bull ? fvg_upcss : fvg_dncss , xloc = xloc.bar_time, extend = ext))
if fvgline
bin.ln.unshift(line.new(x1 = fvg.loc, x2 = time , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), xloc = xloc.bar_time, color = color.new(bull ? fvg_upcss : fvg_dncss, 0) , extend = ext))
if dispraid
bin.ln.unshift(line.new(x1 = fvg.raidloc, x2 = fvg.raidx2, y1 = fvg.raidy, y2 = fvg.raidy, xloc = xloc.bar_time, color = fvg.raidcs))
bin.lb.unshift(label.new(x = int(math.avg(fvg.raidloc, fvg.raidx2)), y = fvg.raidy, text = "x", xloc = xloc.bar_time, textcolor = fvg.raidcs, style = bull ? label.style_label_up : label.style_label_down, size = size.small, color = #ffffff00))
else
bin.bx.unshift(box .new(top = fvg.top , bottom = fvg.btm, left = fvg.loc , right = fvg.bbloc , border_color = na , bgcolor = bull ? fvg_upcss : fvg_dncss, xloc = xloc.bar_time))
bin.bx.unshift(box .new(top = fvg.top , bottom = fvg.btm, left = fvg.bbloc , right = time , border_color = bull ? fvg_dncss : fvg_upcss , bgcolor = bull ? fvg_dncss : fvg_upcss, xloc = xloc.bar_time, extend = ext))
if fvgline
bin.ln.unshift(line.new(x1 = fvg.loc , x2 = fvg.bbloc , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), color = color.new(bull ? fvg_upcss : fvg_dncss, 0) , xloc = xloc.bar_time))
bin.ln.unshift(line.new(x1 = fvg.bbloc, x2 = time , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), color = color.new(bull ? fvg_dncss : fvg_upcss, 0) , xloc = xloc.bar_time, extend = ext, style = line.style_dashed))
//}
_ ='
------------
–––––––––––––––––––––––––– FUNCTION –––––––––––––––––––––––––––
------------ '//{
mapping() =>
var float up = na
var float dn = na
var float point = na
var int trend = 0
var int idx = na
var int sum = na
var int project = na
var chart.point charts = array.new()
if na(up)
up := high
idx := bar_index
if na(dn)
dn := low
idx := bar_index
if high > up
if trend == -1
id = IDMIDX(false, idx)
charts.unshift(
chart.point.from_time(
time
, low
)
)
idx := bar_index
point := low
sum := time
up := high
dn := low
project := time
trend := 1
if low < dn
if trend == 1
id = IDMIDX(true, idx)
charts.unshift(
chart.point.from_time(
time
, high
)
)
idx := bar_index
point := high
sum := time
up := high
dn := low
project := time
trend := -1
if barstate.islast
var line ln = na
var polyline pl = na
ln.delete()
pl.delete()
ln := na
pl := na
ln := line.new(
x1 = sum
, x2 = project
, y1 = point
, y2 = trend == 1 ? up : dn
, xloc = xloc.bar_time
, color = color.red
)
pl := polyline.new(
charts
, line_color = mappingcss
, xloc = xloc.bar_time
, line_style = mappingStyle.lstyle()
)
dFVG() =>
= ghl()
var FVG blFVG = array.new()
var FVG brFVG = array.new()
bool upfvg = false
bool dnfvg = false
float blth = l1 + (fvatr * fvgthresh)
float brth = h1 - (fvatr * fvgthresh)
cc = timeframe.change()
switch
what_fvg == "FVG" or what_fvg == "Breakers" =>
if l > h2 and cc and c1 > blth
upfvg := true
if l2 > h and cc and c1 < brth
dnfvg := true
if upfvg
if blFVG.size() > 0
fvg = blFVG.get(0)
if fvg.israid == true and fvg.active == false
fvg.active := true
fvg.raidloc := na
fvg.raidx2 := na
fvg.raidy := na
fvg.raidcs := #ffffff00
blFVG.unshift(
FVG.new(
l
, h2
, time
, false
, na
)
)
if dnfvg
if brFVG.size() > 0
fvg = brFVG.get(0)
if fvg.israid == true and fvg.active == false
fvg = brFVG.get(0)
fvg.active := true
fvg.active := true
fvg.raidloc := na
fvg.raidx2 := na
fvg.raidy := na
fvg.raidcs := #ffffff00
brFVG.unshift(
FVG.new(
l2
, h
, time
, false
, na
)
)
if blFVG.size() > 0
for in blFVG
if not fvg.isbb
if fvg_src == "Close" ? math.min(c, o) < fvg.btm : fvg_src == "Wick" ? l < fvg.btm : fvg_src == "Avg" ? l < math.avg(fvg.top, fvg.btm) : na
fvg.isbb := true
fvg.bbloc := time
if what_fvg == "FVG"
blFVG.remove(i)
else
if (fvg_src == "Close" ? math.max(c, o) > fvg.top : fvg_src == "Wick" ? h > fvg.top : fvg_src == "Avg" ? h > math.avg(fvg.top, fvg.btm) : na) and what_fvg == "Breakers"
blFVG.remove(i)
if brFVG.size() > 0
for in brFVG
if not fvg.isbb
if (fvg_src == "Close" ? math.max(c, o) > fvg.top : fvg_src == "Wick" ? h > fvg.top : fvg_src == "Avg" ? h > math.avg(fvg.top, fvg.btm) : na)
fvg.isbb := true
fvg.bbloc := time
if what_fvg == "FVG"
brFVG.remove(i)
else
if (fvg_src == "Close" ? math.min(c, o) < fvg.btm : fvg_src == "Wick" ? l < fvg.btm : fvg_src == "Avg" ? l < math.avg(fvg.top, fvg.btm) : na) and what_fvg == "Breakers"
brFVG.remove(i)
if fvgoverlap
overlapFVG(blFVG, brFVG)
if dispraid
for in blFVG
if not fvg.israid and not fvg.isbb
if low < fvg.top and close > fvg.top
fvg.israid := true
fvg.raidloc := time
fvg.raidx2 := time
fvg.raidy := low
fvg.raidcs := chart.fg_color
else
if low <= fvg.raidy and fvg.active == false and not fvg.isbb
fvg.active := true
fvg.raidx2 := time
else
if fvg.active == false and not fvg.isbb
fvg.raidx2 := time
for in brFVG
if not fvg.israid and not fvg.isbb
if high > fvg.btm and close < fvg.btm and not fvg.isbb
fvg.israid := true
fvg.raidloc := time
fvg.raidy := high
fvg.raidx2 := time
fvg.raidcs := chart.fg_color
else
if high >= fvg.raidy and fvg.active == false and not fvg.isbb
fvg.active := true
fvg.raidx2 := time
else
if fvg.active == false and not fvg.isbb
fvg.raidx2 := time
if barstate.islast
if blFVG.size() > 0 and fvg_num > 0
for i = 0 to math.min(fvg_num - 1, blFVG.size() - 1)
fvg = blFVG.get(i)
dispFVG(fvg, i, true)
if brFVG.size() > 0 and fvg_num > 0
for i = 0 to math.min(fvg_num - 1, brFVG.size() - 1)
fvg = brFVG.get(i)
dispFVG(fvg, i, false)
structure(color upcss, color dncss, bool draw, bool internal, int limit) =>
var structure ms = structure.new(start = 0)
var ob blob = array.new< ob >()
var ob brob = array.new< ob >()
var drawms bldw = array.new< drawms >()
var drawms brdw = array.new< drawms >()
var sellbuyside sellside = array.new()
var sellbuyside buyside = array.new()
bool crossup = false
bool crossdn = false
var float up = na
var float dn = na
idbull = ms.find(false, false, true)
idbear = ms.find(true , false, true)
btmP = obmode == "Length" ? (high - 1 * atr ) < low ? low : (high - 1 * atr ) : low
topP = obmode == "Length" ? (low + 1 * atr ) > high ? high : (low + 1 * atr ) : high
atr = ta.atr (200)
buy = low + atr
sel = high - atr
ph = ta.pivothigh(high, mslen, mslen)
pl = ta.pivotlow (low , mslen, mslen)
var int phn = array.new< int >(1, na)
var int pln = array.new< int >(1, na)
var float php = array.new(1, na)
var float plp = array.new(1, na)
if internal
blob.clear()
brob.clear()
if ph
phn.unshift(bar_index )
php.unshift(high )
if pl
pln.unshift(bar_index )
plp.unshift(low )
if php.size() > 0
if high > php.get(0)
php.clear()
phn.clear()
if plp.size() > 0
if low < plp.get(0)
plp.clear()
pln.clear()
if na(up)
up := high
if na(dn)
dn := low
if high > up
up := high
dn := low
crossup := true
if low < dn
up := high
dn := low
crossdn := true
if ms.start == 0
ms := structure.new(bar_index, na, high, low , bar_index, bar_index, 0, 1, na, bar_index)
if draw
bldw.unshift(drawms.new(time, time, high , "CHoCH" , upcss, line.style_dashed))
brdw.unshift(drawms.new(time, time, low , "CHoCH" , dncss, line.style_dashed))
ms.upsweep := false
ms.dnsweep := false
if ms.start == 1
switch
low <= ms.choch and close >= ms.choch and buildsweep =>
ms.dnsweep := true
ms.choch := low
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
high >= ms.bos and close <= ms.bos and buildsweep =>
ms.upsweep := true
ms.bos := high
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
close <= ms.choch =>
ms.txt := "choch"
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
ms.trend := -1
ms.choch := ms.bos
ms.bos := na
ms.start := 2
ms.loc := bar_index
ms.main := low
ms.temp := ms.loc
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
close >= ms.bos =>
ms.txt := "choch"
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
ms.trend := 1
ms.choch := ms.choch
ms.bos := na
ms.start := 2
ms.loc := bar_index
ms.main := high
ms.temp := ms.loc
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
if ms.start == 2
switch ms.trend
-1 =>
if low <= ms.main
ms.main := low
ms.temp := bar_index
if bar_index % mslen * 2 == 0
if not na(ms.bos) and msmode == "Adjusted Points" and php.size() > 0
if php.get(0) < ms.choch
// ms.xloc := phn.get(0)
ms.choch := php.get(0)
ms.loc := phn.get(0)
ms.xloc := phn.get(0)
ms.temp := phn.get(0)
if draw
choch = bldw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := php.get(0)
if na(ms.bos)
if crossup and close > open and close > open
ms.bos := ms.main
ms.loc := ms.temp
ms.xloc := ms.loc
if draw
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
if not na(ms.bos) and draw
dw = brdw.get(0)
dw.x2 := time
if draw
choch = bldw.get(0)
choch.x2 := time
switch
low <= ms.bos and close >= ms.bos and not na(ms.bos) and buildsweep =>
ms.dnsweep := true
ms.bos := low
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
ms.xloc := bar_index
close <= ms.bos and not na(ms.bos) =>
ms.txt := "bos"
ms.zz := ms.bos
ms.zn := bar_index
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
id = ms.find(true, false, false)
ms.xloc := bar_index
ms.bos := na
ms.choch := high
ms.loc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
choch = bldw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := high
switch
high >= ms.choch and close <= ms.choch and buildsweep =>
ms.upsweep := true
ms.choch := high
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
close >= ms.choch =>
ms.txt := "choch"
ms.zz := ms.choch
ms.zn := bar_index
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
id = ms.find(false, false, false)
switch
na(ms.bos) =>
ms.choch := low
if draw
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
choch = brdw.get(0)
choch.x1 := time
=> ms.choch := ms.bos//low < low ? low : low
ms.bos := na
ms.main := high
ms.trend := 1
ms.loc := bar_index
ms.xloc := bar_index
ms.temp := ms.loc
if draw
dw = bldw.get(0)
dw.x2 := time
dw.txt := "CHoCH"
dw.style := internal ? line.style_dashed : line.style_solid
choch = brdw.get(0)
choch.x2 := time
choch.y := ms.choch
choch.txt := "CHoCH"
ms.xloc := bar_index
blarea.normal := false
1 =>
if high >= ms.main
ms.main := high
ms.temp := bar_index
if na(ms.bos)
if crossdn and close < open and close < open
ms.bos := ms.main
ms.loc := ms.temp
ms.xloc := ms.loc
if draw
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
if bar_index % mslen * 2 == 0
if not na(ms.bos) and msmode == "Adjusted Points" and plp.size() > 0
if plp.get(0) > ms.choch
// ms.xloc := pln.get(0)
ms.choch := plp.get(0)
ms.loc := pln.get(0)
ms.xloc := pln.get(0)
ms.temp := pln.get(0)
// ms.loc := pln.get(0)
if draw
choch = brdw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := plp.get(0)
if not na(ms.bos) and draw
dw = bldw.get(0)
dw.x2 := time
if draw
choch = brdw.get(0)
choch.x2 := time
switch
high >= ms.bos and close <= ms.bos and not na(ms.bos) and buildsweep =>
ms.upsweep := true
ms.bos := high
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
ms.xloc := bar_index
close >= ms.bos and not na(ms.bos) =>
ms.txt := "bos"
ms.zz := ms.bos
ms.zn := bar_index
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
id = ms.find(false, false, false)
ms.xloc := bar_index
ms.bos := na
ms.choch := low
ms.loc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
choch = brdw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := low
switch
low <= ms.choch and close >= ms.choch and buildsweep =>
ms.dnsweep := true
ms.choch := low
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
close <= ms.choch =>
ms.txt := "choch"
ms.zz := ms.choch
ms.zn := bar_index
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
id = ms.find(true, false, false)
switch
na(ms.bos) =>
ms.choch := high
if draw
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
choch = bldw.get(0)
choch.x1 := time
=> ms.choch := ms.bos//high > high ? high : high
ms.bos := na
ms.main := low
ms.trend := -1
ms.loc := bar_index
ms.temp := ms.loc
if draw
dw = brdw.get(0)
dw.x2 := time
dw.txt := "CHoCH"
dw.style := internal ? line.style_dashed : line.style_solid
choch = bldw.get(0)
choch.y := ms.choch
choch.x2 := time
choch.txt := "CHoCH"
ms.xloc := bar_index
if blob.size() > 0
ob = blob.get(0)
if not ob.isbb
if low < ob.top
if blobenter.normal == false
blobenter.normal := true
else
if high > ob.btm
if blobenter.breaker == false
blobenter.breaker := true
if brob.size() > 0
ob = brob.get(0)
if not ob.isbb
if high > ob.btm
if brobenter.normal == false
brobenter.normal := true
else
if low < ob.top
if brobenter.breaker == false
brobenter.breaker := true
if obshow and oblast > 0
if barstate.isconfirmed
blob.mitigated()
brob.mitigated()
if overlap
overlap(blob, brob)
if blob.size() > 0
for in blob
metric.umt()
if brob.size() > 0
for in brob
metric.umt()
if barstate.islast
if blob.size() > 0
for i = 0 to math.min(oblast - 1, blob.size() - 1)
obs = blob.get(i)
display(obs, blob, i)
if brob.size() > 0
for i = 0 to math.min(oblast - 1, brob.size() - 1)
obs = brob.get(i)
display(obs, brob, i)
if barstate.islast and draw and bldw.size() > 0 and brdw.size() > 0
for i = 0 to bldw.size() - 1
obj = bldw.get(i)
if i <= limit
bin.ln.unshift(
line.new(
x1 = obj.x1
, x2 = obj.x2
, y1 = obj.y
, y2 = obj.y
, color = obj.css
, style = obj.style
, xloc = xloc.bar_time
)
)
bin.lb.unshift(
label.new(
x = int(math.avg(bin.ln.get(0).get_x1(), bin.ln.get(0).get_x2()))
, y = obj.y
, xloc = xloc.bar_time
, color = #ffffff00
, style = label.style_label_down
, textcolor = obj.css
, size = mstext.txSz()
, text = obj.txt
)
)
if msbubble
bin.lb.unshift(
label.new(
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = color.new(obj.css, 80)
, style = label.style_circle
, size = size.tiny
)
)
for i = 0 to brdw.size() - 1
obj = brdw.get(i)
if i <= limit
bin.ln.unshift(
line.new(
x1 = obj.x1
, x2 = obj.x2
, y1 = obj.y
, y2 = obj.y
, color = obj.css
, style = obj.style
, xloc = xloc.bar_time
)
)
bin.lb.unshift(
label.new(
x = int(math.avg(bin.ln.get(0).get_x1(), bin.ln.get(0).get_x2()))
, y = obj.y
, xloc = xloc.bar_time
, color = #ffffff00
, style = label.style_label_up
, textcolor = obj.css
, size = mstext.txSz()
, text = obj.txt
)
)
if msbubble
bin.lb.unshift(
label.new(
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = color.new(obj.css, 80)
, style = label.style_circle
, size = size.tiny
)
)
ms
//}
_ ='
------------
–––––––––––––––––––––––––– EXECUTION –––––––––––––––––––––––––––
------------ '//{
structure ms = na
if windowsis
if (bar_index > last_bar_index - mswindow)
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
if windowsis == false
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
// if showInternal and inZone
// structure ims = structure(interncssup, interncssdn, showInternal, true , swingLimit)
color css = na
method darkcss(color css, float factor) =>
blue = color.b(css) * (1 - factor)
red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)
color.rgb(red, green, blue, 0)
if windowsis ? (bar_index > last_bar_index - mswindow) : true
css := ms.trend == 1 ? swingcssup : swingcssdn
css := (ms.txt == "bos" ? css : css.darkcss(0.3))
barcolor(candlecss ? css : na)
if fvg_enable
dFVG()
if showMapping
mapping()
var phl = Zphl.new(
na
, na
, label.new(na , na , color = invcol , textcolor = swingcssdn , style = label.style_label_down , size = size.tiny , text = "")
, label.new(na , na , color = invcol , textcolor = swingcssup , style = label.style_label_up , size = size.tiny , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)
// إعدادات تفعيل/تعطيل وتخصيص لكل مستوى فيبوناتشي
// حساب آخر قمة وقاع محوري
int fib_pivot_len = 5
ph = ta.pivothigh(high, fib_pivot_len, fib_pivot_len)
pl = ta.pivotlow(low, fib_pivot_len, fib_pivot_len)
var float last_high = na
var int last_high_x = na
var float last_low = na
var int last_low_x = na
if not na(ph)
last_high := high
last_high_x := bar_index - fib_pivot_len
if not na(pl)
last_low := low
last_low_x := bar_index - fib_pivot_len
var float fib_top = na
var float fib_bottom = na
var int fib_x1 = na
var int fib_x2 = na
if not na(last_high) and not na(last_low)
if last_high_x > last_low_x
fib_top := last_high
fib_bottom := last_low
fib_x1 := last_low_x
fib_x2 := last_high_x
else
fib_top := last_high
fib_bottom := last_low
fib_x1 := last_high_x
fib_x2 := last_low_x
var line fib_lines_pivot = array.new()
var label fib_labels_pivot = array.new()
if not na(fib_top) and not na(fib_bottom) and not na(fib_x1) and not na(fib_x2)
if barstate.islast
// حذف الخطوط والليبلات القديمة
for l in fib_lines_pivot
l.delete()
fib_lines_pivot.clear()
for lb in fib_labels_pivot
lb.delete()
fib_labels_pivot.clear()
// ...existing code...
fib_vals = array.from(0.0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.272, 1.618, 1.80, 2.0, 2.272, 2.618)
fib_shows = array.from(show_fib_0, show_fib_236, show_fib_382, show_fib_5, show_fib_618, show_fib_786, show_fib_1, show_fib_1272, show_fib_1618, show_fib_180, show_fib_2, show_fib_2272, show_fib_2618)
fib_colors = array.from(fib_color_0, fib_color_236, fib_color_382, fib_color_5, fib_color_618, fib_color_786, fib_color_1, fib_color_1272, fib_color_1618, fib_color_180, fib_color_2, fib_color_2272, fib_color_2618)
fib_texts = array.from("0.0", "23.6%", "38.2%", "50.0%", "61.8%", "78.6%", "100%", "127.2%", "161.8%", "180%", "200%", "227.2%", "261.8%")
// عند رسم الخطوط والليبلات:
for i = 0 to array.size(fib_vals) - 1
level_val = array.get(fib_vals, i)
level_show = array.get(fib_shows, i)
level_color = array.get(fib_colors, i)
level_txt = array.get(fib_texts, i)
if level_show
price = fib_bottom + (fib_top - fib_bottom) * level_val
l = line.new(x1=fib_x1, y1=price, x2=fib_x2 + fib_shift, y2=price, color=level_color, width=1, style=line.style_dotted, xloc=xloc.bar_index)
array.push(fib_lines_pivot, l)
lb = label.new(x=fib_x2 + fib_shift, y=price, text=level_txt + " | " + str.tostring(price, format.mintick), color=#ffffff00, textcolor=level_color, size=fib_size, style=label.style_label_left, xloc=xloc.bar_index)
array.push(fib_labels_pivot, lb)
F1B6 DAN1ŞMANLI8 DAYThis indicator is optimized for buy-sell signals on daily candlestick charts. We are constantly working on improvements to provide better signals every day