amir mohammad lorA script to automate and streamline the process of . It is designed to be efficient, reliable, and easy to configure. just use easy
指標和策略
ATM Pulse (Arjo)ATM Pulse (Arjo) — Options Trading, CPVR & Trend Direction Tool
The ATM Pulse (Arjo) is a helpful options trading indicator that automatically finds the At-The-Money (ATM) strike for NIFTY, BANKNIFTY , or any selected stock. It shows Call/Put prices, the ATM strike line , and the Call-Put Volume Ratio (CPVR) to reveal real-time market sentiment and option activity .
It also includes a Chandelier Exit overlay that highlights trend direction, momentum , and possible reversal zones , helping traders easily understand when the trend is strong, weak, or changing .
How to Use:
Open a chart of NIFTY, BANKNIFTY , or any stock.
Add the ATM Pulse (Arjo) indicator .
Select the expiry date — the indicator will automatically show the current ATM Call & Put prices.
Look at the CPVR value :
Above 1.25 → More bullish activity (Calls stronger).
Below 0.75 → More bearish activity (Puts stronger).
Watch the Chandelier Exit colors :
Green = uptrend; Red = downtrend.
A color change may signal a possible trend reversal .
Happy Trading. ARJO
Magik- OB findermarks Magic Orderblocks 15 min time frame... when price visits the ob go to 1 min tf.. after price makes a mss.. enter.. enjoy!!!
AG Pro Crypto Screener & Signal Dashboard🚀 OVERVIEW
Welcome to the AG Pro Crypto Screener & Signal Dashboard, an institutional-grade scanner designed to find high-probability buy opportunities in the chaotic crypto market. This powerful tool is being offered completely free as an introduction to the precision and performance of the exclusive AG Pro series.
Tired of manually flipping through dozens of charts? This dashboard is your new command center. It simultaneously scans up to 40 crypto assets against a robust, multi-filter strategy. It filters out the noise and delivers a clean, actionable list of symbols that are showing combined signs of strength, momentum, and a confirmed uptrend.
🧠 THE CORE STRATEGY: A Multi-Filter Confluence
This screener doesn't rely on a single, weak indicator. A symbol only appears on the "Buy List" if it passes a strict, user-configurable set of confluence filters:
Bullish EMA Crossover: Confirms a new, bullish shift in short-term momentum by looking for a recent crossover of a Fast EMA over a Slow EMA (e.g., 20/50). The "Freshness" feature ensures the signal is recent.
RSI Momentum Filter: Ensures the asset has strong buying momentum. The signal is only valid if the RSI is above a specified level (e.g., > 50).
Long-Term Trend Filter: This is the most critical filter. It keeps you on the right side of the market by confirming the price is above a key long-term Moving Average (e.g., SMA 50, 100, 200). You trade with the trend, not against it.
MACD Crossover (Optional): For traders who want an extra layer of confirmation, you can enable a filter to check for a bullish MACD crossover.
Only when all selected conditions are met does the asset appear on your dashboard. This multi-layered approach is designed to find quality over quantity.
✨ KEY FEATURES
Dynamic 40-Symbol Scanner: Monitor your entire watchlist (up to 40 symbols) from a single chart.
Professional Signal Dashboard: A clean, sortable table displaying all active signals, last price, RSI value, and volume.
"Freshness" & "Trend" Icons: Instantly gauge signal quality.
Freshness: See how many bars ago the signal appeared (🔥 Hot / ❇️ Fresh / ⏳ Old).
Trend: A clear visual icon shows if the asset is in a long-term uptrend (🔼) or downtrend (🔽).
NEW Signal Alerts: Don't miss an opportunity. Set an alert to be notified only when a new symbol appears on the list. This non-intrusive system avoids constant, repetitive alerts.
Fully Customizable Strategy: You are in control.
Toggle any of the four main filters (EMA, RSI, Trend, MACD) on or off.
Adjust all indicator lengths (EMAs, RSI, MACD, and Trend MA) to fit your trading style.
Reliable "On-Close" Signaling: Includes an option to generate signals only on bar close, ensuring high-quality, non-repainting signals.
Clean UI: Adjustable table text size ("Tiny", "Small", "Normal", "Large") for perfect visibility on any setup.
💎 THE AG PRO DIFFERENCE
This free screener is just the beginning. It's a demonstration of the stable, high-performance, and results-driven philosophy that defines the AG Pro brand.
We believe in empowering traders with tools that provide a clear, statistical edge. While this screener is powerful, our private, premium AG Pro scripts (such as the AG Pro Trading Suite) offer a complete, institutional-grade solution for serious traders. These advanced tools feature predictive models, proprietary signal algorithms, and comprehensive risk management modules that are the result of years of professional development.
If you find value in this free tool, imagine what our full suite can do for your trading. We invite you to experience the next level of trading precision.
🛠️ HOW TO USE
Add the "🏆 AG Pro Crypto Screener & Signal Dashboard V3" to your chart.
Open the indicator's Settings.
Under the "Symbol List to Scan" tab, replace the default symbols with your own 40 preferred assets (e.g., "BINANCE:BTCUSDT", "BINANCE:ETHUSDT", "COINBASE:SOLUSD").
Under the "Filter Settings" tab, configure your desired strategy. You can start with the defaults or customize them.
(Recommended) Right-click the table and select "Create Alert". Choose the "NEW BUY" condition and "Once Per Bar Close" to be notified of new signals.
⚠️ DISCLAIMER
This script is provided for informational and educational purposes only. It does not constitute financial or investment advice. All trading involves significant risk, and past performance is not indicative of future results. Please conduct your own research and implement your own risk management strategy before making any trading decisions.
Amir mohammad lorA "nice" Pine Script is a professional, user-friendly tool that provides clear trading signals while respecting the clarity of the chart. It moves beyond a simple indicator into a robust trading system.
MACD Overlay v1 [JopAlgo]Meet the MACD you can trade directly from the chart.
MACD Overlay v1 doesn’t just plot an oscillator somewhere below—
it puts value, momentum, and participation on your candles, and it refuses to fire inside chop.
When a triangle prints, it’s because energy released (expansion), not because the chart looked cute.
What it is:
An execution-ready MACD overlay with phase gating (Expansion-Only), participation gating (Weakness-Lite), and one-click Classic vs VW-MACD Compare—all adaptive, with minimal inputs.
What’s in v1 (feature set)
Overlay ribbon on price: Fast/Slow MACD value rendered as a price-level ribbon with contextual fill and optional candle tint.
Dual value model: Classic MA-MACD (EMA/SMA) and VW-MACD (Rolling VWAP fast/slow).
Compare mode: A/B Classic vs VW-MACD with a VW ghost ribbon.
Weakness-Lite (1-bar, adaptive): Gates/fades low-participation crosses using
RVOL deficit, Effort-vs-Result failure, and over-extension vs value/ATR (Strict adds wick pressure).
Expansion-Only (Impulse/Squeeze): Triangles print only when a cross coincides with a true-range burst and a histogram-slope ignition out of compression.
Signal hygiene: ±1-bar proximity around crosses, slope awareness, 2-bar debounce.
Explainable filtering: Tiny gray dots show crosses that were intentionally filtered (weak and/or no expansion).
How to use:
Use defaults: Mode Classic, Gate by Weakness ON, Expansion-Only ON, Sensitivity Auto.
Read signals fast:
Solid triangle = cross + expansion confirmed (+ not weak if gate is ON).
Faded triangle = cross + expansion but weak participation (visible only when gate is OFF).
Gray dot = there was a cross, but it was filtered (no genuine expansion or weak & gated).
Validate quickly: Flip Compare to check VW-MACD agreement. Classic + VW alignment usually improves confidence.
Why overlay > sub-pane oscillator
You see where the cross occurs: relative to value, local structure, and S/R, right on price.
The ribbon exposes regime shifts; tint hints expansion vs contraction at a glance.
Execution becomes more context-aware and less “signal-in-a-vacuum.”
Signals & visuals
Triangles (solid): MACD crossed Signal and market showed expansion out of compression; if Gate by Weakness is ON, triangle prints only with acceptable participation.
Triangles (faded): Same as above but weak (shown only when you turn the gate OFF).
Gray dots: Crosses that were filtered (no expansion and/or Weakness gate).
Ribbon: Fast vs Slow value (Classic or VW, according to Mode). Fill and candle tint reflect expansion/contraction.
Inputs
Calculation Mode: Classic | VW | Compare
VW uses Rolling VWAP fast/slow.
Compare: Classic is primary; VW shows as a ghost ribbon for A/B checks.
Gate triangles by Weakness: ON/OFF
Uses RVOL, Effort-vs-Result, extension vs value/ATR (Strict adds wick-pressure).
Sensitivity: Off / Auto / Strict (default Auto).
Expansion-Only (Impulse/Squeeze): ON/OFF
Requires compression → release: tight ribbon + flat momentum, then TR/ATR burst with hist slope flip / cross proximity.
Display: Ribbon / Candle Tint / Weakness Markers.
Advanced (optional): Evaluate Weakness only near signals, Channel (k × |MACD|), Style Preset.
No numeric thresholds to tune—all filters self-calibrate from rolling stats.
Best practices
4H crypto: Defaults are strong—Auto, Gate ON, Expansion-Only ON.
Clean trends: If you feel you miss some tidy resumptions, briefly toggle Expansion-Only OFF.
Choppy regimes: Set Sensitivity → Strict to cut more noise without adding lag.
Confirmation: Use Compare; Classic + VW alignment typically yields better follow-through.
Alerts
MACD Signal Cross Up/Down — execution-grade (use Once per bar close).
Weakness-Lite Flag — optional context alert to help audit filtered crosses.
Attribution & License
Attribution: Based on the algorithmic concept of TradingView’s built-in MACD (fast MA – slow MA, signal, histogram).
No original TradingView source code is redistributed; overlay rendering, VW-MACD, Weakness-Lite, Expansion-Only, gating visuals, and UX are new work.
License: MPL-2.0. Educational purposes only—not financial advice.
1D ATR Volatility Compression — with 5, 13, 22 WMA Trend FilterDiscover volatility before it explodes! 🚀
This powerful tool tracks the 1-Day Average True Range (ATR) together with its 5, 13, and 22-period Weighted Moving Averages (WMAs) to highlight volatility contraction zones — the calm before major market moves.
When ATR falls below all its WMAs, it signals a potential squeeze phase, often preceding sharp directional breakouts.
You can easily:
🌈 Highlight the chart background when volatility contracts
🔴 Show a dot above candles as a compact signal marker
Both features are fully toggleable for flexible chart visualization.
Use this indicator to:
Detect volatility compressions ahead of breakouts
Spot low-volatility accumulation or trend exhaustion zones
Combine with momentum or breakout setups for early entries
🎯 Works on all timeframes and symbols — ATR is always calculated from 1D data for consistent volatility context.
Bitcoin ATH and ATL CyclesDraws a vertical line for ATH and ATL cycles of Bitcoin.
Values are selected based on 1064-364 days analysis.
WM & HS Radar (Block-Free)The W/M + H&S Radar automatically scans for double-top/double-bottom (M and W) and head-and-shoulders style reversal structures across any timeframe.
How it works:
Detects repeating pivot formations that resemble W (double bottom) or M (double top) structures.
Draws neckline levels for each pattern and highlights potential breakout points.
Confirms breakout validity when price closes beyond the neckline (optionally requiring a 1.2× volume surge).
Generates alerts when a valid W Long or M Short trigger occurs.
Best used on: 15m, 1h, or 4h charts to identify medium-term reversal entries.
Recommended companion: Orion Daily HL + Volume indicator for higher-timeframe context.
Alert Options:
“W Long Trigger” → Bullish reversal breakout.
“M Short Trigger” → Bearish reversal breakout.
Usage Tip:
Combine with your support/resistance zones and ATR-based stop sizing from your Money Momentum Tracker to validate A-setups only.
PIVOT-V.13 05-09-25This Pine Script automatically detects pivot levels and generates buy/sell signals based on price action around those pivots. It identifies key support and resistance zones derived from previous period highs, lows, and closes, then marks optimal entry, target, and stop-loss levels on the chart.
The script is designed to assist traders in systematic decision-making using pivot-based strategies.
🔍 Core Features
Automatic Pivot Detection: Calculates and updates pivots in real-time using standard formulas.
Smart Trade Setup:
Buy Signal: Triggered when price action confirms strength above a pivot or resistance level.
Sell Signal: Triggered when price action confirms weakness below a pivot or support level.
Entry, Target & Stop-Loss Levels: Automatically plots potential entry points, stop-loss levels, and take-profit zones based on the nearest pivot structure.
Customizable Settings:
Choose pivot type and timeframe (daily, weekly, or monthly).
Adjust risk ratio, stop size, and confirmation filters.
Enable/disable visual labels or alerts.
Visual Clarity: Clearly marks all pivot levels and trade signals on the chart with colored labels and lines.
🎯 Purpose
This script helps traders quickly identify high-probability entry zones and maintain disciplined trade management by following pre-defined pivot-based rules — reducing emotional bias and enhancing consistency.
Institutional Accumulation Score (IAS) v4.2 Lite - IbotradeIAS helps identify where institutional buying pressure may be forming. Each bar is scored on five factors: price up, strong close, high relative volume, wide range vs ATR, and trend alignment. Bars scoring 4 or 5 trigger S4/S5 signals—often early signs of accumulation. Includes EMA Ribbon, adjustable filters, and customizable arrow colors for any chart theme. Educational use only—no financial advice.
Volume Spike & RSI | Buy/Sell SignalsThis indicator is designed for intraday traders who seek clean, actionable buy and sell signals using a blend of momentum (RSI) and volume analysis. It automatically detects momentum bursts based on the RSI crossing user-defined levels with a simultaneous volume spike—helping filter out weak or late signals. Signals are highlighted by discrete, color-coded arrows and non-overlapping labels for easy chart interpretation without clutter.
How it works
Buy signal: Generated when the RSI crosses above your chosen “Buy Threshold” (default 60) AND the volume on that bar is above its 20-period average. This suggests strong momentum with real volume support.
Sell signal: Generated when the RSI crosses below your chosen “Sell Threshold” (default 40) AND the volume on that bar is above average, signaling momentum loss or bearish pressure.
Visuals:
Buy signals are illustrated by green upward labels/arrows beneath candles.
Sell signals feature red downward labels/arrows above candles.
All signals adjust spacing dynamically, so they never overlap the price bar.
Bars are colored lime when momentum and volume are both high.
Customization
Fully adjustable RSI “Buy” and “Sell” levels.
Customizable sensitivity for the volume spike via the SMA period input.
Label spacing can be tuned in settings so signals always remain visible, regardless of volatility.
Alerts
Built-in alert conditions for both buy and sell events, compatible with TradingView’s native alerting system.
How to use
1. Add the indicator to your intraday chart (works on any timeframe).
2. When a buy or sell label/arrow appears, it marks a technical momentum burst with real volume conviction. Use these as actionable entries or exits—always manage risk with your personal trading plan.
3. Adjust parameters in the script’s settings as needed for your market or style.
Originality & credits
The logic and code were developed specifically for this script, combining classic RSI levels with volume confirmation and careful non-overlapping visual presentation to ensure clarity for intraday trading.
This tool is for educational and informational purposes only. It is not financial advice or a guarantee of performance. Always test on demo before using in live trading.
CDC BACKTEST (MACD) FIX AMOUNT $200k per trade This strategy implements an Exponential Moving Average (EMA) Crossover System designed for backtesting and performance evaluation. EMA 12,26 (MACD)
The trading logic is based on the crossover between two EMAs — a short-term EMA (12) and a long-term EMA (26) — which serves as a momentum-based signal for trend identification.
Buy Condition:
A long (buy) position is entered when the 12-period EMA crosses above the 26-period EMA, indicating a potential upward trend or bullish momentum.
Sell Condition:
A position is closed, or a short (sell) position is opened, when the 12-period EMA crosses below the 26-period EMA, signaling a potential downward trend or bearish momentum.
Position Sizing:
Each trade with a fixed position size of 200,000 USD (default), while the starting account balance is set at 400,000 (USD).
Both the fixed trade amount and the initial balance are user-adjustable parameters, allowing flexibility for different risk preferences and portfolio sizes.
Candle Range Theory for SeSe04Small Candle Theory — Automatic Detection of Micro-Retracements
📘 Description
The Small Candle Theory indicator automatically identifies market structures where a small candle forms within the range of a larger previous candle, highlighting potential momentum slowdown or local reversal areas.
This is a price action visualization tool, not a trading signal provider.
⚙️ Detection Conditions
📈 Bullish Signal
Candle 1: Large bearish candle
Candle 2: Small bullish candle
Candle 2 closes within the range of Candle 1
→ A blue triangle appears below the confirmation candle.
📉 Bearish Signal
Candle 1: Large bullish candle
Candle 2: Small bearish candle
Candle 2 closes within the range of Candle 1
→ A red triangle appears above the confirmation candle.
🧠 How to Use
This indicator does not generate buy/sell signals.
It highlights moments of reduced volatility that may precede a potential reversal or continuation, depending on market structure.
Best used:
In confluence with structure tools (support/resistance, order blocks, FVGs, etc.)
With strict risk management
On multiple timeframes
⚙️ Settings
No manual input is required.
Detection logic is automatic and works on any asset or timeframe.
🛎️ Alerts (optional)
You can create an alert in TradingView:
"Create Alert" → Condition: Small Candle Theory (Bullish or Bearish)
to receive notifications when a setup appears.
⚠️ Disclaimer
This script is for educational and analytical purposes only.
It does not constitute financial advice.
Trading involves the risk of losing part or all of your invested capital.
Amir mohammd lorA advanced TradingView indicator built with Pine Script that identifies . Features customizable parameters, real-time alerts, and visual signals on the chart for enhanced trading decision-making.
Candle PA Scanner (Engulfing / Inside / Pin) by BK SahniHere’s how to read the “Candle PA Scanner (Engulfing / Inside / Pin)” and what each input means.
What the signals look like on your chart
B-ENG (label above/below bar)
Bullish Engulfing → “B-ENG” below the bar (green/teal).
Bearish Engulfing → “B-ENG” above the bar (red).
IB (small orange dot at the top)
Inside Bar (compression). Use the mother bar’s high/low for the break.
PIN (triangle)
Bullish Pin → triangle below the bar (long lower wick; rejection of support).
Bearish Pin → triangle above the bar (long upper wick; rejection of resistance).
Treat these as price-action alerts, not automatic buy/sell signals. Act only when they occur at your levels (VWAP band, Fib 38.2–61.8, PDH/PDL, OB/FVG, etc.).
How to trade the prints (quick rules)
A) Bullish Engulfing at support
Context: at VWAP/VAL/0.5–0.618 Fib.
Entry: next candle above the engulfing high (or market order on close if volume/momentum confirm).
Stop: a tick below the engulfing low (or below the level).
Targets: mid/range, VWAP, prior swing; trail with Chandelier/ATR if trend extends.
B) Bearish Engulfing at resistance
Mirror the above: trigger below the engulfing low; stop above its high.
C) Inside Bar
It’s compression. Mark the mother bar’s high/low.
Trade the breakout in the direction of bias (above VWAP for longs, below for shorts).
If the break fails (closes back inside), often sets up a reversal—manage fast.
D) Pin Bar (rejection)
Enter on break of the pin’s body in the direction away from the wick.
Stop beyond the wick tip (invalidated if wick gets closed through).
Scale at VWAP/mid or the opposite range edge.
What the Inputs do (the panel you showed)
Inside Bar lookback (default 1)
How many bars back can be the mother bar.
Keep 1 for strict IB; raise to 2–3 to catch nested/compression patterns (more signals, a bit noisier).
Pin wick:body min ratio (default 2)
How long the rejection wick must be compared to the body.
Higher (2.5–3.0) = pickier, great in chop.
Lower (1.5–1.8) = more pins, useful in strong trends where wicks are shorter.
Min body % of range (0–1) (default 0.25)
Filters out dojis. The body must be at least 25% of the bar’s high-low range.
If you want to allow slimmer bodies (more pins/dojis), drop to 0.15–0.20.
If you want only decisive bodies, raise to 0.30–0.35.
Suggested tuning by market state
Trending / high momentum:
IB lookback 1, Pin ratio 1.8–2.2, Min body 0.20–0.25 (to catch more continuation entries).
Ranging / choppy:
IB lookback 2, Pin ratio 2.5–3.0, Min body 0.30 (fewer, higher-quality reversals).
A simple confluence checklist (use before clicking)
Signal printed at a level (VWAP band, Fib, PDH/PDL, OB/FVG)?
Bias aligned (above VWAP for longs, below for shorts) or you’re intentionally fading a range edge?
For engulfing: did it close through nearby minor structure?
For IB: are you trading the mother bar break, not just the small inside candle?
Risk defined: stop beyond wick/zone, target mapped (mid/VWAP/swing/extension).
Common pitfalls
Taking signals mid-range (low R:R).
Treating an IB as a reversal without a break/shift.
Buying a bullish pin that closed below your level (no acceptance).
Ignoring volatility—during news spikes, patterns fail more often.
Engulf After 2 Same-Dir Candles – Dashed Linethis will tell you when engulf happens after 2 consecutrive bvearsh candle happens
Iron Condor & Butterfly VisualizerIt helps you visualize and manage your option spread by:
Plotting strike prices and breakeven lines directly on the chart.
Showing profit/loss zones, adjustment zones, and alerts when price nears critical levels.
Calculating risk/reward, probability of profit, theta decay, IV condition, and trade score.
🎯 2. Inputs & Configuration
You input your trade details as a comma-separated string:
For an Iron Condor
ShortCall, LongCall, ShortPut, LongPut, Credit, Contracts, Target%
Example: 626,628,620,618,1.20,1,30
For a Butterfly Spread
LowerWing, Body, UpperWing, Debit, Contracts, Target%
Example: 600,620,640,2.50,2,50
The indicator automatically parses this and knows which strategy type you selected.
You can also control:
Visuals (profit zones, breakevens, labels)
Risk (stop loss %, adjustment zones)
Account/risk sizing
Market conditions (IV Rank, current IV, DTE)
⚙️ 3. Data Parsing & Strategy Recognition
The code reads your pasted string, splits it by commas, and determines:
Which strikes are short vs long (or wings/body for Butterfly)
Whether the strategy is credit (Iron Condor) or debit (Butterfly)
Calculates net credit/debit, contract size, and profit target
📈 4. Profit/Loss Calculations
It dynamically calculates:
Max Profit
Iron Condor: net credit × 100 × contracts
Butterfly: (wing width − debit) × 100 × contracts
Max Loss
Iron Condor: difference between strikes minus credit
Butterfly: debit × 100 × contracts
Breakeven points
Iron Condor: short strikes ± net credit
Butterfly: body ± debit
Current P&L relative to the live price (close).
⚖️ 5. Risk & Position Sizing
It checks:
Stop-loss trigger (% of max loss)
Adjustment alert if price nears short strikes
Recommended contract size based on account size and % risk per trade
Actual % of account at risk
⏱️ 6. Time Decay & IV Analysis
If you input days to expiration, it shows:
Theta (approx daily time decay)
Decay progress bar (% of 30-day cycle)
IV condition:
Green: favorable (>50 IV Rank)
Yellow: neutral (30–50)
Red: poor (<30)
🧮 7. Trade Scoring
It gives a Trade Score (0–100) based on:
IV Rank (favorable market)
Risk/Reward ratio
Probability of profit
Default 20 baseline points
This helps gauge whether the setup is statistically attractive.
🧠 8. Visualizations
When the indicator runs, it draws on your chart:
Lines
Red = short strikes
Orange dashed = long strikes
Yellow dotted = breakeven levels
Boxes
Green = profit zone
Orange shaded = adjustment zones (approaching danger)
Labels (optional)
Strike labels (call/put prices)
Info box summarizing:
Profit, loss, risk/reward
Breakevens, theta, target, gamma risk flag
🚨 9. Alerts
The script triggers TradingView alerts when:
Price nears call or put adjustment zones
Profit target is hit
Stop loss is hit
These help you manage the trade without constant monitoring.
🧭 10. In Practice
You’d:
Copy the option strikes and trade details from your broker or analyzer.
Paste them into 📋 PASTE YOUR TRADE DATA HERE.
The indicator plots:
Profit/loss region
Adjustment warnings
Key metrics
Alerts if your trade is in danger or near target.
MFI DivergenceThis indicator automatically detects bullish and bearish divergences between price and the Money Flow Index (MFI).
It’s designed for traders who use momentum divergence to anticipate potential trend reversals or continuation traps, and has been optimized to avoid false positives while still catching subtle setups on lower timeframes like 15m.
How It Works
Calculates the Money Flow Index (MFI) using price and volume.
Identifies swing highs and lows on the MFI using adaptive pivot logic.
Compares MFI pivots against corresponding price highs/lows:
Bullish Divergence: Price makes a lower low while MFI makes a higher low.
Bearish Divergence: Price makes a higher high while MFI makes a lower high.
Displays divergences as green (bullish) or red (bearish) lines on the MFI chart.
Market Structure Trailing Stop MTF [Inspired by LuxAlgo]# Market Structure Trailing Stop MTF
**OPEN-SOURCE SCRIPT**
*208k+ views on original · Modified for MTF Support*
This indicator is a direct adaptation of the renowned **Market Structure Trailing Stop** by **LuxAlgo** (original script: [Market Structure Trailing Stop ]()). The core logic remains untouched, providing dynamic trailing stops based on market structure breaks (CHoCH/BOS). The **only modification** is the addition of **Multi-Timeframe (MTF) support**, allowing users to apply the trailing stops and structures from **higher timeframes (HTF)** directly on their current chart. This enhances usability for traders analyzing cross-timeframe confluence without switching charts.
**Special thanks to LuxAlgo** for releasing this powerful open-source tool under CC BY-NC-SA 4.0. Your contributions to the TradingView community have inspired countless traders—grateful for the solid foundation!
## 🔶 How the Script Works: A Deep Dive
At its heart, this indicator detects **market structure shifts** (bullish or bearish breaks of swing highs/lows) and uses them to generate **adaptive trailing stops**. These stops trail the price while protecting profits and acting as dynamic support/resistance levels. The MTF enhancement pulls this logic from user-specified higher timeframes, overlaying HTF structures and stops on the lower timeframe chart for seamless multi-timeframe analysis.
### Core Logic (Unchanged from LuxAlgo's Original)
1. **Pivot Detection**:
- Uses `ta.pivothigh()` and `ta.pivotlow()` with a user-defined lookback (`length`) to identify swing highs (PH) and lows (PL).
- Coordinates (price `y` and bar index/time `x`) are stored in persistent variables (`var`) for tracking recent pivots.
2. **Market Structure Detection**:
- **Bullish Structure (BOS/CHoCH)**: Triggers when `close > recent PH` (break above swing high).
- If `resetOn = 'CHoCH'`, resets only on major shifts (Change of Character); otherwise, on all breaks.
- Sets trend state `os = 1` (bullish) and highlights the break with a horizontal line (dashed for CHoCH, dotted for BOS).
- Initializes trailing stop at the local minimum (lowest low since the pivot) using a backward loop: `btm = math.min(low , btm)`.
- **Bearish Structure**: Triggers when `close < recent PL`, mirroring the bullish logic (`os = -1`, local maximum for stop).
- Structure state `ms` tracks the break type (1 for bull, -1 for bear, 0 neutral), resetting based on user settings.
3. **Trailing Stop Calculation**:
- Tracks **trailing max/min**:
- On new bull structure: Reset `max = close`.
- On new bear: Reset `min = close`.
- Otherwise: `max = math.max(close, max)` / `min = math.min(close, min)`.
- **Stop Adjustment** (the "trailing" magic):
- On fresh structure: `ts = btm` (bull) or `top` (bear).
- In ongoing trend: Increment/decrement by a percentage of the max/min change:
- Bull: `ts += (max - max ) * (incr / 100)`
- Bear: `ts += (min - min ) * (incr / 100)`
- This creates a **ratcheting effect**: Stops move favorably with the trend but never against it, converging toward price at a controlled rate.
- **Visuals**:
- Plots `ts` line colored by trend (teal for bull, red for bear).
- Fills area between `close` and `ts` (orange on retracements).
- Draws structure lines from pivot to break point.
4. **Edge Cases**:
- Variables like `ph_cross`/`pl_cross` prevent multiple triggers on the same pivot.
- Neutral state (`ms = 0`) preserves prior `max/min` until a new structure.
### MTF Enhancement (Our Addition)
- **request.security() Integration**:
- Wraps the entire core function `f()` in a security call for each timeframe (`tf1`, `tf2`).
- Returns HTF values (e.g., `ts1`, `os1`, structure times/prices) to the chart's context.
- Uses `lookahead=barmerge.lookahead_off` for accurate historical repainting-free data.
- Structures are drawn using `xloc.bar_time` to align HTF lines precisely on the LTF chart.
- **Multi-Output Handling**:
- Separate plots/fills/lines for each TF (e.g., `plot_ts1`, `plot_ts2`).
- Colors and toggles per TF to distinguish HTF1 (e.g., teal/red) from HTF2 (e.g., blue/maroon).
- **Benefits**: Spot HTF bias on LTF entries, e.g., enter longs only if both TF1 (1H) and TF2 (4H) show bullish `os=1`.
This keeps the script lightweight—**no repainting, max 500 lines**, and fully compatible with LuxAlgo's original behavior when TFs are set to the chart's timeframe.
## 🔶 SETTINGS
### Core Parameters
- **Pivot Lookback** (`length = 14`): Bars left/right for pivot detection. Higher = smoother structures, fewer signals; lower = more noise.
- **Increment Factor %** (`incr = 100`): Speed of stop convergence (0-∞). 100% = full ratchet (mirrors max/min exactly); <100% = slower trail, reduces whipsaws.
- **Reset Stop On** (`'CHoCH'`): `'CHoCH'` = Reset only on major reversals (dashed lines); `'All'` = Reset on every BOS/CHoCH (tighter stops).
### MTF Support
- **Timeframe 1** (`tf1 = ""`): HTF for first set (e.g., "1H"). Empty = current chart.
- **Timeframe 2** (`tf2 = ""`): Second HTF (e.g., "4H"). Enables dual confluence.
### Display Toggles
- **Show Structures** (`true`): Draws horizontal lines for breaks (per TF colors).
- **Show Trailing Stop TF1/TF2** (`true`): Plots the stop line.
- **Show Fill TF1/TF2** (`true`): Area fill between close and stop.
### Candle Coloring (Optional)
- **Color Candles** (`false`): Enables custom `plotcandle` for body/wick/border.
- **Candle Color Based On TF** (`"None"`): `"TF1"`, `"TF2"`, or none. Colors bull trend green, bear red.
- **Candle Colors**: Separate inputs for bull/bear body, wick, border (e.g., solid green body, transparent wick).
### Alerts
- **Enable MS Break Alerts** (`false`): Notifies on structure breaks (bull/bear per TF) **only on bar close** (`barstate.isconfirmed` + `alert.freq_once_per_bar_close`).
- **Enable Stop Hit Alerts** (`false`): Triggers on stop breaches (long/short per TF), using `ta.crossunder/crossover`.
### Colors
- **TF1 Colors**: Bullish (teal), Bearish (red), Retracement (orange).
- **TF2 Colors**: Bullish (blue), Bearish (maroon), Retracement (orange).
- **Area Transparency** (`80`): Fill opacity (0-100).
## 🔶 USAGE
Trailing stops shine in **trend-following strategies**:
- **Entries**: Use structure breaks as signals (e.g., long on bullish BOS from HTF1).
- **Exits**: Trail stops for profit-locking; alert on hits for automation.
- **Confluence**: Overlay HTF1 (e.g., 1H) for bias, HTF2 (e.g., Daily) for major levels—enter LTF only on alignment.
- **Risk Management**: Lower `incr` avoids early stops in chop; reset on `'All'` for aggressive trailing.
! (i.imgur.com)
*HTF1 shows bullish structure (teal line), trailing stop ratchets up—long entry confirmed on LTF pullback.*
! (i.imgur.com)
*TF1 (blue) bearish, TF2 (red) neutral—avoid shorts until alignment.*
! (i.imgur.com)
*Colored based on TF1 trend: Green bodies on bull `os=1`.*
Pro Tip: Test on demo—pair with LuxAlgo's other tools like Smart Money Concepts for full structure ecosystem.
## 🔶 DETAILS: Mathematical Breakdown
On bullish break:
- Local min: `btm = ta.lowest(n - ph_x)` (optimized loop equivalent).
- Stop init: `ts = btm`.
- Update: `Δmax = max - max `, `ts_new = ts + Δmax * (incr/100)`.
Bearish mirrors with `Δmin` (negative, so decrements `ts`).
In MTF: HTF `time` aligns lines via `line.new(htf_time, level, current_time, level, xloc.bar_time)`.
No logs/math libs needed—pure Pine v5 efficiency.
## Disclaimer
This is for educational purposes. Not financial advice. Backtest thoroughly. Original by LuxAlgo—modify at your risk. See TradingView's (www.tradingview.com). Licensed under CC BY-NC-SA 4.0 (attribution to LuxAlgo required).
GROK ALTIN A1 BY FGGROK GOLD PRO V2 is a high-performance scalping strategy designed for XAUUSD on the 5-minute timeframe, operating with a fixed 1-lot position. It generates signals using EMA 9/21 crossover, RSI above/below 50, and volume spikes, while an ATR × 2.0 dynamic stop protects against volatility. Profits are locked in three steps (+$20, +$50, +$100), with each exit triggering real-time phone alerts showing entry, exit price, and profit. One pip movement equals $100 P&L. The strategy delivers a 92%+ win rate, average profit of +$4,432 per trade, and max drawdown of -$1,280. Simple, transparent, and fully automated.
Liquidity Regime OscillatorThe Liquidity Signal Line is a macro-driven confirmation tool designed to capture the underlying global liquidity regime in a single, smoothed oscillator. It measures the combined directional flow of monetary and financial conditions using high-impact macro data: Federal Reserve assets (WALCL), Treasury General Account (TGA), and the Overnight Reverse Repo facility (RRP) – adjusted by key market proxies such as the U.S. Dollar Index, credit spreads (HYG/LQD), and equity risk appetite (SPHB/SPHQ). These components are normalized, weighted, and then double-smoothed into a stable signal that translates complex liquidity dynamics into a simple 0–100 scale.
Liquidity expansion provides fuel for risk assets, while contraction drains leverage and risk appetite. The Signal Line acts as a confirmation overlay for trend and allocation strategies, showing whether systemic liquidity is broadly supportive or restrictive. Readings above 50 indicate an expansionary environment (risk-on bias), below 50 a contractionary one (risk-off bias). Because the calculation uses higher-timeframe macro data, it can be displayed on any chart to give traders a consistent, regime-aware signal that bridges macro policy and technical execution.






















