Indicador Pine Script®
Indicadores e estratégias
Indicador Pine Script®
PSP SHALOM BNS - Global Pro Default OFFPSP Professional Asset Correlation Marker
This indicator identifies "Mixed Candles" (Divergence) between major indices like NASDAQ, S&P 500, and Dow Jones. Its primary goal is to spot moments where one asset is moving in the opposite direction of the others, signaling potential market shifts or "fake-outs".
Main Features:
Visual Correlation: Automatically compares the color (Red/Green) of the candle across selected assets.
PSP Marker: Displays a "P" (or your chosen shape) above the candle when a divergence is detected.
Integrated Alerts: Supports built-in alerts for real-time notification upon candle close.
Settings (Inputs):
Assets Selection (NASDAQ / S&P 500 / DAO): Choose the specific symbols you want to compare.
Include DAO: A toggle to include/exclude the Dow Jones from calculations (Default is OFF).
Sensitivity %: Define a minimum movement percentage to filter out market "noise" and Doji candles.
Marker Shape: Select your preferred visual icon (P, Star, Arrow, etc.).
Marker Size: Adjust the size of the icon on your chart (Small, Normal, Large).
Marker Color: Fully customize the color of the signal.
How to Enable Alerts (for the "Instructions" or "Description" field)
To receive real-time notifications (sound, pop-up, or mobile), follow these steps:
Open Alert Panel: Click the Clock icon on the right sidebar.
Create Alert: Click the + (Create Alert) button.
Condition: In the first dropdown, select "PSP SHALOM BNS - Global Pro".
Trigger: In the second dropdown, you must select "Any alert() function call".
Options: It is recommended to select "Once Per Bar Close" to avoid false signals during live candle movements.
Notification: Choose your preferred notification method (Notify in App, Pop-up, etc.).
Create: Click the Create button. You are all set!
גרסה בעברית
סיכום אינדיקטור: PSP Professional – זיהוי חריגות בין מדדים
אינדיקטור זה מזהה "נרות מעורבים" (Divergence) בין המדדים המרכזיים: נאסד"ק, S&P 500 ודאו ג'ונס. מטרתו העיקרית היא לאתר רגעים שבהם נכס אחד נע בכיוון הפוך מהשאר, מה שעשוי להעיד על שינוי במגמה או על פריצות שווא בשוק.
+1
תכונות עיקריות:
מתאם ויזואלי: השוואה אוטומטית של צבע הנר (אדום/ירוק) בין הנכסים שנבחרו.
סימון PSP: מציג את האות "P" (או כל צורה שתבחרו) מעל הנר ברגע שמתגלה חריגה.
התראות מובנות: תמיכה מלאה בהתראות בזמן אמת עם סגירת הנר.
הגדרות (Inputs):
בחירת נכסים (NASDAQ/S&P 500/DAO): בחירת הסימבולים הספציפיים להשוואה.
הכללת דאו ג'ונס (Include DAO): אפשרות להפעיל או לכבות את חישוב הדאו ג'ונס (ברירת מחדל: כבוי).
סף רגישות (Sensitivity %): קביעת אחוז תנועה מינימלי כדי לסנן "רעשי שוק" ונרות ללא גוף משמעותי.
צורת סימון (Marker Shape): בחירת האייקון שיופיע על הגרף (P, כוכב, חץ וכו').
גודל סימון (Marker Size): שליטה על גודל האייקון (קטן, רגיל, גדול).
צבע סימון (Marker Color): התאמה אישית של צבע הסיגנל.
הוראות להפעלת התראות
כדי לקבל התראות בזמן אמת (צליל, הודעה קופצת או התראה לנייד), יש לעקוב אחר השלבים הבאים:
פתיחת לוח ההתראות: לחצו על אייקון השעון בסרגל הכלים הימני.
יצירת התראה: לחצו על כפתור ה- + (Create Alert).
תנאי (Condition): בתיבה הראשונה, בחרו את האינדיקטור: "PSP SHALOM BNS - Global Pro".
טריגר: בתיבה השנייה, חובה לבחור באפשרות "Any alert() function call".
אפשרויות: מומלץ לבחור ב-"Once Per Bar Close" (פעם אחת בסגירת נר) כדי למנוע התראות שווא בזמן שהנר עדיין זז.
סיום: לחצו על Create. מעכשיו המערכת תתריע לכם על כל סיגנל!
Indicador Pine Script®
Liquidity Swings SOL V10.2 - 3CommasHere's a publish-ready description:
Liquidity Swings — Smart Money Sweep Strategy
Automated futures strategy that identifies and trades institutional liquidity sweeps on SOLUSDT 30-minute charts.
How it works:
Price tends to sweep above/below key swing levels where stop losses cluster — these are liquidity zones. Smart money grabs this liquidity, then reverses. This strategy detects those sweeps and enters on the reversal.
Features:
Liquidity zone detection using pivot-based swing highs/lows
Multi-layer trend filtering (HTF EMA + local EMA cross + price action)
Breakout detection with volume confirmation
Zone-based & ATR-adaptive stop losses with safety cap
Trailing stop with activation threshold
Cascading partial take profits at opposing zones
Optimized for SOL's volatility profile
Designed for:
SOLUSDT Perpetual Futures (Bybit)
30-minute timeframe
5x leverage, cross margin
Compatible with 3Commas / WunderTrading webhook automation
Risk management built-in: Every trade has a hard stop loss, safety cap, and optional trailing stop. No open-ended positions.
⚠️ Invite-only. DM for access.
Estratégia Pine Script®
Volumetric HTF Order Blocks (Buyer/Seller Strength) - Final Fixmtf order block with volume profile and poc on each one
Indicador Pine Script®
ProjectSyndicate FVG FinderNRP Logic (Non-Repainting): Signals are built to remain stable once confirmed
Real-Time FVG Detection: Automatically identifies bullish + bearish FVG zones as they form
Clean Zone Visualization: Boxed imbalance areas that are easy to trade from
Auto-Cleanup (Mitigation): Zones update based on your chosen fill rule (Touch / 50% / Full)
B: Anti-Noise Filtering: Minimum size + optional ATR filter to remove weak gaps
4 Pine Script v6: Built on the latest TradingView engine for stability and performance
Alerts + Markers: Get notified when new FVGs print + optional triangle signal
Indicador Pine Script®
Relative Outperformance vs SPX (Pro Daily)Find true market leaders before the breakout.
This indicator measures a stock’s percentage outperformance versus the S&P 500 (SPX) across multiple daily timeframes (5, 20, 50, 200) and combines them into a weighted Relative Strength (RS) Score.
Unlike simple ratio indicators, this tool shows:
📊 Multi-period relative performance (%)
⭐ Weighted RS Score
🚦 Early Leader signal (20D + 50D strength)
🏆 Confirmed Leader signal (adds 200D trend)
📋 Clean dashboard panel for fast decision-making
Why This Matters
Strong stocks outperform the index before they break out.
This tool helps you:
Identify emerging leadership
Confirm institutional sponsorship
Avoid weak relative names
Improve breakout and pullback selection
Green values = outperforming SPX
Red values = underperforming SPX
Designed specifically for daily swing trading and position trading.
Best Used With
Breakout strategies
Pullbacks to moving averages
Undercut & Rally setups
Relative volume confirmation
Market rotation strategies
Suggested Daily Settings
5 / 20 / 50 / 200
Weights: 0.20 / 0.35 / 0.35 / 0.10
Smoothing: 3
Disclaimer
Educational purposes only.
Not financial advice.
Past performance does not guarantee future results.
Indicador Pine Script®
Bipen Mann 50EMA SetupHere is a **clean, professional indicator description** written exactly for your **final script and logic**.
You can **copy–paste this directly** into TradingView when you save or publish the indicator.
---
## 📌 Bipen Mann 50EMA Setup
**Bipen Mann 50EMA Setup** is a rule-based trend continuation indicator designed to give **clean, high-probability entries** using **EMA 50**, **retests**, and **structure breaks**.
It avoids early entries and noise by confirming price behavior **before and after the EMA retest**.
This indicator works on **all markets** (Forex, Indices, Crypto, Commodities) and automatically adapts to the **timeframe selected on the chart**.
---
## 🔵 BUY Setup Logic
A **BUY setup** is created using the following sequence:
1. Price must be **above the 50 EMA**
2. While price remains above EMA:
* The indicator tracks the **most recent RED (bearish) candle**
3. Price must **touch the EMA 50** (wick or body — both are valid)
* If the retest candle itself is red, it is used as the trigger candle
4. After the retest:
* A **BUY signal is generated when price breaks the HIGH of the most recent RED candle that occurred before (or at) the EMA retest**
5. **Stop Loss**
* Automatically placed at the **low of the trigger red candle**
➡️ **Entries always occur AFTER the EMA retest**
---
## 🔴 SELL Setup Logic
A **SELL setup** follows the exact opposite rules:
1. Price must be **below the 50 EMA**
2. While price remains below EMA:
* The indicator tracks the **most recent GREEN (bullish) candle**
3. Price must **touch the EMA 50**
* If the retest candle itself is green, it is used as the trigger candle
4. After the retest:
* A **SELL signal is generated when price breaks the LOW of the most recent GREEN candle that occurred before (or at) the EMA retest**
5. **Stop Loss**
* Automatically placed at the **high of the trigger green candle**
---
## 📊 Visual Elements
* **EMA 50** plotted on the chart
* **Entry trigger lines**
* 🟢 Green line → BUY entry
* 🔴 Red line → SELL entry
* **Stop-loss lines**
* 🟡 Yellow line → BUY stop loss
* 🔵 Light blue line → SELL stop loss
* **Small, clean arrows** for entries:
* ▲ Green triangle → BUY
* ▼ Red triangle → SELL
*(No large labels or filled boxes for a clean chart)*
Both BUY and SELL setups can appear **at the same time**, allowing up to **four lines** on the chart.
---
## ⚙️ Indicator Settings
* **EMA Length**
Default: 50 (can be adjusted)
* **Expire setup after retest (bars)**
Cancels the setup if price does not break the trigger within the specified number of candles
* **Require candle CLOSE beyond trigger**
* ON → Conservative confirmation (close break)
* OFF → Aggressive entry (wick break allowed)
---
## 🎯 Best Use Case
* Trending markets
* Pullback & continuation strategies
* Works best on **M15, H1, H4**
* Suitable for **Gold (XAUUSD), Forex pairs, Indices, Crypto**
---
## ⚠️ Notes
* No signal will appear if:
* EMA is not retested
* No opposite candle exists before the retest
* This behavior is intentional to **filter low-quality trades**
* The indicator is a **confirmation tool**, not a prediction tool
---
Indicador Pine Script®
BETradez HTF BOS/SWING/FVGBETradez HTF BOS/SWING/FVG
Identifies swing highs and lows, marks Break of Structure (BOS) levels on both the current and a higher timeframe, and highlights Fair Value Gaps that auto-delete once filled. An optional filter lets you hide swing labels unless a Fair Value Gap formed between the swing and the next opposing swing point. All colors are fully customizable.
Indicador Pine Script®
ICT by KG# ICT by KG
### A Complete ICT Structure-Based Entry System
**ICT by KG** is a sophisticated Pine Script indicator that automates core ICT concepts, providing clear entry signals based on market structure, displacement, and premium/discount arrays.
## 🔍 Overview
This indicator combines multiple ICT concepts into one cohesive system:
- Market Structure (Swing Highs/Lows, Break of Structure)
- Displacement Detection (momentum candles with minimal wicks)
- PD Array Tracking (Fair Value Gaps & Order Blocks)
- Kill Zone Filtering (New York session)
- VWAP Integration (directional filter)
## 🎯 Core Logic
Signals are generated ONLY when ALL conditions align:
**LONG Entry:**
- Bullish Break of Structure (BOS) confirmed
- Bullish displacement detected (minimum consecutive bars)
- Price retraces into a bullish FVG or Order Block
- Within an active Kill Zone (optional)
- Price above VWAP (optional)
- CE (50% level) touch required (configurable)
**SHORT Entry:**
- Bearish Break of Structure (BOS) confirmed
- Bearish displacement detected
- Price retraces into a bearish FVG or Order Block
- Within an active Kill Zone (optional)
- Price below VWAP (optional)
- CE (50% level) touch required (configurable)
## ⚙️ Key Features
**Market Structure**
- Customizable swing length (3–20 bars)
- HTF bias timeframe reference
- Automatic BOS labels & background shading
**Displacement**
- ATR-based threshold + wick/body ratio filter
- Configurable minimum consecutive bars
- Highlighted bars for visual confirmation
**PD Arrays (FVG & Order Blocks)**
- FVG boxes appear after BOS
- Order Blocks = last opposite candle before displacement
- CE (50%) level requirement option
- Configurable lookback & display limits
**Kill Zone Filter**
- NY Kill Zone (7–10 AM ET) & NY Afternoon (1–4 PM ET)
- Optional enable/disable
**VWAP Integration**
- Session or Weekly reset
- Directional filter (longs > VWAP / shorts < VWAP)
## 📊 Visual Elements
- Swing Points: "H" (red) & "L" (green) labels
- BOS Labels: "BOS↑" (lime) & "BOS↓" (red)
- Displacement: Highlighted bars
- FVG/OB Boxes: Semi‑transparent green/red
- Entry Signals: "⚡ LONG" (lime) & "⚡ SHORT" (red) labels
- Background Shading: Subtle green/red for structure bias
## 📈 Heads‑Up Display (HUD)
A live info panel shows:
- Kill Zone status
- Market structure bias
- BOS age & status
- Displacement status
- PD Array activity
- VWAP relationship
- Action recommendation
## ⚡ Alerts
Built‑in alerts for:
- LONG Entry signals
- SHORT Entry signals
- Bullish Break of Structure
- Bearish Break of Structure
## 🛠️ Input Parameters
| Group | Parameter | Description |
|--------------------|-------------------------|--------------------------------------|
| Market Structure | Swing Length | Pivot sensitivity (3–20) |
| | HTF Bias Timeframe | Higher timeframe reference |
| | Show Swing Points | Toggle H/L labels |
| Displacement | ATR Multiplier | Displacement threshold (1.0–3.0) |
| | Max Wick/Body Ratio | Rejection filter (0.1–0.5) |
| | Min Displacement Bars | Consecutive bars required (1–5) |
| PD Arrays | Show FVG/OB | Toggle boxes |
| | Max to Track | Number of boxes displayed (3–20) |
| | Order Block Lookback | OB candle position (1–10) |
| | Require CE Tag | Force 50% level touch |
| VWAP | Show VWAP | Toggle VWAP line |
| | VWAP Reset | Session or Week |
| | VWAP Filter | Directional filter |
| Kill Zones | Enable Filter | Toggle time filter |
| | NY Kill Zone | NY session only |
| Colors | Bullish/Bearish Colors | Customize box colors |
## 📝 How to Use
1. Add to chart and adjust inputs as needed.
2. Watch the HUD – all conditions must align.
3. Entry signals appear when price taps into PD arrays.
4. Confirm with higher timeframe bias (optional).
5. Manage risk according to your trading plan.
## ⚠️ Disclaimer
This indicator is for educational and informational purposes only. It is not financial advice. Past performance does not guarantee future results. Always conduct your own analysis and risk management before trading.
---
**Version:** 1.0
**Author:** KG
**Based on:** ICT (Inner Circle Trader) Methodology
Indicador Pine Script®
TREND MOMENTUM PRO
# TREND MOMENTUM PRO - Professional Edition
## 🎯 Overview
**TREND MOMENTUM PRO** is an advanced multi-timeframe trading indicator designed for professional traders seeking precise market entries and exits. Combining real-time sideways phase detection with intelligent entry signals, this indicator identifies optimal trading opportunities while filtering out choppy, low-probability setups.
Perfect for **day traders**, **swing traders**, and **scalpers** looking for high-probability entries with built-in risk management.
---
## ✨ Key Features
### 🔍 Advanced Sideways Phase Detection
- **Angle-Based Algorithm**: Detects sideways phases using gradient analysis (< 8° = sideways)
- **Automatic Exit Detection**: Sideways phase ends when angle exceeds 15° (clear trend)
- **Real-Time Status Table**: Visual indicator showing current market phase with Power % and CCI
- **Intelligent Filtering**: Eliminates false signals in choppy, low-probability trading zones
### 🎯 3-Tier Alert System
**TIER 1 - PERFECT ENTRY 🚀🚀🚀** (Gold Standard)
- Triggers when sideways phase ENDS + LONG/SHORT signal = SAME BAR
- Alert: "PERFECT ENTRY! SIDEWAYS ENDED + SIGNAL!"
- Includes Power % and CCI for confirmation
**TIER 2 - CONFIRM TRADE 📈📉** (Golden Opportunity)
- Triggers when sideways phase ENDS + active trade exists
- Alert: "SIDEWAYS ENDED! TRADE ACTIVE - AIM FOR TP!"
- Confirms trend continuation with momentum metrics
**TIER 3 - READY TO TRADE ✅** (Preparation)
- Sideways phase ended with no active signals
- Trader receives alert to prepare for potential entry
- Shows current Power % and CCI values
### 📊 Multi-Timeframe Analysis (8 TF)
- Analyzes trends across TF1, TF2, TF3, TF4, TF5, TF6, TF7, TF8
- MTF Synergy identification for maximum confidence setups
- "ALL TF ALIGNED" confirmation for ultra-strong signals
### 💰 Intelligent TP Probability System
- Dynamic take-profit levels with probability percentages
- TP1, TP2, TP3 targets based on support/resistance zones
- Probability weighting: 75% → 50% → 25% (or customizable)
- Automatic adjustment based on market strength
### 🚀 Entry Signal Recognition
- **CCI Extreme Detection**: Identifies overbought/oversold conditions
- **Power Strength Analysis**: Measures trend momentum (0-100%)
- **Harmonic Pattern Recognition**: Detects bullish/bearish patterns
- **Support/Resistance Testing**: Tracks retest attempts and breakouts
### ⚡ Ultra Strength Signals
- **Nuclear Long/Short**: CCI + Power + ALL MTF ALIGNED = Maximum confidence
- **Ultra Strength Confirmation**: Volume surge + Multi-timeframe alignment
- **Atomic Entry Alerts**: Only triggered when ALL conditions met
### 🎨 Professional Dashboard
- Real-time status display with color-coded signals
- Entry price, SL, and TP levels clearly marked
- Support/Resistance zones visualization
- Current market phase indicator
- Live Power % and CCI readings
---
## 📋 How It Works
### Phase 1: Sideways Detection
The indicator continuously monitors price angle. When angle < 8° + small candles detected = SIDEWAYS PHASE ACTIVE. Trader is alerted to avoid entries during choppy consolidations.
### Phase 2: Trend Breakout
When angle increases to > 15° = CLEAR TREND DETECTED. Sideways phase ends automatically. This is when:
- If LONG/SHORT signal fires simultaneously = PERFECT ENTRY ALERT
- If trade already active = CONFIRM TRADE ALERT
- If no signal yet = READY TO TRADE ALERT
### Phase 3: Trade Management
Once entry confirmed, dashboard shows:
- TP1, TP2, TP3 with probability percentages
- Stop Loss level with actual price reference
- Real-time trade status updates
- Automatic TP hit notifications
### Phase 4: Exit Confirmation
Alerts fire when TP levels hit or SL touched, with detailed status messages.
---
## 🎮 Perfect For
✅ **Day Traders** - High-frequency entries with clear exit signals
✅ **Swing Traders** - Multi-timeframe confirmation before entries
✅ **Scalpers** - Quick entries in trending markets only
✅ **Risk Managers** - Clear SL/TP with probability weighting
✅ **Automated Trading** - Webhook alerts for bot integration
---
## ⚙️ Customizable Settings
**Neon Engine Parameters:**
- Reaction Speed (Sensitivity) - Adjusts indicator responsiveness
- Channel Width Multiplier - Fine-tunes support/resistance zones
**Harmonic Pattern Settings:**
- Enable/Disable pattern recognition
- Pattern confirmation filtering
- Accuracy and confirmation periods
**Alert Thresholds:**
- CCI extreme trigger level (default: 150/-150)
- Power strength threshold (0-100%)
- Volume confirmation percentage
**Display Options:**
- Enable/Disable chart overlays
- Dashboard position (top-left, top-right, bottom)
- Color customization for all elements
---
## 📊 Alert Types Included
🔔 **Sideways Phase Detection**
- Sideways phase started (avoid trading)
- Sideways phase ended (market ready)
🔔 **Entry Signals**
- Perfect entry (sideways end + signal)
- Trend reversal detected
- CCI overbought/oversold
- Power extreme (strong momentum)
🔔 **Trade Management**
- TP 1/2/3 hit alerts
- Stop loss hit alerts
- Support/resistance retest attempts
- Pattern entry signals
🔔 **Multi-Timeframe**
- All TF aligned (maximum confluence)
- MTF synergy detected
- Trend reversal across multiple timeframes
---
## 💡 Trading Tips
1. **Wait for Sideways End + Signal** = Highest probability entries
2. **Use Multi-Timeframe Confirmation** = Filter out false signals
3. **Follow TP Probabilities** = Higher probability = closer target
4. **Watch Power %** = High power (85%+) = strong trend | Low power (< 20%) = potential reversal
5. **Combine with Risk Management** = Always use stop loss
6. **Test in Backtesting** = Optimize parameters for your trading style
---
## 🔐 Access Information
**This is an INVITE-ONLY indicator.**
To gain access:
1. Follow @Oezkan1983 on TradingView
2. Send a direct message with subject: "TREND MOMENTUM PRO Access Request"
3. Include brief trading background (day trader/swing/scalper)
4. Receive invitation within 24 hours
5. Indicator will appear in your private scripts
For questions or support, visit TradingView profile or send direct message.
---
## ✅ Key Advantages
✔️ **Eliminates Choppy Markets** - Sideways detection filters false signals
✔️ **Perfect Entry Points** - Combines trend + signal confirmation
✔️ **Professional Dashboard** - Real-time status + all metrics visible
✔️ **Multi-Timeframe Confirmation** - 8 TF analysis for maximum confidence
✔️ **Intelligent Alerts** - 3-tier system prevents alert fatigue
✔️ **Probability-Weighted TP** - Based on market strength, not fixed levels
✔️ **Zero Repaint** - All signals confirmed on close
✔️ **Webhook Compatible** - Perfect for automated trading bots
---
## ⚠️ Disclaimer
**This indicator is for educational and informational purposes only.**
- Past performance does not guarantee future results
- Always use proper risk management and position sizing
- Test on demo account first before live trading
- Trading cryptocurrency carries significant risk
- Consult a financial advisor if unsure
---
## 📈 Version History
**V1.0 - Launch Edition**
- Core sideways detection algorithm (angle-based)
- 3-tier alert system (Perfect Entry + Confirm + Ready)
- Multi-timeframe analysis (8 TF)
- Professional dashboard with real-time status
- TP probability system
- Harmonic pattern recognition
- Ultra strength signal detection
---
## 🎯 Bottom Line
**TREND MOMENTUM PRO** is the professional trader's solution for identifying high-probability entries while automatically filtering out choppy, low-probability markets. With intelligent sideways detection and multi-timeframe confirmation, this indicator gives you the edge you need to trade with confidence.
**Trade smarter. Trade better. Trade TREND MOMENTUM PRO.** 🚀
---
**Creator:** @Oezkan1983
**Contact:** TradingView Direct Message
**Support:** Available for invite-only members
**Status:** Professional Grade • Zero Repaint • Multi-Timeframe
Indicador Pine Script®
Tribute To Peter LynchTribute To Peter Lynch - Fund Manager Simulator
"Know what you own, and know why you own it." - Peter Lynch
WHO WAS PETER LYNCH?
Peter Lynch is one of the greatest investors who ever lived. From 1977 to 1990, he managed the Fidelity Magellan Fund and turned it from $18 million into $14 billion in assets. He averaged a 29.2% annual return for 13 straight years, making Magellan the best-performing mutual fund in the world.
What made Lynch different? He believed regular people could beat Wall Street. He bought stocks in companies he understood - he'd ask minivan owners at movie theaters what they thought of their Chrysler, he'd notice the local factory hiring more people, he'd pay attention to which donut shop had the longest line. He called this your "investor's edge" - the things you already know from your daily life that Wall Street analysts sitting in their offices can't see.
Lynch famously said: "If you can tell your stock story to a fifth grader and they understand it, you've got a good one. The more complicated the story, the more likely it is to fall apart."
He also had the stomach for downturns. During his 13 years at Magellan, the market dropped 10% or more NINE times, and Magellan fell right along with it every single time. But he never panicked. He knew that behind every stock is a company, and if the company is doing well, the stock will eventually follow.
WHAT THIS SCRIPT DOES
This is a fund manager simulator built entirely around Peter Lynch's investing philosophy. It's not a technical indicator. There are no moving averages, no RSI, no MACD. Lynch was a fundamental investor - he cared about what a company earns, how fast it's growing, how much debt it has, and whether the story makes sense.
The script classifies any stock into one of Lynch's 6 categories, scores it on a 0-100 Lynch Score, evaluates the fundamental story, and generates buy/sell signals based purely on the same criteria Lynch used at Magellan.
THE 6 STOCK CATEGORIES
Lynch believed you can't treat all stocks the same. A 50% gain on a Slow Grower is fantastic and probably time to sell. The same 50% on a Fast Grower could be just the beginning of a 10-bagger. He broke every stock into 6 categories:
1. FAST GROWERS (20%+ earnings growth)
Companies growing earnings fast, typically small to mid-sized. These are the potential 10-baggers. Lynch looked for PEG ratios below 1.0 and used his "baseball inning" concept - you want to buy these in innings 2-5, when the formula is proven but there's still a long runway ahead. Think of Walmart when it only had a few hundred stores, or Microsoft 3 years after its IPO.
2. SLOW GROWERS (3-8% earnings growth)
Large, mature companies that grow about as fast as the overall economy. You buy these for the dividend. Lynch looked for steady, rising dividends with a low payout ratio (so the dividend is safe). If the dividend yield drops or the payout ratio gets too high, it's time to move on.
3. STALWARTS (10-14% earnings growth)
Big, solid companies that aren't going to disappear but aren't going to triple overnight either. Lynch's rule: take your 30-50% gain and rotate the money into another Stalwart. These are your portfolio's defense - they hold up in recessions and won't go bankrupt.
4. CYCLICALS (tied to the economic cycle)
Companies in industries like autos, airlines, steel, and chemicals that boom and bust with the economy. Here's Lynch's counterintuitive trick: buy cyclicals when the PE is HIGH (that means earnings are at the trough and about to recover) and sell when the PE is LOW (earnings have peaked and are about to fall). This is the opposite of how PE works for every other category.
5. TURNAROUNDS (beaten down, potential recovery)
Companies in deep trouble that might recover. Lynch always checked: does this company have enough cash to survive? Is there a real plan (new management, cost cutting, selling bad divisions)? He said don't buy on hope - wait for actual evidence the turnaround is working. But when they work, the upside can be enormous.
6. ASSET PLAYS (hidden value)
Companies sitting on assets the market doesn't see or doesn't value - real estate, patents, brand names, cash on the balance sheet. Lynch's example: Disney after it opened Epcot. Growth slowed, but the company was sitting on the Disney name, all that Florida land, and a library of characters worth billions that were carried on the books for nothing.
BAR REPLAY - WHERE THIS SCRIPT REALLY SHINES
This script was built with TradingView's Bar Replay feature in mind. Bar Replay is what transforms this from a backtest into a fund manager simulator.
HOW TO USE BAR REPLAY:
1. Add the script to your chart
2. Pick any stock and classify it (Fast Grower, Stalwart, etc.)
3. Set your fundamental inputs if using Manual mode, or let Auto mode pull TradingView financial data
4. Click the Bar Replay button on your toolbar (the clock icon with a rewind arrow)
5. Pick a starting date - maybe go back 5 years, or 10, or start right before a crash
6. Press Play and watch the simulation unfold bar by bar
WHAT YOU'LL SEE IN BAR REPLAY:
- The Lynch Score updates in real time as fundamentals change each quarter
- The Story Status shifts: "Growth Accelerating" might become "Growth Slowing" as the company matures
- Buy and sell signals fire when Lynch's criteria are met
- The P&L tracker shows your position gain in real time
- The Peter Lynch portrait in the corner changes color based on how your portfolio is doing:
-- Equity rising: Lynch appears in bright GREEN against a deep BLUE background, getting more vivid as gains grow
-- Heavy drawdown: Lynch turns CRIMSON RED against a BLACK background
-- Stop loss hit: The portrait FLASHES RED as a warning
-- Neutral: Lynch appears in CYAN/TEAL against dark navy
- The daily Lynch wisdom quote rotates, keeping you in his mindset
BAR REPLAY SCENARIOS TO TRY:
- Start replay on Apple (AAPL) in 2003 as a Turnaround - watch it reclassify into a Fast Grower
- Replay Ford (F) through 2008-2012 as a Cyclical - see Lynch's high-PE-buy rule in action
- Run Coca-Cola (KO) from 1990 as a Stalwart - practice the 30-50% rotate rule
- Try any stock through the 2020 COVID crash - Lynch survived 9 crashes at Magellan, now you can experience one
SETTINGS GUIDE - EXPLAINED SIMPLY
Think of the settings like customizing a video game character before you play. Here's what each group does:
GROUP 1: STOCK TYPE
"What kind of company is this?"
Pick one of the 6 categories. This changes ALL the rules the script uses.
Baseball Inning: Where is this company in its life?
- Innings 1-3 = Young, lots of room to grow (like a kid)
- Innings 4-6 = Middle age, proving itself
- Innings 7-9 = Old, running out of gas
Early innings get a score bonus. Late innings get a penalty.
GROUP 2: FUNDAMENTAL DATA
"Where do the numbers come from?"
- Auto mode: TradingView pulls real financial data (EPS, revenue, debt) automatically. Best for stocks.
- Manual mode: You type in the numbers yourself. Use this for crypto, forex, or if Auto data looks wrong.
GROUP 3: PEG & VALUATION
"How do I know if a stock is cheap or expensive?"
PEG = Price-to-Earnings divided by Growth rate.
- PEG of 1.0 = fairly priced (PE matches growth rate)
- PEG below 1.0 = cheap (you're paying less than what the growth is worth)
- PEG above 2.0 = expensive
The Buy Threshold (default 1.0) means: "only buy if PEG is at or below this number."
The Sell Threshold (default 2.0) means: "sell if PEG goes above this number."
GROUP 4: BALANCE SHEET HEALTH
"Is this company in good financial shape?"
- Max Debt/Equity: How much debt is too much? Default 0.50 means total debt shouldn't be more than half of the company's net worth. Lynch always checked the balance sheet.
- Min Cash Ratio: Does the company have enough cash? Important for Turnarounds.
- Max Payout Ratio: Is the company paying out too much of its earnings as dividends? Above 80% means the dividend might get cut.
GROUP 5: CATEGORY RULES
"Special rules for each stock type."
These are the specific thresholds for each of the 6 categories. The defaults are based on Lynch's actual criteria from his books.
Examples:
- Fast Grower Min Growth 20%: Lynch said a Fast Grower needs at least 20% earnings growth
- Stalwart Rotate Target 40%: Lynch rotated Stalwarts after 30-50% gains
- Cyclical Trough PE 25: Buy cyclicals when PE is HIGH (counterintuitive!)
GROUP 6: STRATEGY SETTINGS
"Should the Lynch Score control the trades?"
- Score Gate OFF (default): The Lynch Score is just a meter showing conviction. Trades fire based on category rules alone.
- Score Gate ON: The Lynch Score must be above the entry threshold to buy and below the exit threshold to sell. This adds an extra filter.
GROUP 7: RISK MANAGEMENT
"How much can I lose on one trade?"
- Stop Loss: If the stock drops this % from your entry price, sell automatically. Default 15%.
- Take Profit: If the stock rises this % from your entry price, sell automatically. Default 100% (a double).
GROUP 8: DISPLAY
"What do I see on the chart?"
- Show/hide the Lynch portrait, the dashboard panel, and buy/sell signals
- Customize your bull/bear/neutral colors
THE DASHBOARD
The top-right panel shows everything Lynch would want to see at a glance:
- LYNCH SCORE: A 0-100 conviction meter with a visual bar. Built from 5 sub-scores:
-- PEG Score (0-25): Is the stock cheap relative to its growth?
-- Earnings Score (0-25): Is earnings growth meeting the target for this category?
-- Balance Sheet Score (0-20): How healthy is the financial structure?
-- Margin Score (0-15): Are profit margins good and expanding?
-- Dividend Score (0-15): Is the dividend policy appropriate for this category?
- STORY STATUS: The current fundamental narrative in plain English
-- "Growth Accelerating", "Trough - Buy Zone", "Turnaround Succeeding", etc.
- SIGNAL: The specific reason behind the current buy or sell signal
- P&L: When in a trade, shows your unrealized gain/loss and warns Stalwart holders when approaching the rotate target
- VALUATION: PEG ratio, PE ratio, and fair value comparison
- EARNINGS: EPS, EPS growth rate, and revenue growth vs. category targets
- BALANCE SHEET: Debt/equity ratio and net cash per share
- MARGINS: Profit margin trend (expanding or contracting)
- DIVIDENDS: Yield, payout ratio, and sustainability assessment
- DAILY WISDOM: A rotating quote from Peter Lynch to keep you grounded
RESEARCH & SOURCES
This script was built using the following primary sources, all studied extensively:
1. "One Up On Wall Street" by Peter Lynch with John Rothchild (1989)
share.google
Lynch's first book laying out his complete investment philosophy - the 6 categories, PEG ratio, the "story" framework, and the idea that everyday investors have edges over professionals.
2. "Beating the Street" by Peter Lynch with John Rothchild (1993)
share.google
Lynch's second book where he walks through his actual portfolio decisions at Magellan, explains his mutual fund strategy, and shows step-by-step how he picks stocks. 328 pages of real-world application.
3. "The Peter Lynch Playbook" compiled by Mayur Jain (@mjbaldbard)
share.google
A comprehensive set of notes summarizing both Lynch books plus interview snippets. Covers portfolio allocation percentages, category-specific checklists, the 2-minute drill for each stock type, risk/reward profiles, and sell criteria. This document was instrumental in translating Lynch's qualitative approach into quantifiable rules.
4. Peter Lynch's "Stock Shop" Video Consultation (Fidelity Archives)
youtu.be
A full-length video presentation where Lynch personally explains his approach to categorizing stocks, building stories, understanding PE ratios, evaluating balance sheets, and managing risk. Key quotes transcribed and used to calibrate the scoring engine and story status logic.
IMPORTANT NOTES
- This is a STRATEGY script, not an indicator. It generates actual backtestable trades.
- The script is purely fundamental. No technical analysis. Lynch didn't use charts to make decisions.
- Auto mode requires stocks with TradingView financial data. For other instruments, use Manual mode.
- The Lynch Score is a CONVICTION METER by default, not a trade gate. Enable Score Gate in settings if you want it to filter trades.
- All portrait coloring is non-repainting. Colors only update on confirmed (closed) bars.
- Start with Bar Replay. That's where the magic happens. Watch the story unfold bar by bar, just like Lynch did at his desk at Fidelity every morning.
"The key organ is the stomach, not the brain." - Peter Lynch
Estratégia Pine Script®
Crypto CPR With ATRThe Two Main Components:
1. CPR (Central Pivot Range) - Your Daily Roadmap
Think of CPR as a "price forecast" for tomorrow based on today's trading activity.
What it shows:
Pivot Point (PP): The average price level - the market's "center of gravity"
Support Levels (S1, S2, S3): Price floors where buyers might step in (below current price)
Resistance Levels (R1, R2, R3): Price ceilings where sellers might take profits (above current price)
Central Range (BC & TC): The "zone" where most action happens
Why it's useful:
Professional traders watch these levels daily
Price often "respects" these lines - bouncing off them or pausing at them
Helps you plan entries, exits, and stop-losses
The Magic: This indicator calculates tomorrow's levels in real-time as today unfolds. The lines extend into tomorrow so you can plan ahead!
2. ATR Trailing Stop - Your Trend Guardian
This is like a smart "moving stop-loss" that adjusts based on market volatility.
What it shows:
Green line: Market is in an uptrend - hold your long positions
Red line: Market is in a downtrend - stay cautious or short
Blue line: Market is choppy/neutral
Why it's useful:
Automatically adjusts for volatile vs calm markets
Helps you ride winning trends longer
Protects profits by signaling when trend is losing steam
Prevents premature exits during healthy pullbacks
Indicador Pine Script®
SMC + PDH/PDL by LishchenkoIt is an SMC indicator for TradingView: it plots PDH/PDL, FVG, order blocks, IDM, and the latest swing‑high/low structure levels, and also invalidates these zones/labels over time. Below is what each block does.
1. General settings
Creates the indicator SpaceTrading SMC + PDH/PDL with overlay = true and high max_lines_count/max_boxes_count so it can draw many zones on the chart.
Has input groups for:
SMC elements: show/hide IDM, FVG, OB, structure SH/SL, and how many bars to extend boxes to the right.
Colors: base bull/bear color, opacity and line width for FVG and OB.
2. Timeframe filter
The indicator only builds SMC elements on timeframes from 5 minutes and higher (intraday ≥5m, D, W, M).
If the chart TF is below 5 minutes, it throws a runtime.error with a warning message not to use it on very low TFs.
IDM is additionally restricted to specific periods (5, 15, 30, 60, 180, 240, D, W, M), with a separate hard block for the 5‑minute TF.
3. PDH / PDL (Previous Day High / Low)
When showPDH_PDL is enabled, it fetches the previous day’s high/low with request.security(..., "D", high /low ).
It creates two persistent lines pdhLine and pdlLine that are updated on every bar so they extend to the right across the current day.
On the last bar it adds “PDH” and “PDL” labels at those levels as titled previous‑day high/low levels.
4. FVG (Fair Value Gap) + invalidation
FVG conditions:
Bullish FVG: confirmed bar, low > high and close > open .
Bearish FVG: confirmed bar, high < low and close < open .
When FVG appears it creates a box:
Bull: from high down to current low.
Bear: from current high down to low .
Box is labeled “FVG” with no fill, only a border (color/opacity from settings).
Boxes are stored in arrays bullFVGs and bearFVGs.
Invalidation:
Bullish FVG is deleted if close < the box bottom.
Bearish FVG is deleted if close > the box top.
It loops through the arrays from the end, deletes the box from the chart and removes it from the array.
5. Order Block (OB) + invalidation
Uses arrays bullOBs and bearOBs to store OB boxes.
Creation rules:
newBullOB: confirmed bar, there is a bull FVG and the candle two bars back was bearish (close < open ) — the last down candle before the move up.
newBearOB: confirmed bar, there is a bear FVG and the candle two bars back was bullish (close > open ).
For each new OB it creates a box:
Vertically: from high to low .
Horizontally: from bar_index - 2 to bar_index + extendBoxes.
With semi‑transparent fill, labeled “OB” aligned to the right.
Invalidation:
Bullish OB is deleted if close < the box bottom.
Bearish OB is deleted if close > the box top.
Like FVG, everything is handled via arrays, traversed from the end and cleaned up.
6. IDM (inducement / imbalance) + invalidation
IDM is disabled on the 5‑minute timeframe (idmAllowedOnThisTF = timeframe.period != "5"), even if the global TF filter allows it.
Conditions:
Bull IDM: confirmed bar, low < low and close > low — price takes the previous low and closes back above it.
Bear IDM: confirmed bar, high > high and close < high — price takes the previous high and closes back below it.
Arrays:
bullIDMs / bearIDMs hold the labels.
bullLvlArr / bearLvlArr hold the tracked levels.
When an IDM appears:
It creates an “IDM” label (up for bull, down for bear) on the current bar.
It pushes the label and its level (low or high ) into the arrays.
Invalidation:
For each bull IDM, if close < lvl, it deletes the label and removes the entries from both arrays.
For each bear IDM, if close > lvl, it does the same.
7. Structure (Strong High / Strong Low)
Uses ta.pivothigh and ta.pivotlow with lookback = 5 to find swing highs/lows (high/low higher/lower than 5 neighboring bars on each side).
It stores the latest valid:
lastStrongHigh and lastStrongLow.
Their labels lastHighLabel and lastLowLabel (arrow markers).
When a new confirmed pivot forms:
It deletes the previous label of that type.
It creates a new label at bar_index - lookback with “▲” for a high and “▼” for a low.
It also maintains two series:
shPlotValue (Strong High) and slPlotValue (Strong Low) which hold the latest level and are plotted with plot(..., style = plot.style_linebr, offset = -lookback) so the level visually starts when the swing becomes known.
8. Overall logic
Overall, the indicator produces a full SMC overlay:
Previous‑day high/low levels (PDH/PDL) as key support/resistance.
Fair Value Gaps with dynamic deletion once price fully invalidates them.
Order blocks tied to FVGs, also invalidated when price breaks them.
IDM patterns where liquidity at the prior high/low is taken and price returns, with level validity tracking.
Latest strong swing highs/lows, marked with arrows and horizontal lines as market structure levels.
Indicador Pine Script®
MNQ - 5MMNQ - 5M | Institutional Edge & Opening Range Academy
Overview
The MNQ - 5M is a high-precision execution and educational tool specifically engineered for the Micro E-mini Nasdaq-100 (MNQ). Designed for the trader who values clarity over noise, this script automates the New York 5-Minute Opening Range strategy, integrating institutional confluences like Anchored VWAP, Golden Zone Fibonacci, and CVD-based Volume Analysis.
Key Features
Automatic 5M Opening Range: Automatically plots the high and low of the 9:30 AM NY candle with a clean, semi-transparent design.
Dual-Trend Alignment: Features a built-in 1H Master Trend filter to ensure you only trade in the direction of the institutional flow.
Golden Zone Detection: Identifies high-probability retracement areas between the 38.2% and 78.6% Fibonacci levels.
Institutional Confluences: Integrates EMA 200 (Major Trend), EMA 89 (Dynamic Support), and Anchored VWAP starting exactly at the opening bell.
Smart Execution Labels: Clear BUY and SELL signals that only appear when price action, volume (CVD), and safety filters (1.5 ATR) align.
Anti-Saturation Logic: Limited to 2 high-probability signals per trend to promote discipline and prevent overtrading.
How to Use
Preparation: Watch for the Blue Opening Range box at 9:30 AM NY time.
Wait for the Hook: Look for price to break the range and pull back to a confluence zone (EMA, VWAP, or Golden Zone).
Execution: Enter when the "BUY" or "SELL" label appears alongside an engulfing or rejection candle.
Risk Management: The built-in 1.5 ATR filter warns you if you are too close to a major EMA "wall."
Technical Settings
EMA 200: Black (Thickness 4) - The Trend Anchor.
EMA 89: Sky Blue (Thickness 1) - Dynamic Support.
VWAP: Purple (Thickness 3) - Institutional Baseline.
Indicador Pine Script®
SQZPRO + RSIMakit0 Squeeze PRO + RSI combines the original Makit0 Squeeze PRO volatility compression system with a standard RSI oscillator in a single pane.
The Squeeze PRO component identifies three levels of volatility compression (orange = wide, red = normal, yellow = tight) based on the relationship between Bollinger Bands and Keltner Channels. Green dots signal volatility expansion (“squeeze fire”). The momentum histogram shows directional bias and acceleration using a linear regression–based oscillator.
RSI (default 14) is plotted on the same scale, with squeeze dots aligned at the 50 midline to help traders quickly judge volatility conditions alongside momentum strength and overbought/oversold levels.
This setup allows you to monitor:
Volatility compression and expansion
Momentum direction and slope
RSI trend bias and OB/OS zones
All in one streamlined view.
Indicador Pine Script®
ATR-Normalized RSI Diff (Stock - Benchmark) [SAFE]a relative strength indicator which is normalized for ATR and delta b/w the stock and the index, for example QQQ. taking example of tesla, if ATR normalized relative strength of tesla minus ATR normalized relative strength of QQQ start showing a spike, that I want to use as early indicator for a breakout move. how can build this in tradingview
Indicador Pine Script®
LBR with HM Gartley 1935 on Log Returns Momentum Vol TargetOverview
Linda Bradford Raschke's Momentum-based strategy, made by conclusions from the book Profits in the Stock Market by H.M. Gartley in 1935, and uses log returns for directional bias as well as dynamic volatility targeting to maintain consistent risk exposure. Sizes positions inversely to realized volatility (from log returns std dev) for better compounding in trending markets like gold (XAUUSD).
Key Features
Log returns calculation: ln(close / close ) for time-additive momentum.
Directional signals: Enter long when momentum > 0, short when < 0 (configurable strict crossover mode).
Volatility scaling: Targets user-defined annual vol (default 20%) → reduces size in high-vol periods.
Exits: Percentage TP/SL + explicit close on opposite signals for reliable backtests.
Debug visuals: Momentum plot, signal shapes, real-time table (vol, size factor, qty, signal state).
How to Use
Best on Daily or higher timeframes for meaningful log momentum (e.g., XAUUSD, BTCUSD, stocks).
Adjust Momentum Lookback (default 50 bars), Target Vol %, TP/SL %.
Backtest with commissions/slippage enabled for realism.
Use on log-scale chart for % perspective.
Limitations & Notes
No guarantees of profitability; markets involve risk.
Designed for educational/quant purposes; test thoroughly.
Not financial advice.
Open-source for community learning.
Credits
Built on standard quant finance principles (log returns for normality/additivity, vol targeting for risk control). Inspired by discussions on compounding and GARCH-like vol estimation from Linda Bradford Raschke's conclusions from the book Profits in the Stock Market by H.M. Gartley in 1935.
Estratégia Pine Script®
Swing Strategy Feature Set V [theEccentricTrader]█ OVERVIEW
This swing strategy is part of a broader research and exploration framework designed to encourage users to experiment with a variety of technical concepts and evaluate the comparative effectiveness of different strategy configurations. For example, users can first configure a core strategy as a benchmark, then iteratively test a range of feature configurations as additional entry conditions and compare their performance against one another and against the core strategy.
Feature Set V includes concepts beginning with the letter "V" and forms part of a larger swing strategy suite that covers a wide range of technical concepts. The objective of the suite is not curve-fitting, but rather structured experimentation, exploration and statistical validation (or invalidation) of technical concepts.
Concepts exclusive to the feature set are as follows:
Vertical Horizontal Filter
Volume
Positive Volume Index
Negative Volume Index
On-Balance Volume
Price Volume Trend
Volume Weighted Average Price
Volume Zone Oscillator
Vortex Indicator
█ OPERATIONAL
Initial Capital
The initial capital is defined as a monetary value denominated in a given base currency.
The default initial capital is set to 100,000.
The default base currency is set to the selected symbol's default base currency.
Users can adjust the initial capital and select an alternative base currency via strategy Settings/Properties.
Risk as Percentage of Equity
The equity is defined as the sum of initial capital, net profit and open profit.
The risk is defined as a percentage of equity per-trade. As a result, net profit outcomes are subject to compounding effects over time.
The default risk is set to 1% of equity.
Users can adjust the strategy's per-trade risk via strategy Settings/Inputs/STRATEGY.
For further information on how the risk is applied in practice, refer to the position sizing section below.
Unit of Value
The unit of value is defined as a decimal precision factor that converts user-defined point or pip distances into actual price units used by the selected symbol.
Different symbols express price movement using different conventions. For example, some symbols are quoted directly in whole price points, while others use pips or fractional point increments. The unit of value provides a normalisation layer that allows all distance-based logic in the strategy to operate consistently across symbols.
Examples:
A unit of value of 1 corresponds to a price increment of 1.0.
A unit of value of 10 corresponds to a price increment of 0.1.
A unit of value of 100 corresponds to a price increment of 0.01.
A unit of value of 1000 corresponds to a price increment of 0.001.
A unit of value of 10000 corresponds to a price increment of 0.0001.
Users should consult their broker’s published symbol specifications to confirm how price movement is defined for the symbols they intend to backtest. Incorrect configuration of the unit of value may result in misaligned stop distances, targets and/or risk calculations.
The default unit of value is set to 1.
Users can adjust the unit of value via strategy Settings/Inputs/STRATEGY.
Stop Buffer
The stop buffer is defined as the number of points or pips beyond a stop loss level required for the level to be considered clearly breached.
The default stop buffer is set to 0 points/pips.
Users can adjust the stop buffer via strategy Settings/Inputs/STRATEGY.
Risk Range
The risk range is defined as the difference between the entry price and the stop loss price (inclusive of the stop buffer) for any given trade.
Position Sizing
Position sizing determines the quantity of contracts, shares or units opened for each trade based on the user-defined risk and the selected symbol’s pricing structure.
"syminfo.pointvalue" is a built-in Pine Script variable that defines the number of underlying units contained within a single contract for any given symbol, and is critical for accurate position size calculations.
The position size is calculated as follows:
The risk range is multiplied by the syminfo.pointvalue to convert the price movement into its monetary equivalent.
The user-defined risk amount (expressed as a percentage of equity) is divided by this monetary risk per unit to determine the position size.
This ensures that each trade risks a consistent proportion of account equity regardless of point or pip based quoting conventions, symbol price scale or contract specifications.
While the strategy targets a fixed percentage of equity risk per-trade, the exact risk applied cannot always be matched precisely due to symbol-specific constraints such as contract sizing and margin requirements. In these cases, the strategy opens the largest permissible position that does not violate operational constraints, resulting in a realised risk that is as close as possible to the user-defined risk without exceeding it.
For further information on the syminfo.pointvalue variable, please refer to:
www.tradingview.com
Margin
The margin is defined as the minimum percentage of a position’s notional value that must be covered by the strategy’s available equity in order for TradingView's strategy tester to simulate opening and maintaining that position. For example, a margin setting of 25% means the simulated account must hold equity equal to at least 25% of the position’s notional value in order to enter or maintain that trade, the remaining 75% is considered provided by the simulated broker.
A lower margin percentage allows the account to open larger positions relative to its equity, because the required equity portion is smaller. Conversely, a higher margin percentage demands more of the account's equity be committed to any given position.
When the account’s equity falls below the required margin, the strategy tester emulates a margin call event, in which the broker emulator forcibly closes or reduces positions so that remaining positions no longer exceed available equity relative to the margin requirement. This behaviour is documented as part of TradingView’s margin/leverage feature for strategies.
Margin settings in a strategy are used solely for simulation purposes and do not automatically match any broker’s real-world margin requirements (which can vary by broker, asset class and symbol). Users should consult their broker’s published specifications for further details.
The default margin is set to 25% for both long and short positions.
Users can adjust the margin for long and short positions independently via strategy Settings/Properties/MARGIN.
For further information on the strategy tester's margin functionality, please refer to:
www.tradingview.com
www.tradingview.com
Pyramiding
The pyramiding count is defined as the maximum number of open positions permitted at any one time. TradingView's strategy tester does not facilitate hedging, as such, long entries will close any open short positions and short entries will close any open long positions.
The default pyramiding count is set to 100.
Users can adjust the pyramiding count via strategy Settings/Properties.
For further information on TradingView's strategy tester and broker emulator, please refer to:
www.tradingview.com
Spread
The spread is defined as the difference between a given symbol's bid (buy) price and ask (sell) price.
Typical spreads vary by broker and symbol. Some brokers offer fixed spreads on certain symbols, while others offer variable spreads that fluctuate with market conditions. Users should consult their broker's published specifications for further details.
Commission
The commission is defined as a transaction cost applied by a broker and may be expressed as a percentage of position size, a per-contract fee or a fixed fee per-transaction.
Commission structures vary by broker and symbol. Some brokers charge no explicit commission and instead generate revenue through the spread or other indirect sources, while others will typically apply one of the three aforementioned commission types, depending on the product offered. Users should consult their broker's published specifications for further details.
The default commission is set to 0.005% of position size.
Users can select and adjust the commission type via strategy Settings/Properties/COST SIMULATION.
█ CORE STRATEGY
Green and Red Candles
A green candle is defined as a candle that closes at or above its open price and a red candle is defined as a candle that closes below its open price.
Swing Highs and Swing Lows
A swing high is defined as a green candle, or a series of consecutive green candles, followed by a single red candle that completes the swing and forms the peak.
A swing low is defined as a red candle, or a series of consecutive red candles, followed by a single green candle that completes the swing and forms the trough.
Peak and Trough Prices
The peak price of a complete swing high is either the high of the red candle that completes the swing high or the high of the preceding green candle, depending on which is higher.
The trough price of a complete swing low is either the low of the green candle that completes the swing low or the low of the preceding red candle, depending on which is lower.
Fixed Reward-to-Risk
Fixed reward-to-risk is defined as a user-defined reward multiple for a given unit of risk.
Variable Reward-to-Risk
Variable reward-to-risk is defined as a path-dependent reward multiple for a given unit of risk.
Swing High Swing Low (SHSL) Strategy
The SHSL strategy uses swing lows for core long entry conditions and swing highs for core short entry conditions. The strategy is designed for standard OHLC candlestick charts only and will not behave as intended on other chart types.
All entries are processed at candle close and use the candle close price for the entry price.
Long stop losses are anchored to the most recent trough and short stop losses are anchored to the most recent peak.
Users can choose between long-only and short-only configurations, or alternatively simulate trades in both directions (long-short). However, when the "Both" option is selected, long entries will close any open short positions and short entries will close any open long positions (as mentioned in the pyramiding sub-section above). This can and will result in variable reward-to-risk outcomes.
The default direction is set to "Long" for a long-only configuration.
The default exit type is set to "Target" for a fixed reward-to-risk configuration.
Long targets are determined by adding a user-defined multiple of the risk range to the entry price and short targets are determined by subtracting a user-defined multiple of the risk range from the entry price.
Even when using a fixed reward-to-risk configuration, realised reward-to-risk outcomes may vary due to market gaps, particularly when positions are held across session boundaries or market closures. Gaps can cause stop losses or exits to be executed at prices materially different from those implied by the strategy’s static distance calculations. Users who wish to minimise gap-related variability may consider applying the close at end of session filter (see core filters section below), accepting that this introduces its own form of reward-to-risk variability.
The default reward-to-risk is set to 1.
Users can adjust strategy parameters via strategy Settings/Inputs/STRATEGY. Selecting a non-target exit type removes profit targets and renders the reward-to-risk input inactive.
Trailing Stop Loss
A trailing stop loss is defined as an exit type that dynamically moves a stop loss level in a favourable direction when a predefined condition is met. For example, a predefined point move or the formation of a higher trough or lower peak.
Risk Range Trailing Stop Loss
The risk range trailing stop loss is defined as a trailing stop mechanism that activates once price has moved favourably by one full risk range. Upon activation, the stop loss is moved to breakeven and subsequently trails favourable price movement by the risk range into profit.
Users can apply this exit type by selecting "Trail" via strategy Settings/Inputs/STRATEGY.
Trend Trailing Stop Loss
The trend trailing stop loss is defined as a trailing stop mechanism that dynamically moves a stop loss level to newly formed higher troughs (for longs) or lower peaks (for shorts).
Users can apply this exit type by selecting "Trend Trail" via strategy Settings/Inputs/STRATEGY.
Candle Trailing Stop Loss
The candle trailing stop loss is defined as a trailing stop mechanism that dynamically moves a stop loss level to newly formed higher candle lows (for longs) or lower candle highs (for shorts).
Users can apply this exit type by selecting "Candle Trail" via strategy Settings/Inputs/STRATEGY.
Opposing Candle Colour Close
The opposing candle colour close exit type is defined as an exit condition that closes any long positions when a new red candle forms and closes any short positions when a new green candle forms.
Users can apply this exit type by selecting "Opposing Candle" via strategy Settings/Inputs/STRATEGY.
█ CORE FILTERS
Minimum Risk Range Filter
The minimum risk range filter is defined as an entry filter that invalidates trade signals with a risk range below a user-defined threshold.
The default minimum risk range is set to 4 points/pips.
Users can adjust the minimum risk range via strategy Settings/Inputs/RISK RANGE FILTER.
It is recommended that users set the minimum risk range at least 1–2 points/pips above the selected symbol’s spread to invalidate trades that would be completely impractical under realistic trading conditions.
Time Zone
The time zone is defined using either an IANA region identifier (e.g. Europe/London, America/New_York) or a fixed UTC/GMT offset (e.g. UTC+1, GMT-05:30). Fixed offsets do not account for daylight saving time.
The default time zone is set to Europe/London.
Users can change the time zone via strategy Settings/Inputs/TIME ZONE.
For further information on time zone configuration, please refer to:
data.iana.org
en.wikipedia.org
Session Filter
The session filter is defined as an entry filter that invalidates trade signals that fall outside a user-defined intraday trading session, with session start and end times bound to the strategy time zone.
TradingView candle timestamps represent the candle open time, not the candle close time. As a result, session boundaries are evaluated based on when a candle opens, even though entries and exits are processed at candle close.
To avoid trades being entered or held beyond the intended session end, users should configure the session end time at least one full timeframe period earlier than the desired practical session close. For example, on a 5-minute chart with a desired session end at 22:00, the session should typically be configured to end at 21:55. This ensures that no new trades are taken at the final session close and that any session-dependent exit logic is applied before the session ends in practice.
When using custom or non-standard timeframes where the desired session end does not align cleanly with candle boundaries, it is recommended that users set the session end two full timeframe periods earlier than the desired session end. This provides an additional safety buffer, ensuring the strategy avoids taking trades near the session boundary.
By default, the session filter is set to false and the default session is set to "2300-2155".
Users can apply the session filter and adjust session boundaries via strategy Settings/Inputs/SESSION FILTER.
Close At End of Session Filter
The close at end of session filter is defined as an exit filter that closes all open positions when the active trading session ends, provided that the session filter is appropriately configured and applied.
When enabled, the strategy monitors the session filter state and detects the transition from an active session to an inactive session. All open trades are closed on the first candle that falls outside the defined session window. This ensures that no positions are carried beyond the user-defined trading session.
The close at end of session filter operates independently of entry conditions and other exit types. When enabled, it will force the closure of all open positions at session end regardless of the selected exit configuration.
Enabling the close at end of session filter can result in variable reward-to-risk outcomes. Because positions are forcibly closed at session end regardless of stop loss or target placement, exits may occur at prices that differ from those implied by the fixed reward-to-risk configuration. This behaviour is intentional and reflects a design trade-off between enforcing strict session boundaries and allowing trades to reach their predefined directional objectives, regardless of how severely distorted the realised reward-to-risk outcomes could be in the event of price gaps.
By default, the close at end of session filter is set to false.
Users can apply the close at end of session filter via strategy Settings/Inputs/CLOSE AT END OF SESSION FILTER.
Users should also ensure that the session filter is applied and that session boundaries are configured appropriately with respect to candle timestamp behaviour, as described in the session filter section above.
Sample Period Filter
The sample period filter is defined as an entry filter that invalidates trade signals that fall outside a user-defined date-time range, with start and end date-times bound to the strategy time zone.
TradingView candle timestamps represent the candle open time, not the candle close time. As a result, sample period boundaries are evaluated based on when a candle opens, even though entries and exits are processed at candle close.
To avoid trades being entered beyond the intended sample period end, users should configure the sample period end date-time at least one full timeframe period earlier than the desired practical sample period end date-time. For example, on a 5-minute chart with a desired end date-time of 01/01/2026 22:00, the end date-time should typically be configured to 01/01/2026 21:55.
The default sample period start and end date-times are set to 01/01/1900 00:00 and 01/01/3000 00:00, respectively.
Users can adjust the sample period via strategy Settings/Inputs/SAMPLE PERIOD FILTER.
█ GENERIC FILTERS
Generic Filter Behaviour
Unless otherwise stated:
"None" inputs return true.
Filters return true only when their selected condition is satisfied.
Close Above-Equal/Below Filter
The close price above-equal/below filter is defined as an entry filter that evaluates the most recent candle close price relative to a given time-series value and invalidates trade signals that do not satisfy a user-defined directional condition.
"Above-Equal" returns true when the most recent candle close price is greater than or equal to any given time-series value.
"Below" returns true when the most recent candle close price is less than any given time-series value.
Minimum and Maximum Boundary Filters
Minimum and maximum boundary filters are defined as entry filters used to constrain time-series values to predefined minimum and/or maximum thresholds, invalidating trade signals that do not satisfy a user-defined threshold criteria. The filters consist of two independent threshold components, minimum (above-equal) and maximum (below-equal), which may be applied individually or together.
When both components are applied simultaneously the filters act as a value range constraint, invalidating trade signals that fall outside of the specified bounds.
"Above-Equal" returns true when the evaluated value is greater than or equal to the user-defined minimum boundary.
"Below-Equal" returns true when the evaluated value is less than or equal to the user-defined maximum boundary.
Minimum Percentage Change Positive-Flat/Negative Filter
The minimum percentage change filter is an entry filter that measures the relative change of a time-series value over a configurable historical window and applies a directional threshold condition, invalidating trade signals that do not meet the directional threshold criteria.
The filter compares the current value to its value n bars ago and computes the percentage difference. A signal returns true only if this percentage change satisfies both:
The selected directional requirement.
The user-defined minimum percentage change magnitude.
"Positive-Flat" direction logic:
Accepts values that have increased or remained unchanged, provided the percentage change is greater than or equal to the minimum threshold.
"Negative" direction logic:
Accepts values that have decreased, provided the magnitude of the decrease meets or exceeds the minimum threshold.
When the minimum threshold is set to 0%, the filter behaves as a pure directional check:
"Positive-Flat" accepts ≥ 0% changes.
"Negative" accepts < 0% changes only.
Basic and Exclusive Rejection Filters
The basic rejection filter is defined as an entry filter that evaluates swing-based wick or body rejections of a given price level and invalidates trade signals that do not satisfy the rejection criteria.
For long trades, "Rejection" returns true when all three of the following conditions are met:
The previous candle open is above a given rejection price.
The trough price is less than or equal to a given rejection price.
The green candle that completes the swing closes above a given rejection price.
For short trades, "Rejection" returns true when all three of the following conditions are met:
The previous candle open is below a given rejection price.
The peak price is greater than or equal to a given rejection price.
The red candle that completes the swing closes below a given rejection price.
The exclusive rejection filter is defined as an entry filter that meets basic rejection filter criteria for only one user-defined price level from a set of given price levels. If the rejection criteria is met for more than one of the given price levels the filter will return false.
Basic and Multi-Part Trend Filters
Basic and multi-part trend filters are defined as entry filters that evaluate changes in time-series values from one period to the next and invalidate trade signals that do not satisfy a user-defined trend condition.
Basic trends operate independently of prior trend state, whereas multi-part trends are defined by the presence or absence of preceding trend sequences. The multi-part trend states are distinguished numerically and the conditions are bound to a user-defined trend count.
"Basic Uptrend" returns true when a time-series value is greater than the preceding value. For example, a basic volume uptrend filter returns true if the most recent candle's volume is greater than the preceding candle's volume.
"Basic Downtrend" returns true when a time-series value is less than the preceding value. For example, a basic volume downtrend filter returns true if the most recent candle's volume is less than the preceding candle's volume.
"Uptrend" returns true while a multi-part uptrend state is valid. The uptrend state begins when a new basic uptrend forms following a basic downtrend and remains valid until a new basic downtrend forms. The user-defined trend count will determine which multi-part trend condition is selected. For example, if the user-defined trend count is set to 3, then only 3-part uptrend conditions will return true.
"Downtrend" returns true while a multi-part downtrend state is valid. The downtrend state begins when a new basic downtrend forms following a basic uptrend and remains valid until a new basic uptrend forms. The user-defined trend count will determine which multi-part trend condition is selected. For example, if the user-defined trend count is set to 3, then only 3-part downtrend conditions will return true.
█ FEATURE SET V SPECIFIC FILTERS
All feature set specific indicators use the same calculations as the built-in TradingView indicators unless otherwise stated in the relevant filter sub-section. While users do not need to apply the indicators for the strategy to function, they can of course apply the relevant indicators as visual aids if they so desire.
For further information on how to apply built-in TradingView indicators, please refer to:
www.tradingview.com
As there are no built-in TradingView indicators for the VHF, VWAP and VZO values used in this script, code samples are provided in the relevant sections so that users can build their own Pine Script indicators.
For further information on how to build Pine Script indicators, please refer to:
www.tradingview.com
www.tradingview.com
Vertical Horizontal Filter (VHF) Filters
As there is no built-in indicator for the VHF value used in this script, users can build their own VHF indicator in Pine Script by copying the following code and pasting it into a new indicator:
//@version=6
indicator(title = "Vertical Horizontal Filter", shorttitle = "VHF", overlay = false)
import TradingView/ta/12 as ta
vhf_source = input.source(defval = close, title = 'VHF Source', group = 'Vertical Horizontal Filter (VHF)')
vhf_length = input.int(defval = 28, minval = 1, title = 'VHF Length', group = 'Vertical Horizontal Filter (VHF)')
vhf = ta.vhf(vhf_source, vhf_length)
plot(vhf, color = color.blue)
The VHF defaults are as follows:
Source is set to "Close".
Length is set to 28.
Users can adjust the VHF inputs via strategy Settings/Inputs/VERTICAL HORIZONTAL FILTER (VHF).
The VHF minimum and maximum boundary filter (see generic filters section above) defaults are as follows:
Apply VHF above-equal is set to false.
VHF above-equal threshold is set to 0.0.
Apply VHF below-equal is set to false.
VHF below-equal threshold is set to 1.0.
The VHF minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The VHF trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the VHF filters and adjust filter parameters via strategy Settings/Inputs/VHF FILTERS.
Volume Filters
The Volume minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The Volume trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the Volume filters and adjust filter parameters via strategy Settings/Inputs/VOLUME FILTERS.
Positive Volume Index (PVI) Filters
The PVI minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The PVI trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the PVI filters and adjust filter parameters via strategy Settings/Inputs/POSITIVE VOLUME INDEX (PVI) FILTERS.
Negative Volume Index (NVI) Filters
The NVI minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The NVI trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the NVI filters and adjust filter parameters via strategy Settings/Inputs/NEGATIVE VOLUME INDEX (NVI) FILTERS.
On-Balance Volume (OBV) Filters
The OBV minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The OBV trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the OBV filters and adjust filter parameters via strategy Settings/Inputs/ON-BALANCE VOLUME (OBV) FILTERS.
Price Volume Trend (PVT) Filters
The PVT minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The PVT trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the PVT filters and adjust filter parameters via strategy Settings/Inputs/PRICE VOLUME TREND (PVT) FILTERS.
Volume Weighted Average Price (VWAP) Filters
Although there is a built-in VWAP indicator, its output may differ from the calculation used in this script. As such, it is recommended that users build their own VWAP indicator in Pine Script by copying the following code and pasting it into a new indicator:
//@version=6
indicator(title = "Volume Weighted Average Price", shorttitle = "VWAP", overlay = false)
vwap_source = input.source(title = 'VWAP Source', defval = hlc3, group = 'Volume Weighted Average Price (VWAP)')
vwap_anchor = input.bool(title = 'VWAP Anchor', defval = true, group = 'Volume Weighted Average Price (VWAP)')
vwap = ta.vwap(vwap_source, vwap_anchor)
plot(vwap, color = color.blue)
The VWAP indicator defaults are as follows:
Source is set to "HLC3".
Anchor is set to true.
Users can adjust the VWAP inputs via strategy Settings/Inputs/VOLUME WEIGHTED AVERAGE PRICE (VWAP).
The default mode for the close above-equal/below VWAP filter (see generic filters section above) is set to "None".
The default mode for the VWAP rejection filter (see generic filters section above) is set to "None".
Users can apply the VWAP filters and adjust filter parameters via strategy Settings/Inputs/VWAP FILTERS.
Volume Zone Oscillator (VZO) Filters
As there is no built-in indicator for the VZO value used in this script, users can build their own VZO indicator in Pine Script by copying the following code and pasting it into a new indicator:
//@version=6
indicator(title = "Volume Zone Oscillator", shorttitle = "VZO", overlay = false)
import TradingView/ta/12 as ta
vzo_length = input.int(defval = 14, minval = 1, title = 'VZO Length', group = 'Volume Zone Oscillator (VZO)')
vzo = ta.vzo(vzo_length)
plot(vzo, color = color.blue)
The default length for the VZO is set to 14.
Users can adjust the VZO length via strategy Settings/Inputs/VOLUME ZONE OSCILLATOR (VZO).
The VZO minimum and maximum boundary filter (see generic filters section above) defaults are as follows:
Apply VZO above-equal is set to false.
VZO above-equal threshold is set to -100.
Apply VZO below-equal is set to false.
VZO below-equal threshold is set to 100.
The VZO minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The VZO trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the VZO filters and adjust filter parameters via strategy Settings/Inputs/VZO FILTERS.
Vortex Indicator (VI) Filters
The default length for the VI is set to 14.
Users can adjust the VI length via strategy Settings/Inputs/VORTEX INDICATOR (VI).
The VI above-equal/below VI signal filter is defined as an entry filter that evaluates the relative positioning of the VI value and its signal line and invalidates trade signals that do not satisfy a user-defined directional condition.
The default mode for the VI above-equal/below VI signal filter is set to "None".
The VI bandwidth increasing/decreasing filter is defined as an entry filter that evaluates whether the distance between the VI line and VI signal line is expanding or contracting over a configurable lookback period.
The default VI bandwidth increasing/decreasing filter mode is set to "None".
The default VI bandwidth increasing/decreasing lookback is set to 3.
The VI minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The VI signal minimum percent change positive-flat/negative filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Minimum percent change is set to 0.
Lookback is set to 3.
The VI trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
The VI signal trend filter (see generic filters section above) defaults are as follows:
Mode is set to "None".
Trend count is set to 3.
Users can apply the VI filters and adjust filter parameters via strategy Settings/Inputs/VI FILTERS.
█ ALERTS
Users can set alerts for any given strategy configuration via the alerts dialogue box.
Users must first ensure that the correct condition (the strategy title) is selected from the first drop-down list in the alert dialogue box's condition field.
Default alert messages have been configured for both entries and exits so that users can more effectively distinguish between long and short entries and exits while using long-short configurations.
To get alerts for both entries and exits the user should change the value in the condition field's second drop-down list from "Order fills only and alert() function calls" to "Order fills only". When using "Order fills only" with long-short configurations, it is recommended that users define their alert via the alert name field and use only the default {{strategy.order.alert_message}} call in the alert message field.
Alert conditions generated by "Order fills only" are evaluated after entry conditions have been satisfied and operational constraints (risk, position size and margin requirements) have been applied. As such, trade signals that would result in position sizes exceeding the simulated account's margin constraints will not generate alerts.
To get alerts for entries only the user should change the value in the condition field's second drop-down list from "Order fills only and alert() function calls" to "alert() function calls only".
The default alert messages generated by "Order fills only" are as follows:
"long entry".
"long exit".
"short entry".
"short exit".
The default alert messages generated by "alert() function calls only" are as follows:
"long entry".
"short entry".
Alert conditions generated by "alert() function calls only" are operational-constraint-agnostic and will generate alerts whenever entry conditions are satisfied, regardless of the simulated account's margin constraints.
For further information on setting and managing alerts, please refer to:
www.tradingview.com
www.tradingview.com
www.tradingview.com
█ LIMITATIONS AND CONSIDERATIONS
Backtesting
Backtest results should always be interpreted cautiously. Strategy performance can vary significantly across time periods and sample sets. While strong historical performance does not guarantee future results, poor historical performance reliably indicates a weak strategy when sample sizes are statistically meaningful.
Statistical Significance and Path-Dependent Outcomes (Overfitting)
In statistical practice, sample sizes of 100 observations are sometimes cited as a rough lower bound for certain forms of basic significance testing. In the context of trading strategy evaluation, such sample sizes are rarely sufficient to produce results that are meaningfully reliable or replicable. Based on practical experience, sample sizes closer to 1,000 observations or more are generally required before performance characteristics begin to stabilise. As a general rule, larger sample sizes increase the reliability and replicability of observed results.
Path dependence refers to situations in which outcomes are determined not only by initial conditions, but by the specific and unique sequence of price movements over a given time period.
Even with large sample sizes, favourable net profit outcomes should be interpreted with caution when they are primarily driven by either variable reward-to-risk configurations or fixed reward-to-risk configurations that employ unrealistically high reward multiples. In both cases, performance is often strongly influenced by path-dependent effects, making such outcomes less reliable and less replicable.
Fixed reward-to-risk configurations are generally less susceptible to path dependence when the reward multiple is kept within reasonable bounds. However, empirical studies and practitioner research suggest that reward multiples above approximately 3:1 increasingly exhibit the same path-dependent characteristics observed in variable reward-to-risk strategies.
Bar Magnifier
Due to the limitations of OHLC data, intra-bar price movement cannot be precisely determined.
When both stop loss and target levels are reached within the same candle, assumptions are made by the strategy tester.
Pine Script's bar magnifier partially mitigates this limitation by evaluating lower-timeframe data. However, this feature is available only to TradingView Premium users and remains inherently limited.
For further information on the bar magnifier functionality, please refer to:
www.tradingview.com
www.tradingview.com
TradingView Premium users can enable bar magnifier via strategy Settings/Properties/FILL ORDERS.
Processing Orders at Candle Close
Backtests cannot accurately account for slippage between signal generation and trade execution.
A practical mitigation is to use fixed-distance stop losses and targets rather than absolute price levels, a feature supported by many brokers and APIs.
Empirical Probabilities
Empirical probabilities are derived directly from observed outcomes rather than from theoretical models or assumed distributions. In the context of trading, they are calculated by measuring the relative frequency of events (such as wins and losses) across a large sample of historical trades.
Unlike conditional or model-based probabilities, empirical probabilities make no assumptions. Their validity relies primarily on sample size and the consistency of the rules used to generate observations, making them particularly relevant for trading systems evaluated under the law of large numbers.
Empirical probabilities are most useful for comparative analysis, such as assessing how different configurations, filters or exit mechanisms alter the statistical behaviour of a strategy under identical conditions. They are not intended to represent true predictive probabilities or to imply stable future performance.
To study empirical probabilities for comparative purposes, it is recommended that users set commission and both long and short margin values to 0% in order to maximise sample size. However, users should not interpret any resulting profits as realistic. Setting commission and margin (in particular) to 0% produces highly distorted outcomes that are not representative of realistic live trading conditions.
█ DISCLAIMER
This Pine Script strategy is provided for educational purposes only and does not constitute financial advice in any form.
Estratégia Pine Script®
TRAIVEND: EQH & EQL MarkerWhat it does
TRAIVEND: EQH & EQL Marker identifies Equal Highs and Equal Lows on your chart — key liquidity levels where stop losses cluster and smart money targets price for sweeps.
Key Feature
One-directional tick-based tolerance system that adapts to any instrument automatically. Unlike simple exact-match detectors, the tolerance only works in the valid direction: for EQL, the later low may be slightly higher (not lower, as that would already be a sweep). For EQH, vice versa. This prevents false signals while catching near-equal levels that act as liquidity pools.
Features
One-directional tick-based tolerance — adjustable from 0 (exact match) to 50 ticks, automatically scaled via syminfo.mintick for any instrument (ES, NQ, GC, BTC, CL, 6E, etc.)
Sweep validation between bars — verifies that no bar between the two equal levels has broken the level, ensuring only valid EQH/EQL are marked
Delayed sweep removal — when a level gets swept, the line remains visible until the sweep candle closes, giving you time to observe the sweep in real-time
FIFO line management — oldest lines are automatically removed when the limit is reached, ensuring the most recent and relevant levels are always displayed
Full visual customization — line color, width, and style (Solid, Dashed, Dotted) for both EQH and EQL independently
Configurable lookback length up to 5000 bars
Debug labels for verification and fine-tuning
How it works
The indicator scans backwards from each new bar (the origin candle) looking for an earlier bar (the source candle) with a matching high or low within the configured tick tolerance. The tolerance is one-directional: for EQL, the origin candle's low must be equal to or slightly above the source candle's low. It then validates that no bar between the two candles has broken the level. Valid pairs are drawn as lines connecting the two bars. Lines persist until a later candle sweeps the level — and removal only happens after the sweep candle closes, so you can see the sweep play out in real-time.
Use Case
Built for ICT/SMC traders who track liquidity levels. Equal Highs and Equal Lows represent clusters of stop losses that smart money targets for liquidity grabs. Use this indicator to visually identify these levels, anticipate potential sweeps, and plan entries around liquidity events. Works across all timeframes and instruments.
Indicador Pine Script®
YM Key Levels & Liquidity Alerts (4H Bias / 15M Exec)YM KEY LEVELS - Showing Key Levels for Monday 2/16
Indicador Pine Script®
Mann EMA 50 Here’s a **clean, professional description** you can paste directly into **TradingView → Publish → Description**.
It matches **exactly** how your indicator works now.
---
## 📌 EMA50 Retest + Break Opposite Candle (Structure-Based Entry)
This indicator is designed to capture **high-probability continuation entries** using **EMA50**, **retests**, and **market structure**.
It avoids over-trading by waiting for a **valid retest** and a **confirmed break of structure** before giving an entry signal.
---
## 🔹 Core Concept
The indicator works in **two phases**:
1. **Retest Confirmation**
2. **Break of the Opposite Candle (Structure Break)**
Entries are only generated **after the EMA50 is retested**.
---
## 🟢 BUY Logic
1. Price must be **above EMA50**
2. While price stays above EMA:
* The indicator tracks the **most recent RED candle**
3. Price must **touch EMA50** (wick or body = valid retest)
* If the retest candle itself is red, it is used
4. After the retest:
* A **BUY signal appears when price breaks the HIGH of the most recent RED candle that occurred before (or at) the retest**
5. **Stop Loss**
* Placed at the **low of that red trigger candle**
➡️ Entry is **always AFTER the retest**, never before.
---
## 🔴 SELL Logic (Mirror of Buy)
1. Price must be **below EMA50**
2. While price stays below EMA:
* The indicator tracks the **most recent GREEN candle**
3. Price must **touch EMA50** (wick or body)
* If the retest candle itself is green, it is used
4. After the retest:
* A **SELL signal appears when price breaks the LOW of the most recent GREEN candle that occurred before (or at) the retest**
5. **Stop Loss**
* Placed at the **high of that green trigger candle**
---
## 📈 Visual Elements
* **EMA50** plotted on chart
* **Black horizontal line** → Entry trigger level
* **Red horizontal line** → Stop-loss level
* **Small triangle arrows**:
* ▲ Green = BUY
* ▼ Red = SELL
(No large labels or boxes for a clean chart)
---
## ⚙️ Settings
* **EMA Length** – Default 50 (can be adjusted)
* **Expire Setup After Retest (bars)**
Cancels the setup if price doesn’t break the trigger within the selected number of candles
* **Require candle CLOSE beyond trigger**
* ON → Conservative (close confirmation)
* OFF → Aggressive (wick break allowed)
---
## 🎯 Best Use Case
* Trending markets
* Pullback / continuation strategies
* Works well on **M15, H1, H4**
* Forex, Indices, Crypto, Gold (XAUUSD)
---
## ⚠️ Notes
* No signal will appear if:
* EMA is not retested
* No opposite candle exists before the retest
* This is intentional to **filter low-quality setups**
---
Indicador Pine Script®
Volume Profile - Session Auction Engine | TradeSymmetry⚡ Volume Profile — Session Auction Engine
A session-driven volume profile built to visualize auction behavior, liquidity distribution, and key reference levels such as POC, VAH, VAL, and True Day Open.
This indicator is part of the TradeSymmetry Core Series, focused on understanding markets through:
⏱ Time • 💧 Liquidity • 🧱 Structure
🔥 Overview
TradeSymmetry Volume Profile tracks how participation evolves across each session instead of displaying a static histogram.
By separating historical rendering from live developing profiles, the script helps traders observe how value migrates without cluttering the chart.
⚡ Features
📊 Session Volume Profile
• Daily, Weekly, and Monthly Session logic
• Historical profile rendering
• Optional live developing profile
🎯 Key Auction Levels
• Developing Point of Control (POC)
• Previous Session Extensions (POC / VAH / VAL)
• Dynamic Value Area calculations
🟡 Session Open Reference
• True Day Open (TDO) line
• Vertical session start marker
🎨 Customization
• Adjustable colors, line styles, labels
• Profile resolution control
• Value Area percentage settings
📌 Best Usage Context
The Value Area and POC are most effective when aligned with time-based structure and higher-timeframe context rather than used alone.
They become especially useful around:
🕐 Start of a Kill zone Session or 4H Candle Observe Liquidity Sweep near POC/VAH/VAL and Identify early acceptance or rejection
📈 Higher Timeframe Context
Premium / Discount zones
Daily or Weekly bias
Market structure direction
💧 Liquidity Events
Session Highs & Lows
Swing High / Swing Low sweeps
External liquidity grabs
Using POC and Value Area around these moments helps identify redistribution phases rather than random price movement.
🧠 Concept
Instead of treating volume as a static tool, this script focuses on auction dynamics:
✅ Where price was accepted
✅ Where liquidity concentrated
✅ How value shifts between sessions
💡 Suggested Workflows
• Intraday liquidity mapping
• Auction Market Theory analysis
• ICT-style structural context
• Monitoring developing bias through POC migration
⚙️ Technical Notes
• Uses lower timeframe aggregation to build profiles
• Supports Volume or Open Interest data
• Designed primarily for intraday charts
🧩 TradeSymmetry Core Series
This indicator is designed to integrate with other TradeSymmetry tools centered around:
Time Alignment • Liquidity Engineering • Structural Context
Indicador Pine Script®






















