Z-Score Probability Indicator 2.0Z-Score Probability Indicator 2.0 — by TanTechTrades™
See trend shifts before they’re obvious.
This upgraded Z-Score toolkit combines a more accurate Z-Score moving average (Z-SMA) with an optional classic SMA to separate noise from genuine regime changes. It maps price into standard-deviation space, highlights probability zones, and prints projected ±σ price levels—so you can judge where price sits in the distribution and how likely continuation or mean reversion is.
What it does
Z-Score of price (close, with optional candle view): Normalizes price relative to a rolling mean and volatility to show how extreme current levels are.
Z-SMA (trend backbone): A moving average of the Z-Score itself smooths the signal and helps confirm when a bias truly flips.
Probability bands (±1σ / ±2σ / ±3σ): Color-filled zones visualize where most observations tend to occur (green ≈ typical, yellow ≈ stretched, red ≈ statistically rare).
Projected price levels: Live labels print the price implied at 0, ±1σ, ±2σ, ±3σ using the chart’s SMA and standard deviation—handy for targets, fades, and risk framing.
Z-Table panel: A compact table shows your current Z bucket (−3 … +3) and reference probabilities at a glance.
Alert-ready regime logic: Optional alerts fire only when direction is aligned with the Z-SMA (e.g., line red and Z-SMA < 0).
How to read it
Line mode (default):
Green line above 0 → positive Z (price above its mean).
Red line below 0 → negative Z (price below its mean).
Bias confirmation: When Z-SMA crosses and holds above/below 0, the backdrop is shifting—not just wobbling.
Candle mode (optional): Renders Z-Score as candles (open/high/low/close in Z-space) to spot intrabar extremes vs. closes.
Distribution fills:
|Z| < 1 (green): typical noise / mean zone.
1 ≤ |Z| < 2 (yellow): stretched.
|Z| ≥ 2 (red): statistically rare—watch for either continuation in strong trends or snap-back risks.
Price labels (0/±1/±2/±3σ): Where price would be if it reverted to the mean or pushed to the next σ boundary—great for planning TPs/hedges.
Signals & Alerts
Green Line Alert (SMA Above 0): Z line is green and Z-SMA > 0 → pro-trend bullish context.
Red Line Alert (SMA Below 0): Z line is red and Z-SMA < 0 → pro-trend bearish context.
Use these to filter entries from your primary trigger (breakouts, pullbacks, momentum crosses, etc.).
Inputs (key settings)
Lookback Length (default 75): Window for Z-Score calc (mean & stdev).
Plot Type: Line (clean regime read) or Candles (intrabar Z detail).
SMA Length (default 75): Optional classic SMA length; reduce (e.g., 14) for responsiveness.
Distribution Probability Fills: Toggle zone shading.
Show Z-Table: On-chart Z bucket & reference probabilities.
Show SMA: Toggle the Z-SMA line.
Show SMA Standard Deviation Bands: Plots ±1σ around Z-SMA for added volatility context.
Round Target Prices Up or Down: Controls precision of the ±σ price labels.
Indicator Timeframe (Only Hourly presets): Override source timeframe (e.g., 30/60/120/240/360/720 mins).
Z-Score Line Width: Visual thickness for the main line.
Practical playbooks
Trend confirmation: Trade in the direction of the Z-SMA once it’s firmly above/below 0; use pullbacks toward 0Z as entries.
Mean-reversion fades: Look for exhaustion when Z pushes into ±2σ/±3σ zones against the Z-SMA direction.
Targets & risk: Use the projected ±σ price labels to set tiered TPs or stop placement aligned with current volatility.
Notes
Works on any symbol/timeframe; timeframe override lets you anchor to higher-timeframe hourly multiples while trading lower charts.
Z-Score is sensitive to volatility regime shifts; the Z-SMA smooths this and helps avoid whipsaw around 0.
Always pair with sound risk management; statistical “rarity” is not a guarantee of reversal.
TanTechTrades™ — turning probability into practical trading context.
Candlestick analysis
进场与止损参考指标Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
让你更好的把握进场点,实现无脑进场的效果。
止损参考线,有效控制资金风险
EMA + RSI + Candle Pattern StrategyEMA RSI CANDLE PATTERN
calculates ema 9,20 and 50 along with RSI and identifies patterns
Auto Zones + DashboardAuto Zones + Dashboard
This indicator is an all-in-one trade planning toolkit.
It automatically maps Entry/SL/TP zones, shows dynamic support/resistance levels, and gives a clear market overview through a smart Meter and a compact Dashboard.
🔧 Features
Auto Zones (Entry/SL/TP)
Automatically plots Entry, Stop-Loss, and three Take-Profit levels (TP1/TP2/TP3 based on Fib multipliers).
Relative Levels
Dynamic support/resistance lines around the 50-SMA base with optional auto-hide when too far from price.
Labeled as: Deep Support, Support, Resistance, Psychological, Key Level, Target 1, Target 2.
Dashboard (top-right)
Compact panel showing:
RSI & Divergence (Bull/Bear/None)
Volume state (High/Low/Neutral vs. SMA)
MACD histogram
Signal (LONG / SHORT / WAIT)
Trend strength (via SMA50 slope & price relation)
Meter Score (0–100) and Recommendation
Probabilities P(Long) / P(Short)
Smart Meter (HTF filter + multi-factor score)
Uses RSI, MACD, EMA alignment, RVOL, ATR%, ADX, EMA gap, and breakout conditions to calculate a weighted score and directional recommendation.
Bars can be highlighted when Score ≥ 70 in breakout trend conditions.
MA50 (SMA)
Optional trend filter line with customizable color and width.
✅ How to use
Zones: Plan trades with Entry/SL/TP boxes automatically plotted.
Levels: Watch relative support/resistance for confluence.
Dashboard + Meter: Quickly assess momentum, volume, trend strength, and probabilities.
⚠️ Disclaimer: This tool is for educational and analytical purposes only. Not financial advice. Always use your own strategy and risk management.
Short tagline:
Auto Entry/SL/TP zones, dynamic support/resistance, and a smart Dashboard with Meter — all in one.
ORB Strategy + VWAP Criteria + Stop Loss and TPs by GOCHThis indicator will let you know once any 5 minute candle breaks the orb limits, establishing the amount of stop loss points, and also establishing the take profit zone. Each zone between ranges is equivalent to the amount of stop loss points.
The indicator will only trigger if the vwap is not in between the entry price and the TP2 price.
This is a profitable strategy if you stick to being consistent with your lot.
The correct setup is:
Opening Range: 15 Min
Custom Range:
7:30-7:45 UTC-6
Gabriel's Triple Impulsive Candle DetectorTriple Impulsive Candle Detector
Overview, critical for catching impulse moves in either direction.
SPX Income System is a rule-based framework designed to identify frequent, high-probability income opportunities on the S&P 500 cash index (SPX/SPY) using 0-DTE credit spreads. The core engine operates on 30-minute Impulse bars during the morning trade window and can be extended with optional modules for afternoon, overnight, and weekly swing opportunities. The methodology centers on a single, mechanical price event called a Impulse Bar (small wick to body ratio) to minimize discretion and keep execution consistent.
🔶What’s Inside
Core Strategy: SPX Daily Income
Timeframe: 3 kinds of 30-min bars.
Window: 09:30–11:30 ET (new setups only)
Instrument: SPX (cash index, XSP/SPY), executed with $5-wide credit spreads on 0-DTE SPX options
Bullish Setup
Entry on the break of setup bar high
Use an at the money put credit spread
Bearish Setup
Entry on the break of setup bar low
Use an at the money call credit spread
Intent: Enter shortly after setup; manage to >80% max profit or EOD expiration if SPX. If it's another stock, then a 1.5~2x D ATR is suggested.
Signal: An Impulse Bar that closes at/near the high (bullish) or low (bearish) of its 30-min range, verified with Volume above average.
Risk—limited to the risk of the option spread.
The spread is 5 dollars wide
The premium collected is $2.50
$5 - 2.50 = $2.50, or the breakeven point.
Which means what's left is the risk involved.
The risk is $2.50 per spread
🔶Why the 30-Minute Chart?
The 30-minute bar is the “chart of choice” because it filters noise and aligns with morning institutional flows.
On alternate timeframes, price often retraces half the candle body before following through.
On the 30m: the follow-through is more consistent, especially with 2x volume confirmation.
Adding support/resistance levels at the impulse bar hl2 strengthens execution.
This strategy has roots in MTF Crypto, and SPX/SPY TPO-Order Block logic.
🔶Bonus Examples:
🔹Afternoon SPX Income
Second chance window (typically 14:00–15:00 ET) if the morning trade has exited, 60-min bars instead.
🔹ORB 30 – Opening Range Break (first 30 min)
Classic ORB with an income twist for early action when time is limited. This can be entered on the 15 minute candle break.
🔹ORB 60 – Opening Range Break (second 30 min)
A follow-up ORB variant for traders who miss the first window, verified on a 60-min chart. Enter on the final 3 minutes of the hourly candle or wait for a pullback.
🔹B&B – Bed & Breakfast (Overnight)
Identifies income setups via the 10-minute chart in the last 30–60 minutes of the session with next-day open as the exit.
🔹JB – Just Breakfast
Uses the prior day’s end-of-day setup to enter at the opening bell, then manages into the daily income flow. I trade 0-date, and selling an ITM spread either partially or fully then gives me a head start on the daily income potential. This may work better if you either roll or the ORB 30 also meets the criteria.
🔹All-Day-Scalper
Converts income logic into 30-minute scalps using deep 75/80 delta ITM options as synthetic stock (requires >PDT). Meaning that the option will behave as if it is stock. This strategy comes with a warning: it's better if you can day trade.
🔹Tag ’n Turn—Weekly SPX Income Swing
Weekly swing overlay using 30-min Pulse Bars + Bollinger Bands (50) for 3–7 day swings and as a filter for daily income alignment. I use the TTM Squeeze and obtain similar results. Target heuristics (directional days) with a fired squeeze.
Part of my Gamma Scalping System.
🔶The Impulse Bar (10~40% Wick to Body Bar)
An Impulse Bar is a candle that:
Bullish: Closes higher than it opens and within the top ~10% of its high-low range.
Bearish: Closes lower than it opens and within the bottom ~10% of its high-low range.
Practical tip: Many traders mark 0-10-80-100% levels on the candle range (custom Fib or ruler) to quickly validate Pulse Bars. If it's accompanied by a volume spike, then it's better quality.
🔶SPX Daily Income—Rules & Execution
🔹Rules
Chart: 30 min, no indicators required. Pure PA, TPO-based strategy.
New Setups: 09:30–11:30 ET
Instrument: SPX signals, executed via SPX 0-DTE credit spreads ($5 wide, $2 for SPY)
🔹Entries
Bullish: Enter on a break of the setup bar high, use ATM put credit spread
Bearish: Enter on a break of the setup bar low, use ATM call credit spread
🔹Exits
Primary: Close at >80% of max profit (credit received)
Alternate: Hold to EOD expiration
Stop: Risk of the spread (defined by width – credit)
Target Heuristics (directional days)
Optional: 1.5–2× ATR as a reference (mirrors directional follow-through that often accelerates the >80% outcome)
Credit Guidance (typical)
OTM short strike ≈ $2.40
ITM short strike ≈ $2.50–$2.80
2× ITM short strike ≈ $2.80–$3.00
Trade Management (PDT-Aware)
If under PDT, many prefer set-and-forget with GTC buy-back (e.g., $0.20) or EOD expiration.
1:00 PM ET time check
Trending day ±$15–$20 SPX: usually no action, run to expiration
Non-trending day ±$5 SPX: consider taking 40–60% if available (optional) to avoid 50/50 end-of-day decay dynamics
Rationale: Without a favorable trend by ~1 PM, the odds of a late push decline; choosing a controlled partial outcome can improve long-run expectancy and reduce variance.
🔶Examples (Conceptual)
🔹Bullish: A green dot marks a bullish impulse bar; minor follow-through pushes the spread to >80% quickly.
🔹Bearish: A red triangle marks a bearish Impulse Bar; a modest down move is often sufficient for >80–95%.
🔹Tag ’n Turn—Weekly Swing (Filter & Stand-Alone)
Chart: 30-minute
Overlay: Bollinger Bands 50 (mean-reversion lens), or KC or TTM.
Setup: Tag of upper/lower band + Pulse Bar, enter on break of Pulse Bar in that direction
Target: Opposite Bollinger Band
Use Case: 3–7 day swings and a directional filter for Daily Income signals (trade with weekly bias)
🔹Afternoon SPX Income: Same Pulse logic, 14:00–15:00 ET window.
🔹ORB 30 / ORB 60: Uses 30/60-min opening range; can relax Pulse threshold (up to 40% bars) for early positioning when time-constrained.
🔹B&B (Overnight): Lasts 30–60 minutes; closes the next day at open or after the first 30-minute bar.
🔹JB (Just Breakfast): Enter at open using prior day’s signal; optionally roll into Daily Income if eligible.
🔹All-Day-Scalper: Deep ITM options (~0.75–0.80 delta) as synthetic stock.
Entry: Long ITM option
Stop: ~40% of option price
Target: 70–150% or 30-minute timed exit
Note: Time-intensive; for accounts above PDT.
🔹Brokerage: Must efficiently support SPX options; a <10% spread between OI and Volume is ideal. Preferences vary; Tastytrade, Thinkorswim, and Interactive Brokers are common choices. Use what’s reliable, available in your region, and cost-effective.
🔶Alerts (Check-in)
Bullish Impulse Detected (within 09:30–11:30 ET)
Bearish Impulse Detected (within 09:30–11:30 ET)
Afternoon Pulse (14:00–15:00 ET)
ORB 30/60 Trigger
B&B Window Open (last 60 mins)
JB at Open
Tag ’n Turn: Band Tag + Impulse (Bull/Bear)
🔶Inputs (Typical)
Session windows (morning, afternoon, last hour) ~5~15 Average Bar
Impulse threshold (strict 10% vs relaxed up to 40% for ORB variants)
Marker/label styles (bull/bear colors, dots vs arrows)
Filters (optional ATR TP, band touch BB(50-SMA, 2 Stdv.) for Tag ’n Turn)
Alert toggles (on-close for webhooks)
🔶Best Practices
One playbook, many Doors: Start with daily income; add afternoon or B&B/JB only after you’re consistent.
Credit discipline: Don’t chase poor pricing; stick to the credit guidance.
Time awareness: If no trend by ~1 PM ET, consider variance control.
Weekly bias: When using Tag ’n Turn, align daily trades with the weekly swing direction for added confluence.
Risk is defined as width – credit = max risk per spread. Size, accordingly, 1~2%.
🔶Disclosures & Risk
This is not financial advice. Options involve risk and are not suitable for all investors. Past performance (including backtests or theoretical studies) does not guarantee future results. Slippage, fills, assignment risk, and latency can materially impact outcomes. Trade a plan you fully understand and always size for durability. On the Daily, the Impulse bars, are often a signal that you should plan for it to return back to half of the Candle's body, and plan accordingly. Plot a horizontal support/resistance level and see how price reacts to it. Keep house-money, and use 1~2% Risk, reduce exposure when VIX is low and increase it when VIX is high.
TL;DR (Summary)
Signal: 30-min Pulse Bar (strict 10% close in range)
Window: 09:30–11:30 ET (new setups)
Execution: 0-DTE $5-wide SPX credit spreads
Exit: >80% max profit or EOD
Add-ons: Afternoon, ORB 30/60, B&B/JB overnights, All-Day-Scalper, Tag ’n Turn weekly swing/filter
Philosophy: Fully rule-based, minimal discretion, production-line consistency 0-date.
K-Rib VWAP Crossover — On The Mark TradingK-Rib VWAP Crossover — User Guide
What it is
A fast, rule-based crossover system built on a Kalman-smoothed moving-average ribbon (“K-Rib”).
It plots a Fast line (inner rib) and a Slow line (outer rib). Trades trigger when the Fast crosses the Slow, with optional slope, compression, buffer, and VWAP filters to cut noise. Non-repaint mode is supported.
How signals are built
Kalman + Ribbon
Price is filtered with a 1-D Kalman filter (R = measurement noise, Q = process noise), then optionally smoothed (RMA/EMA).
A rib set turns that baseline into multiple lengths; the script uses s1 (fastest rib) and the outermost rib as Fast/Slow.
Buffered crossover
Long when Fast > Slow + buffer and it was not above by buffer on the prior bar.
Short when Fast < Slow − buffer and it was not below by buffer on the prior bar.
Buffer can be None, % of price, or ATR × multiplier (default).
Filters (optional)
Slope: require the midline slope to agree (up for longs, down for shorts).
Compression gate: only allow signals if the ribbon was tight on the previous bar (true breakout behavior).
Bar-close confirm: waits for the bar to close → non-repaint.
VWAP bias (optional)
Longs only if price is above VWAP (or above upper band if you require bands).
Shorts only if below VWAP (or below lower band).
Alerts fire on final (filtered) long/short signals.
Presets (one-click)
Breakout (Tight / Standard / Loose)
Sets compression & ATR buffer for you. Use Tight for very noisy LTFs, Loose for smoother HTFs/trending markets.
Custom
You control everything (confirm, slope, compression, buffer type/value).
Inputs cheat-sheet
Kalman (R, Q, Smoothing):
Higher R → trust price less → slower/smoother.
Higher Q → allow more state change → faster/snappier.
Ribbon: number of ribs & MA type for the baseline (RMA/EMA). Crossover uses s1 vs outermost.
Crossover:
Confirm on close = non-repaint.
Slope agreement = trend-aligned signals.
Compression = breakout-style filter; threshold is fraction of price.
Buffer = None / % / ATR× (robust across symbols/TFs).
VWAP:
Enable bias, require band breach or not, sigma and length.
Optional plots for VWAP and bands.
Visuals:
Fast/Slow colors change with slope; optional fill; tiny L/S markers on signals.
Quick start (sensible defaults)
5–15m crypto/FX: Preset = Breakout (Standard), ATR len 14, buffer × 0.06, Compression ≤ 0.012, Confirm on close ON, Slope ON, VWAP bias OFF (or ON during sessions).
1H–4H swing: Try Loose preset; you can raise R a bit (smoother) and keep slope ON.
How to trade it (simple)
Breakout-continuation
Take Long when long signal prints; SL under local swing or 0.7–1.0× ATR; TP at 1.5–2R or trail.
Fade the failed cross (advanced)
If a signal prints against HTF bias and quickly fails back through Slow, fade back into the HTF direction (use at your discretion).
Tip: Combine with HTF bias (e.g., 1H trend UP) and trade LTF signals with that bias.
Repainting note
With Confirm on close = ON, the signal is locked at bar close (no repaint).
Turning it OFF allows early prints that can flip intrabar.
Best practices
Prefer ATR buffer over raw % for instruments with changing volatility.
Tighten compression threshold for scalping; relax for HTFs.
Avoid trading into high-impact news; widen buffers in high-vol regimes.
Disclaimer: Educational use only. Not financial advice. Trade responsibly.
Breakout TraderThis script is designed to catch breakout opportunities that develop after a clear trend has already been established. By tracking price pivots and measuring key retracement levels, it can identify points where momentum shifts create the setup for a potential continuation move. These signals often occur when a failed attempt to push price further in the opposite direction leads instead to renewed strength in the original trend.
It is particularly effective on lower time frames, where breakouts can quickly evolve into strong extended moves. On charts like the 1-minute or 3-minute, the script helps traders capture these fast-developing opportunities, giving early warnings of potential entries that may lead to much longer trend extensions.
Customizable Dashboard with Breakout, Fibonacci, and VMAPCustomizable Trading Dashboard 🚀
Supercharge your trading with our Customizable Dashboard with Breakout, Fibonacci, and VMAP! 📈 This powerful Pine Script indicator brings all key signals across multiple timeframes into one intuitive window, perfect for indices (Sensex, Nifty50, BankNifty), stocks, and crypto. Make faster, smarter decisions at a glance! 💡 Ideal for scalpers, day traders, and swing traders. 💪
Main Features 🌟
All Signals in One Window 🖼️: View trend, breakouts, Fibonacci, VMAP, and more in a single, customizable table—no need to switch charts! 🚀
Multi-Timeframe Powerhouse ⏰: Analyze signals across 1M, 5M, 15M, 30M, 1H, 4H, and 1D timeframes simultaneously for ultimate confluence. 📊
Trend Signals 📈: Spot Bullish 🟢, Bearish 🔴, or Neutral ⚪ trends instantly across all timeframes.
Breakout Detection 💥: Catch Consolidation, Pre-Breakout, Breakout, and Entry signals with higher timeframe confirmation.
Fibonacci Levels 🎯: Track key Fib levels (0.236, 0.382, 0.5, 0.618, 0.786) with persistent "last met" tracking for precision.
VMAP Insights 📏: See if price is At, Above, or Below the Volume-Weighted Moving Average for dynamic support/resistance.
Candlestick Patterns 🕯️: Identify powerful patterns like Bullish Engulfing, Hammer, and Doji across all timeframes.
Chart Patterns 🔍: Detect classics like Head and Shoulders, Triangles, and Flags in one view.
Fully Customizable 🎨: Toggle timeframes, signals, and simplified mode; tweak colors, headers, and settings to fit your trading style.
Dynamic Alerts 🔔: Get real-time notifications for trend shifts, breakouts, Fib touches, and more, all in one place.
Why Choose Our Dashboard? 🌍
One-Stop Analysis: Monitor all timeframes and signals in one window for faster, informed trades. 🖥️
Optimized for Nifty50, BankNifty, Sensex, stocks, and crypto. 🤑
Highly customizable for beginners and pros alike. 🛠️
Actionable insights with a sleek, color-coded table. ✨
Take control of the markets with this all-in-one trading powerhouse! Start now and trade smarter! 💸
Dynamic 50% Daily Range line + Checklist + WatermarkThis indicator is designed for traders who follow ICT (Inner Circle Trader) concepts. It provides key daily reference levels and session insights to improve market context analysis.
Features:
50% Line: Automatically plots the mid-level between the current day’s high and low. Customizable color, width, opacity, and dotted/solid style. Optional label to display the 50% level.
Market Open Line: Highlights the official market open with a vertical line. Fully customizable color, width, and opacity.
True Day Open Line: Marks the True Day Open (11 PM CST) for better session context. Customizable line color, width, and style.
Watermark: Optional motivational text displayed on the chart. Fully customizable text, size, and color.
Confluence Checklist: Track key trading confluences (Premium/Discount, Major Liquidity Sweep, Good Reaction, Inside Killzone, Good Momentum, Clear DOL, SMT, HTF Gap) to assist in decision-making. Size and position of the checklist are configurable.
Use Case:
Ideal for ICT-style trading, swing and intraday analysis, and anyone who wants clear daily reference levels and session markers without cluttering the chart with unnecessary text.
Oro Zone Statiche-M5/M15/M30 📌 Titolo
Oro Zone Confirmed Breakout
📝 Descrizione
Questo indicatore individua in automatico le zone operative di 5$ su XAU/USD (oro) e costruisce un box di validazione attorno al livello.
🔎 Funzionamento:
* Ogni livello multiplo di 5$ (1930, 1935, 1940, …) viene racchiuso da un box di ±0.5$.
* Prima candela che chiude col corpo fuori → bordo del box diventa giallo.
* Seconda candela consecutiva che chiude fuori → il box si illumina, compare il ✅ di conferma, e vengono generati automaticamente i target.
🎯 Regole operative:
* Stop Loss (SL): 2$ sotto (long) o sopra (short) il livello centrale.
* Take Profit 1 (TP1): 3$ sopra (long) o sotto (short).
* Take Profit 2 (TP2): 5$ sopra (long) o sotto (short).
* Quando viene colpito SL o TP2, il setup si chiude e il sistema valuta automaticamente il prossimo livello a +5$.
⚙️ Impostazioni:
* Funziona su più timeframe (consigliati 5m, 15m, 30m).
* Puoi attivare o disattivare la visualizzazione della cronologia dei box.
* Le linee di SL/TP sono fisse e accompagnate da etichette chiare.
📌 Title
Oro Zone Confirmed Breakout
📝 Description
This indicator automatically identifies the operational zones of $5 on XAU/USD (gold) and builds a validation box around the level.
🔎 Operation:
* Each multiple level of $5 (1930, 1935, 1940, ...) is enclosed by a box of ±0.5$.
* First candle that closes with the body out → edge of the box turns yellow.
* Second consecutive candle that closes out → the box lights up, the confirmation ✅ appears, and the targets are automatically generated.
🎯 Operating rules:
* Stop Loss (SL): $2 below (long) or above (short) the central level.
* Take Profit 1 (TP1): $3 above (long) or below (short).
* Take Profit 2 (TP2): $5 above (long) or below (short).
* When SL or TP2 is hit, the setup closes and the system automatically evaluates the next level at +5$.
⚙️ Settings:
* Works on multiple timeframes (5m, 15m, 30m recommended).
* You can turn box history display on or off.
* SL/TP lines are fixed and accompanied by clear labels.
TradeX Universal Algo For All📌 TradeX Universal Algo For All
The TradeX Universal Algo is a powerful, easy-to-use trend-following system that works on all markets and timeframes (Forex, Gold, Crypto, Stocks, Indices).
This algo is built on an ATR-based trailing stop system that dynamically adapts to volatility, giving you clear Buy/Sell signals with minimal noise.
🔑 Key Features
ATR Trailing Stop → Automatically adjusts to market volatility.
Buy & Sell Signals → Plots “Buy Above” and “Sell Below” labels when price crosses the trailing stop.
Bar Coloring → Green bars in bullish trend, red bars in bearish trend.
Custom Sensitivity → Adjust “Key Value” to fine-tune signal frequency.
Multi-Market Compatible → Works seamlessly on Forex, Commodities (XAUUSD, USOIL), Crypto, Indices, and Stocks.
Alerts Ready → Set alerts for Buy/Sell conditions so you never miss an opportunity.
⚙️ Inputs
Key Value (Sensitivity) → Controls how reactive the trailing stop is (default = 3).
ATR Period → Number of bars for ATR calculation (default = 5).
📊 How to Use
Apply the indicator on any chart and timeframe.
Look for Buy Above / Sell Below signals.
Follow the green bars for bullish bias and red bars for bearish bias.
Combine with your own analysis (Price Action, SMC, Supply/Demand, etc.) for best results.
⚠️ Disclaimer: This script is for educational purposes only. Trading involves risk, and past performance does not guarantee future results. Always use proper risk management.
AI-Powered Market and Fast Trend AnalysisAI-Powered Market and Fast Trend Analysis Presentation V7
Hello,
This presentation explains the core features and functionality of your "AI-Powered Market and Fast Trend Analysis" Pine Script indicator used on the TradingView platform.
1. General Overview
This indicator combines various technical analysis indicators and an AI-based decision-making mechanism to analyze market trends, volatility, volume movements, and potential reversal points. Its purpose is to provide users with a comprehensive and quick overview to make more informed buy/sell decisions.
2. General Settings and Periods
The indicator offers several input parameters to customize the analysis:
General Settings: Allows you to adjust the calculation periods for core indicators such as Period (General), TTM Period, Stoch %K/%D Period, Keltner Channel Multiplier, Volume Oscillator Fast/Slow Period.
3. AI Decision Weights
The AI decision mechanism, which is the heart of the indicator, generates a final AI score by assigning weights to different category scores:
Trend Indicators Weight: The impact of trend indicators such as Supertrend, TTM Squeeze, QQE, Vortex, RSI, Stochastic, Moving Averages (SMA, EMA, WMA, VWMA), MACD, Ichimoku Kijun, TEMA, HMA on the final score.
Momentum Indicators Weight: The impact of momentum indicators on the final score.
Volatility Indicators Weight: The impact of volatility indicators such as Bollinger Band Width, ATR, Keltner Channel Width, Donchian Channel Width, NATR.
Volume Indicators Weight: The impact of volume indicators such as OBV, AD, CMF, MFI, Volume Oscillator, VPT, VWAP.
Candlestick Pattern Weight (New): The impact of candlestick patterns like Doji, Bullish/Bearish Engulfing, Hammer, Shooting Star on the AI decision.
Reversal Momentum Weight (New): The impact of sudden price movements and reversal signals on the AI decision.
Market Context Weight: Determines how the general market sentiment from BIST indices (XU100, XU030, XBANK), in addition to the traded symbol's data, influences the AI decision. This weight controls how much the symbol's own data versus index data affects the AI decision.
4. AI Decision Thresholds
The AI score is converted into buy/sell signals based on specific threshold values, and the strength of the score is qualified:
AI Buy/Sell Thresholds: Separate buy and sell thresholds are defined for different asset classes like BIST stocks and Gold/MGC1.
Score Qualification Thresholds (New): The strength of the AI score is determined by levels such as Very Strong Buy/Sell, Strong Buy/Sell, Moderate Buy/Sell, Weak Buy/Sell.
Category-Based Signal Thresholds: Separate buy/sell thresholds exist for each category like trend, volatility, and volume.
5. Market Context Integration
The indicator analyzes not only the data of the traded symbol but also the data from BIST indices (XU100, XU030, XBANK) to incorporate general market sentiment into the AI decision. This provides a more holistic and reliable analysis.
6. Target Point Calculations
The indicator calculates potential buy and sell targets using ATR (Average True Range) multipliers. These targets are shown separately for different timeframes (30 Min, 1 Hour, 4 Hour, 1 Day, 1 Week) and are also marked on the chart. Additionally, Nearest Buy/Sell and Farthest Buy/Sell targets are determined from all timeframes.
7. Candlestick Patterns and Coloring
Pattern Detection: Automatically detects and marks important candlestick patterns such as Doji, Bullish Engulfing, Bearish Engulfing, Hammer, and Shooting Star on the chart.
Candlestick Coloring: Candlesticks are dynamically colored based on detected patterns and volume inflow. For example, in a Bullish Engulfing pattern, the candlestick turns solid green, while candlesticks with volume inflow are shown in white.
Fake Rally Indicator (New): Generates a "Fake Rally" signal when the overall AI score is still in a bearish zone, but there are bullish candlesticks and weak reversal signals.
8. Overbought/Oversold and Indecision Zones
On the chart, Overbought, Oversold, and Indecision zones are visually marked based on price movements within a specific period. These zones help you understand whether the price is near potential reversal points.
9. Panel Information (Top Right Corner)
The information panel located in the top right corner of the chart summarizes all important analysis results:
AI Decision: The general AI signal (Very Strong Buy/Sell, Strong Buy/Sell, etc.) and its color.
Score: The final AI score and its color (green, yellow, red).
Direction: The general market direction determined by AI (UP, DOWN, SIDEWAYS).
Category Signal: The combined signal of trend, volatility, and volume categories.
Confirmation Signal (New): The overall confidence level generated by combining the final AI score and the category signal (DEFINITE BUY/SELL, VERY STRONG, STRONG, MODERATE, WEAK, UNCERTAIN).
Timeframe-Based Status: Trend, Volatility, and Volume statuses for 30 Min, 1 Hour, 4 Hour, 1 Day, and 1 Week timeframes (Uptrend/Downtrend/Neutral, Inflow/Outflow/Neutral).
Candlestick Pattern: The detected candlestick pattern in the active timeframe.
Market Index Score: The average AI score of BIST indices.
Buyer/Seller Power (New): The percentage distribution of buyer and seller power in the current candlestick.
Target Buy/Sell: Potential buy and sell targets calculated for each timeframe.
Nearest/Farthest Buy/Sell (New): The nearest and farthest buy/sell points determined from targets across all timeframes.
10. How It Helps
This indicator helps you make sense of complex market data and assists you with:
Quick Decision Making: Allows you to quickly see the overall market situation and potential buy/sell signals at a glance.
Trend Identification: Helps you understand trends across different timeframes and their strength.
Risk Management: Supports your risk management strategies with target points and volatility analyses.
Market Sentiment: Enables you to make more accurate decisions by considering the general market context through index integration.
Important Note: When using the indicator for buy/sell decisions, please consider removing the "Overall AI Score" line and the "Buy/Sell Threshold" lines from the chart for a cleaner full-screen view.
I hope this presentation helps you better understand your code and proves useful in your TradingView operations.
Sincerely,
17 Tem
Sürüm Notları
VERSİON V9
High Low + BOS/Sweep aaa//@version=5
indicator("High Low + BOS/Sweep", overlay=true, max_lines_count=500, max_labels_count=500)
// Inputs (giữ nguyên các tuỳ chọn của bạn, chỉ bỏ input màu)
offTop = input.int(2, "Offset đỉnh", minval=0)
offBot = input.int(2, "Offset đáy", minval=0)
w = input.int(2, "Độ dày line", minval=1)
styleBosStr = input.string("Solid", "Kiểu line BOS", options= )
styleSweepStr = input.string("Dashed", "Kiểu line Sweep", options= )
showBosLabel = input.bool(true, "Hiện label BOS")
showSweepLabel = input.bool(true, "Hiện label Sweep")
bosLabelText = input.string("BOS", "Text BOS")
sweepLabelText = input.string("SWEEP", "Text Sweep")
labelSizeStr = input.string("tiny", "Kích thước label", options= )
// NEW: display toggles
showPivot = input.bool(true, "Hiện Pivot")
showBosSweep = input.bool(true, "Hiện BOS / Sweep")
// Convert styles / sizes
bosStyle = styleBosStr == "Dashed" ? line.style_dashed : styleBosStr == "Dotted" ? line.style_dotted : line.style_solid
sweepStyle = styleSweepStr == "Dashed" ? line.style_dashed : styleSweepStr == "Dotted" ? line.style_dotted : line.style_solid
lblSize = labelSizeStr == "small" ? size.small : labelSizeStr == "normal" ? size.normal : labelSizeStr == "large" ? size.large : size.tiny
// State vars
c = close
var int lastSignal = 0
var float sHigh = na
var int sHighBar = na
var float sLow = na
var int sLowBar = na
var float confHigh = na
var int confHighBar = na
var float confLow = na
var int confLowBar = na
var line highLine = na
var line lowLine = na
var label highLabel = na
var label lowLabel = na
// === Đánh dấu loại line: 0 = chưa có, 1 = Sweep, 2 = BOS ===
var int highLineType = 0
var int lowLineType = 0
// === Sweep tracking / pending ===
var bool pendingSweepUp = false
var bool pendingSweepDown = false
var int sweepDetectedBarUp = na
var float sweepTargetHighPrice = na
var int sweepTargetHighBar = na
var int sweepDetectedBarDown = na
var float sweepTargetLowPrice = na
var int sweepTargetLowBar = na
// === Track BOS pivots ===
var int lastBOSHighBar = na
var int lastBOSLowBar = na
// Track swing
if (lastSignal == -1) or (lastSignal == 0)
if na(sHigh) or high > sHigh
sHigh := high
sHighBar := bar_index
if (lastSignal == 1) or (lastSignal == 0)
if na(sLow) or low < sLow
sLow := low
sLowBar := bar_index
// Confirm pivot
condTop = c < low
condBot = c > high
isTop = condTop and (lastSignal != 1)
isBot = condBot and (lastSignal != -1)
// On pivot confirm
if isTop
confHigh := sHigh
confHighBar := sHighBar
highLine := na
highLabel := na
highLineType := 0
if showPivot
label.new(confHighBar, confHigh + syminfo.mintick * offTop, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.red, size=size.small)
lastSignal := 1
sHigh := na
sHighBar := na
sLow := low
sLowBar := bar_index
if isBot
confLow := sLow
confLowBar := sLowBar
lowLine := na
lowLabel := na
lowLineType := 0
if showPivot
label.new(confLowBar, confLow - syminfo.mintick * offBot, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.lime, size=size.small)
lastSignal := -1
sLow := na
sLowBar := na
sHigh := high
sHighBar := bar_index
// Raw sweep detection
rawSweepUp = not na(confHigh) and (na(lastBOSHighBar) or confHighBar != lastBOSHighBar) and high > confHigh and close <= confHigh
rawSweepDown = not na(confLow) and (na(lastBOSLowBar) or confLowBar != lastBOSLowBar) and low < confLow and close >= confLow
if rawSweepUp
pendingSweepUp := true
sweepDetectedBarUp := bar_index
sweepTargetHighPrice := confHigh
sweepTargetHighBar := confHighBar
if rawSweepDown
pendingSweepDown := true
sweepDetectedBarDown := bar_index
sweepTargetLowPrice := confLow
sweepTargetLowBar := confLowBar
// Check sweep validity
checkSweepValidUp() =>
isValid = true
if pendingSweepUp and not na(sweepDetectedBarUp)
maxOffset = bar_index - sweepDetectedBarUp
if maxOffset >= 0
for i = 0 to maxOffset
if close > sweepTargetHighPrice
isValid := false
isValid
checkSweepValidDown() =>
isValid = true
if pendingSweepDown and not na(sweepDetectedBarDown)
maxOffset = bar_index - sweepDetectedBarDown
if maxOffset >= 0
for i = 0 to maxOffset
if close < sweepTargetLowPrice
isValid := false
isValid
// BOS logic
bosUp = not na(confHigh) and c > confHigh
bosDown = not na(confLow) and c < confLow
if bosUp
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
lastBOSHighBar := confHighBar
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
highLineType := 2
if showBosSweep
highLine := line.new(confHighBar, confHigh, bar_index, confHigh, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=bosStyle)
if showBosLabel
midBar = math.floor((confHighBar + bar_index) / 2)
highLabel := label.new(midBar, confHigh, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
if bosDown
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
lastBOSLowBar := confLowBar
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLineType := 2
if showBosSweep
lowLine := line.new(confLowBar, confLow, bar_index, confLow, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=bosStyle)
if showBosLabel
midBar = math.floor((confLowBar + bar_index) / 2)
lowLabel := label.new(midBar, confLow, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
// Sweep draw (pivot-in-between check)
sweepUpTriggered = false
sweepDownTriggered = false
if (isTop or isBot) and pendingSweepUp and not na(sweepTargetHighBar)
hasLowBetween = false
for i = sweepTargetHighBar to bar_index
if not na(confLowBar) and confLowBar == i
hasLowBetween := true
if checkSweepValidUp() and highLineType != 2 and hasLowBetween
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
highLineType := 1
if showBosSweep
highLine := line.new(sweepTargetHighBar, sweepTargetHighPrice, bar_index, sweepTargetHighPrice, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetHighBar + bar_index) / 2)
highLabel := label.new(midBar, sweepTargetHighPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
sweepUpTriggered := true
if (isTop or isBot) and pendingSweepDown and not na(sweepTargetLowBar)
hasHighBetween = false
for i = sweepTargetLowBar to bar_index
if not na(confHighBar) and confHighBar == i
hasHighBetween := true
if checkSweepValidDown() and lowLineType != 2 and hasHighBetween
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLineType := 1
if showBosSweep
lowLine := line.new(sweepTargetLowBar, sweepTargetLowPrice, bar_index, sweepTargetLowPrice, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetLowBar + bar_index) / 2)
lowLabel := label.new(midBar, sweepTargetLowPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
sweepDownTriggered := true
// Alerts
alertcondition(isTop, "Top", "Top confirmed")
alertcondition(isBot, "Bot", "Bottom confirmed")
alertcondition(bosUp, "BOS Up", "Break of structure up")
alertcondition(bosDown, "BOS Down", "Break of structure down")
alertcondition(sweepUpTriggered, "Sweep Up", "Sweep đỉnh xuất hiện")
alertcondition(sweepDownTriggered, "Sweep Down", "Sweep đáy xuất hiện")
plot(na) // tránh lỗi
High Low + BOS/Sweep//@version=5
indicator("High Low + BOS/Sweep", overlay=true, max_lines_count=500, max_labels_count=500)
// Inputs (giữ nguyên các tuỳ chọn của bạn, chỉ bỏ input màu)
offTop = input.int(2, "Offset đỉnh", minval=0)
offBot = input.int(2, "Offset đáy", minval=0)
w = input.int(2, "Độ dày line", minval=1)
styleBosStr = input.string("Solid", "Kiểu line BOS", options= )
styleSweepStr = input.string("Dashed", "Kiểu line Sweep", options= )
showBosLabel = input.bool(true, "Hiện label BOS")
showSweepLabel = input.bool(true, "Hiện label Sweep")
bosLabelText = input.string("BOS", "Text BOS")
sweepLabelText = input.string("SWEEP", "Text Sweep")
labelSizeStr = input.string("tiny", "Kích thước label", options= )
// NEW: display toggles (giữ nguyên logic, bạn yêu cầu)
showPivot = input.bool(true, "Hiện Pivot")
showBosSweep = input.bool(true, "Hiện BOS / Sweep")
// Convert styles / sizes
bosStyle = styleBosStr == "Dashed" ? line.style_dashed : styleBosStr == "Dotted" ? line.style_dotted : line.style_solid
sweepStyle = styleSweepStr == "Dashed" ? line.style_dashed : styleSweepStr == "Dotted" ? line.style_dotted : line.style_solid
lblSize = labelSizeStr == "small" ? size.small : labelSizeStr == "normal" ? size.normal : labelSizeStr == "large" ? size.large : size.tiny
// State vars (khai báo riêng để tránh lỗi kiểu)
c = close
var int lastSignal = 0
var float sHigh = na
var int sHighBar = na
var float sLow = na
var int sLowBar = na
var float confHigh = na
var int confHighBar = na
var float confLow = na
var int confLowBar = na
var line highLine = na
var line lowLine = na
var label highLabel = na
var label lowLabel = na
// === Đánh dấu loại line: 0 = chưa có, 1 = Sweep, 2 = BOS ===
var int highLineType = 0
var int lowLineType = 0
// === Sweep tracking / pending ===
var bool pendingSweepUp = false
var bool pendingSweepDown = false
var int sweepDetectedBarUp = na
var float sweepTargetHighPrice = na
var int sweepTargetHighBar = na
var int sweepDetectedBarDown = na
var float sweepTargetLowPrice = na
var int sweepTargetLowBar = na
// === Track BOS pivots (pivot bar indexes that became BOS) ===
var int lastBOSHighBar = na
var int lastBOSLowBar = na
// Track swing while searching
if (lastSignal == -1) or (lastSignal == 0)
if na(sHigh) or high > sHigh
sHigh := high
sHighBar := bar_index
if (lastSignal == 1) or (lastSignal == 0)
if na(sLow) or low < sLow
sLow := low
sLowBar := bar_index
// Confirm pivot
condTop = c < low
condBot = c > high
isTop = condTop and (lastSignal != 1)
isBot = condBot and (lastSignal != -1)
// On pivot confirm (KHÔNG reset pendingSweep ở đây)
if isTop
confHigh := sHigh
confHighBar := sHighBar
highLine := na
highLabel := na
highLineType := 0
if showPivot
label.new(confHighBar, confHigh + syminfo.mintick * offTop, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.red, size=size.small)
lastSignal := 1
sHigh := na
sHighBar := na
sLow := low
sLowBar := bar_index
if isBot
confLow := sLow
confLowBar := sLowBar
lowLine := na
lowLabel := na
lowLineType := 0
if showPivot
label.new(confLowBar, confLow - syminfo.mintick * offBot, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.lime, size=size.small)
lastSignal := -1
sLow := na
sLowBar := na
sHigh := high
sHighBar := bar_index
// Raw sweep detection: nếu có râu quét pivot cũ (và đóng lại không vượt) -> đánh dấu pending và lưu pivot cũ
// loại trừ pivot đã từng là BOS (lastBOSHighBar / lastBOSLowBar)
rawSweepUp = not na(confHigh) and (na(lastBOSHighBar) or confHighBar != lastBOSHighBar) and high > confHigh and close <= confHigh
rawSweepDown = not na(confLow) and (na(lastBOSLowBar) or confLowBar != lastBOSLowBar) and low < confLow and close >= confLow
if rawSweepUp
pendingSweepUp := true
sweepDetectedBarUp := bar_index
sweepTargetHighPrice := confHigh
sweepTargetHighBar := confHighBar
if rawSweepDown
pendingSweepDown := true
sweepDetectedBarDown := bar_index
sweepTargetLowPrice := confLow
sweepTargetLowBar := confLowBar
// Functions: check sweep valid (no close crossing pivot from detection to now)
checkSweepValidUp() =>
isValid = true
if pendingSweepUp and not na(sweepDetectedBarUp) and not na(sweepTargetHighPrice)
maxOffset = bar_index - sweepDetectedBarUp
if maxOffset >= 0
for i = 0 to maxOffset
if close > sweepTargetHighPrice
isValid := false
isValid
checkSweepValidDown() =>
isValid = true
if pendingSweepDown and not na(sweepDetectedBarDown) and not na(sweepTargetLowPrice)
maxOffset = bar_index - sweepDetectedBarDown
if maxOffset >= 0
for i = 0 to maxOffset
if close < sweepTargetLowPrice
isValid := false
isValid
// BOS logic (như cũ) — nếu BOS xảy ra thì hủy pending sweep liên quan
bosUp = not na(confHigh) and c > confHigh
bosDown = not na(confLow) and c < confLow
if bosUp
// cancel pending sweep
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
// mark pivot as BOS (do not allow future sweep using same pivot)
lastBOSHighBar := confHighBar
// delete existing sweep display if present
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
// draw BOS (only if display enabled) — dùng màu mặc định: black
highLineType := 2
if showBosSweep
highLine := line.new(confHighBar, confHigh, bar_index, confHigh, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=bosStyle)
if showBosLabel
midBar = math.floor((confHighBar + bar_index) / 2)
highLabel := label.new(midBar, confHigh, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
if bosDown
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
lastBOSLowBar := confLowBar
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLineType := 2
if showBosSweep
lowLine := line.new(confLowBar, confLow, bar_index, confLow, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=bosStyle)
if showBosLabel
midBar = math.floor((confLowBar + bar_index) / 2)
lowLabel := label.new(midBar, confLow, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
// === Sweep draw (with pivot-in-between check) ===
if (isTop or isBot) and pendingSweepUp and not na(sweepTargetHighBar)
hasLowBetween = false
// scan bars between sweepTargetHighBar and current bar to find ANY confirmed low pivot (confLowBar)
for i = sweepTargetHighBar to bar_index
if not na(confLowBar) and confLowBar == i
hasLowBetween := true
if checkSweepValidUp() and highLineType != 2 and hasLowBetween
// delete existing line if any
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
// mark as sweep
highLineType := 1
// draw sweep only if display enabled (màu mặc định: black)
if showBosSweep
highLine := line.new(sweepTargetHighBar, sweepTargetHighPrice, bar_index, sweepTargetHighPrice, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetHighBar + bar_index) / 2)
highLabel := label.new(midBar, sweepTargetHighPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
// clear pending
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
if (isTop or isBot) and pendingSweepDown and not na(sweepTargetLowBar)
hasHighBetween = false
for i = sweepTargetLowBar to bar_index
if not na(confHighBar) and confHighBar == i
hasHighBetween := true
if checkSweepValidDown() and lowLineType != 2 and hasHighBetween
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLineType := 1
if showBosSweep
lowLine := line.new(sweepTargetLowBar, sweepTargetLowPrice, bar_index, sweepTargetLowPrice, xloc=xloc.bar_index, extend=extend.none, color=color.black, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetLowBar + bar_index) / 2)
lowLabel := label.new(midBar, sweepTargetLowPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=color.black, style=label.style_none, size=lblSize)
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
// Alerts
alertcondition(isTop, "Top", "Top confirmed")
alertcondition(isBot, "Bot", "Bottom confirmed")
alertcondition(bosUp, "BOS Up", "Break of structure up")
alertcondition(bosDown, "BOS Down", "Break of structure down")
plot(na) // tránh lỗi
High Low + BOS/Sweep 2//@version=5
indicator("High Low + BOS/Sweep (fixed pivot check)", overlay=true, max_lines_count=500, max_labels_count=500)
// Inputs
offTop = input.int(2, "Offset đỉnh", minval=0)
offBot = input.int(2, "Offset đáy", minval=0)
w = input.int(2, "Độ dày line", minval=1)
c_bos_up = input.color(color.red, "Màu BOS phá đỉnh")
c_bos_down = input.color(color.lime, "Màu BOS phá đáy")
c_sweep_up = input.color(color.orange, "Màu Sweep đỉnh")
c_sweep_down = input.color(color.aqua, "Màu Sweep đáy")
styleBosStr = input.string("Solid", "Kiểu line BOS", options= )
styleSweepStr = input.string("Dashed", "Kiểu line Sweep", options= )
showBosLabel = input.bool(true, "Hiện label BOS")
showSweepLabel = input.bool(true, "Hiện label Sweep")
bosLabelText = input.string("BOS", "Text BOS")
sweepLabelText = input.string("SWEEP", "Text Sweep")
labelSizeStr = input.string("tiny", "Kích thước label", options= )
// Convert styles / sizes
bosStyle = styleBosStr == "Dashed" ? line.style_dashed : styleBosStr == "Dotted" ? line.style_dotted : line.style_solid
sweepStyle = styleSweepStr == "Dashed" ? line.style_dashed : styleSweepStr == "Dotted" ? line.style_dotted : line.style_solid
lblSize = labelSizeStr == "small" ? size.small : labelSizeStr == "normal" ? size.normal : labelSizeStr == "large" ? size.large : size.tiny
// State vars
c = close
var int lastSignal = 0
var float sHigh = na
var int sHighBar = na
var float sLow = na
var int sLowBar = na
var float confHigh = na
var int confHighBar = na
var float confLow = na
var int confLowBar = na
var line highLine = na
var line lowLine = na
var label highLabel = na
var label lowLabel = na
// === Đánh dấu loại line: 0 = chưa có, 1 = Sweep, 2 = BOS ===
var int highLineType = 0
var int lowLineType = 0
// === Sweep tracking / pending ===
var bool pendingSweepUp = false
var bool pendingSweepDown = false
var int sweepDetectedBarUp = na
var float sweepTargetHighPrice = na
var int sweepTargetHighBar = na
var int sweepDetectedBarDown = na
var float sweepTargetLowPrice = na
var int sweepTargetLowBar = na
// === NEW: track BOS pivots ===
var int lastBOSHighBar = na
var int lastBOSLowBar = na
// Track swing
if (lastSignal == -1) or (lastSignal == 0)
if na(sHigh) or high > sHigh
sHigh := high
sHighBar := bar_index
if (lastSignal == 1) or (lastSignal == 0)
if na(sLow) or low < sLow
sLow := low
sLowBar := bar_index
// Confirm pivot
condTop = c < low
condBot = c > high
isTop = condTop and (lastSignal != 1)
isBot = condBot and (lastSignal != -1)
// On pivot confirm
if isTop
confHigh := sHigh
confHighBar := sHighBar
highLine := na
highLabel := na
highLineType := 0
label.new(confHighBar, confHigh + syminfo.mintick * offTop, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.red, size=size.small)
lastSignal := 1
sHigh := na
sHighBar := na
sLow := low
sLowBar := bar_index
if isBot
confLow := sLow
confLowBar := sLowBar
lowLine := na
lowLabel := na
lowLineType := 0
label.new(confLowBar, confLow - syminfo.mintick * offBot, "●", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_none, textcolor=color.lime, size=size.small)
lastSignal := -1
sLow := na
sLowBar := na
sHigh := high
sHighBar := bar_index
// Raw sweep detection
rawSweepUp = not na(confHigh) and (na(lastBOSHighBar) or confHighBar != lastBOSHighBar) and high > confHigh and close <= confHigh
rawSweepDown = not na(confLow) and (na(lastBOSLowBar) or confLowBar != lastBOSLowBar) and low < confLow and close >= confLow
if rawSweepUp
pendingSweepUp := true
sweepDetectedBarUp := bar_index
sweepTargetHighPrice := confHigh
sweepTargetHighBar := confHighBar
if rawSweepDown
pendingSweepDown := true
sweepDetectedBarDown := bar_index
sweepTargetLowPrice := confLow
sweepTargetLowBar := confLowBar
// Check sweep validity
checkSweepValidUp() =>
isValid = true
if pendingSweepUp and not na(sweepDetectedBarUp)
maxOffset = bar_index - sweepDetectedBarUp
if maxOffset >= 0
for i = 0 to maxOffset
if close > sweepTargetHighPrice
isValid := false
isValid
checkSweepValidDown() =>
isValid = true
if pendingSweepDown and not na(sweepDetectedBarDown)
maxOffset = bar_index - sweepDetectedBarDown
if maxOffset >= 0
for i = 0 to maxOffset
if close < sweepTargetLowPrice
isValid := false
isValid
// BOS logic
bosUp = not na(confHigh) and c > confHigh
bosDown = not na(confLow) and c < confLow
if bosUp
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
lastBOSHighBar := confHighBar
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
highLine := line.new(confHighBar, confHigh, bar_index, confHigh, xloc=xloc.bar_index, extend=extend.none, color=c_bos_up, width=w, style=bosStyle)
highLineType := 2
if showBosLabel
midBar = math.floor((confHighBar + bar_index) / 2)
highLabel := label.new(midBar, confHigh, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=c_bos_up, style=label.style_none, size=lblSize)
if bosDown
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
lastBOSLowBar := confLowBar
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLine := line.new(confLowBar, confLow, bar_index, confLow, xloc=xloc.bar_index, extend=extend.none, color=c_bos_down, width=w, style=bosStyle)
lowLineType := 2
if showBosLabel
midBar = math.floor((confLowBar + bar_index) / 2)
lowLabel := label.new(midBar, confLow, bosLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=c_bos_down, style=label.style_none, size=lblSize)
// === Sweep draw (with pivot-in-between check) ===
if (isTop or isBot) and pendingSweepUp and not na(sweepTargetHighBar)
hasLowBetween = false
for i = sweepTargetHighBar to bar_index
if not na(confLowBar) and confLowBar == i
hasLowBetween := true
if checkSweepValidUp() and highLineType != 2 and hasLowBetween
if not na(highLine)
line.delete(highLine)
if not na(highLabel)
label.delete(highLabel)
highLine := line.new(sweepTargetHighBar, sweepTargetHighPrice, bar_index, sweepTargetHighPrice, xloc=xloc.bar_index, extend=extend.none, color=c_sweep_up, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetHighBar + bar_index) / 2)
highLabel := label.new(midBar, sweepTargetHighPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=c_sweep_up, style=label.style_none, size=lblSize)
highLineType := 1
pendingSweepUp := false
sweepDetectedBarUp := na
sweepTargetHighPrice := na
sweepTargetHighBar := na
if (isTop or isBot) and pendingSweepDown and not na(sweepTargetLowBar)
hasHighBetween = false
for i = sweepTargetLowBar to bar_index
if not na(confHighBar) and confHighBar == i
hasHighBetween := true
if checkSweepValidDown() and lowLineType != 2 and hasHighBetween
if not na(lowLine)
line.delete(lowLine)
if not na(lowLabel)
label.delete(lowLabel)
lowLine := line.new(sweepTargetLowBar, sweepTargetLowPrice, bar_index, sweepTargetLowPrice, xloc=xloc.bar_index, extend=extend.none, color=c_sweep_down, width=w, style=sweepStyle)
if showSweepLabel
midBar = math.floor((sweepTargetLowBar + bar_index) / 2)
lowLabel := label.new(midBar, sweepTargetLowPrice, sweepLabelText, xloc=xloc.bar_index, yloc=yloc.price, textcolor=c_sweep_down, style=label.style_none, size=lblSize)
lowLineType := 1
pendingSweepDown := false
sweepDetectedBarDown := na
sweepTargetLowPrice := na
sweepTargetLowBar := na
// Alerts
alertcondition(isTop, "Top", "Top confirmed")
alertcondition(isBot, "Bot", "Bottom confirmed")
alertcondition(bosUp, "BOS Up", "Break of structure up")
alertcondition(bosDown, "BOS Down", "Break of structure down")
plot(na) // tránh lỗi
Combined Signal EMA + HHV-ATR Trail (Srinu)Green “BUY: ” below bars.
Red “SELL: ” above bars.
Alerts also include the triggered close price.
MACD Split (Top/Bottom)📘 Script Explanation – MACD Split (Top/Bottom)
Purpose
Splits MACD into two separate panels for better visibility:
Top panel → MACD line (orange) & Signal line (black)
Bottom panel → Histogram (colored line) & Histogram EMA (black)
Color Rules for Histogram
Above 0 & Rising → Light Green
Above 0 & Falling → Dark Green
Below 0 & Falling → Dark Red
Below 0 & Rising → Light Red
Histogram EMA → Black
Zero Line
A gray dashed baseline is drawn at 0 for reference.
How to Use
Add the indicator twice.
Set the first one’s Mode = Top.
Set the second one’s Mode = Bottom.
Save as a template → next time, both panels load together.
Intraday Options Signals (CE / PE) – CleanIntraday Options Buy/Sell Indicator – Simple Explanation
This script is designed to help options traders (NIFTY / BANKNIFTY CE & PE) quickly see when big players might be entering or exiting intraday.
It uses concepts like displacement candles, liquidity sweeps, and Fair Value Gaps (FVGs), but keeps the output very simple: clear BUY / SELL signals.
✅ What it Shows
BUY CE (Call Option)
→ Green arrow/flag below the bar when conditions suggest bullish momentum + liquidity trap + gap.
BUY PE (Put Option)
→ Red arrow/flag above the bar when conditions suggest bearish momentum + liquidity trap + gap.
EXIT CE / EXIT PE
→ Small gray "X" appears when conditions say the current trade should be closed.
EOD EXIT
→ If intraday session ends (e.g., 3:30 PM), any open trade is auto-closed.
Background Tint
→ Green shading while in CE mode, Red shading while in PE mode. Makes it child-easy to see the current bias.
VWAP Line (Optional)
→ Silver line shows intraday volume-weighted average price. Exits may trigger if price crosses VWAP.
⚡ How It Works (Logic in simple words)
Detects strong bullish or bearish candles (big displacement).
Checks for Fair Value Gaps (imbalances), often used by institutions.
Looks for liquidity sweeps (traps) near swing highs/lows → signals big players’ stop hunts.
Combines these into BUY CE / BUY PE triggers with cooldown (to avoid over-trading).
Manages exits via VWAP, opposite signals, or end of day.
🎯 How to Use
Copy the code → paste into TradingView Pine Editor → click Add to chart.
Apply it on NIFTY / BANKNIFTY options charts (e.g., BANKNIFTY24SEP48000CE).
Works best on 1m to 15m intraday charts.
Watch for:
🚀 Green “BUY CE” arrow → buy CALL
🚀 Red “BUY PE” arrow → buy PUT
❌ Gray EXIT → close trade
🔔 Alerts
You can set TradingView alerts for:
BUY CE, BUY PE
EXIT CE, EXIT PE
End of Day exit
That way, you’ll get push notifications the moment a signal appears.
⚠️ Important Notes
This is NOT 100% accurate. No indicator is. It gives a framework to spot big player footprints (liquidity sweeps + FVGs).
Always backtest on Strategy Tester before using with real money.
Use it with good risk management (stop loss & position sizing).
MACD Split (Top/Bottom)MACD Split Indicator Explanation
This script separates the MACD into two clean panels:
Top Panel (Mode = Top)
Plots the MACD line and the Signal line.
Used to analyze crossovers and trend direction.
Bottom Panel (Mode = Bottom)
Plots the Histogram (MACD – Signal) and its EMA smoothing.
Used to analyze momentum strength and early shifts.
You can load the same indicator twice:
Set one to Top mode → shows only MACD & Signal lines.
Set the other to Bottom mode → shows only Histogram & EMA.
This way, you get a clear split view without overlapping everything in one chart.
EMA+RSI Buy/Sell with Fibonacci GuideSingle-Instance EUR/USD & GBP/USD Trend+MACD ATR EA
Purpose:
This EA is designed for automated Forex trading on EUR/USD and GBP/USD. It identifies trend-based trading opportunities, dynamically calculates position sizes based on your available capital and risk percentage, and manages trades with ATR-based stop-loss and take-profit levels, including optional trailing stops.
Key Features:
Auto Pair Selection:
Compares the trend strength of EUR/USD vs GBP/USD using a combination of EMA slopes and MACD direction.
Automatically trades the stronger trending pair.
Trend & Signal Detection:
Uses Fast EMA / Slow EMA crossover for trend direction.
Confirms trend with MACD line vs signal line.
Generates long and short signals only when trend and MACD align.
Dynamic SL/TP:
Stop-loss and take-profit are calculated based on ATR (Average True Range).
Supports optional trailing stops to lock in profits.
Position Sizing:
Automatically calculates micro-lot sizes based on your capital and risk percentage.
Ensures risk per trade does not exceed the defined % of your account equity.
Chart Visualization:
Plots Fast EMA / Slow EMA.
Displays SL and TP levels on the chart.
Shows a label indicating the active pair currently being traded.
Alerts:
Generates alerts for long and short signals.
Can be used with TradingView alerts to notify or trigger webhooks.
Single Strategy Instance:
Fully compatible with Pine Script v6.
Only one strategy instance runs on the chart to prevent “too many strategies” errors.
DEV (%)Deviation from MMA5 (%)
- MMA = (High + Low) / 2
- Calculates 5-day SMA of MMA (MMA5)
- Plots deviation (%) of current Mid Price from MMA5
- Above 0% → price above MMA5
- Below 0% → price below MMA5
Piano Frequency LevelsPiano Frequency Levels
This indicator applies the mathematical principles of musical harmony to market analysis, creating support and resistance levels based on authentic piano frequency ratios. Drawing from centuries-old musical theory, it maps the precise mathematical relationships between piano keys to price levels.
How It Works: The indicator uses the exact frequency ratios from equal temperament tuning - the same mathematical system that makes pianos sound harmonious. Each level represents an actual piano key frequency, scaled proportionally to your chosen anchor price.
Key Features:
• Piano-Based Ratios: Uses authentic 12-tone equal temperament frequency relationships (1.05946 ratio between semitones)
• Directional Intelligence: Automatically creates ascending levels from lows (resistance) or descending levels from highs (support)
• Musical Note Labels: Optional display of actual piano key names (C4, D#5, F6, etc.) alongside price levels
• Black Key Subdivisions: Toggle authentic sharp/flat keys between natural notes for additional precision
• Octave Color Coding: Each musical octave displays in a different color for easy visual identification
• Anchor Reference: Bright green line clearly marks your C-note reference point
Musical Foundation: Every level corresponds to an actual piano key. The anchor point represents "C" (the musical root), with levels progressing through the natural musical sequence: C, D, E, F, G, A, B, then repeating in higher octaves. This creates proportional spacing that mirrors the harmonic relationships musicians have used for centuries.
Usage:
1. Set your anchor to a significant market high or low
2. Choose your desired number of levels (typically 12-24 for 1-2 octaves)
3. Enable "Add Black Keys" for additional intermediate levels
4. Enable "Show Note Names" to see which piano key each level represents
The Theory: Musical harmony is based on precise mathematical ratios that create pleasing relationships between frequencies. These same mathematical principles may manifest in market movements, as price action often exhibits proportional relationships similar to musical intervals.
Unique Advantages:
• Based on established mathematical principles rather than arbitrary ratios
• Provides both major levels (white keys) and intermediate levels (black keys)
• Automatically adapts direction based on anchor type (high vs low)
• Maintains authentic musical relationships across all timeframes and price ranges
Important Note: This indicator presents a theoretical framework for market analysis. Like all technical analysis tools, it should be used in conjunction with other forms of analysis and proper risk management. The musical ratios provide a unique perspective on potential support and resistance levels, but past performance does not guarantee future results.
Transform your charts into a musical instrument and discover the hidden harmonies in market movements.