Indicateurs et stratégies
Neeson bitcoin Dynamic ATR Trailing SystemNeeson bitcoin Dynamic ATR Trailing System: A Comprehensive Guide to Volatility-Adaptive Trend Following
Introduction
The Dynamic ATR Trailing System (DATR-TS) represents a sophisticated approach to trend following that transcends conventional moving average or breakout-based methodologies. Unlike standard trend-following systems that rely on price pattern recognition or fixed parameter oscillators, this system operates on the principle of volatility-adjusted position management—a nuanced approach that dynamically adapts to changing market conditions rather than imposing rigid rules on market behavior.
Originality and Innovation
Distinct Methodological Approach
What sets DATR-TS apart from hundreds of existing trend-following systems is its dual-layered conditional execution framework. While most trend-following systems fall into one of three broad categories—moving average crossovers, channel breakouts, or momentum oscillators—this system belongs to the more specialized category of volatility-normalized trailing stop systems.
Key Original Contributions:
Volatility-Threshold Signal Filtering: Most trend systems generate signals continuously, leading to overtrading during low-volatility periods. DATR-TS implements a proprietary volatility filter that requires minimum market movement before generating signals, effectively separating high-probatility trend opportunities from market noise.
Self-Contained Position State Management: Unlike traditional systems that require external position tracking, DATR-TS maintains an internal position state that prevents contradictory signals and creates a closed-loop decision framework.
Dynamic Risk Parameter Adjustment: The system doesn't use fixed percentage stops or rigid ATR multiples. Instead, it implements a responsive adjustment mechanism that widens stops during high volatility and tightens them during low volatility, creating an optimal balance between risk protection and opportunity capture.
Trader-Centric Visualization Philosophy: Beyond mere signal generation, the system provides a comprehensive visual feedback system designed to align with human cognitive patterns, reducing emotional decision-making through consistent color coding and information hierarchy.
Technical Implementation and Functionality
Core Operational Mechanism
DATR-TS implements a volatility-adjusted trend persistence model that operates on the principle that trending markets exhibit characteristic volatility signatures. The system specifically targets medium-term directional movements (typically lasting 5-20 days) rather than short-term scalping opportunities or long-term position trades.
The Four-Pillar Architecture:
Volatility Measurement and Normalization
Calculates Average True Range (ATR) over a user-defined period
Converts absolute volatility to percentage terms relative to price
Compares current volatility against user-defined thresholds to filter suboptimal conditions
Dynamic Trailing Stop Algorithm
Establishes an initial stop distance based on current volatility
Implements a four-state adjustment mechanism that responds to price action
Maintains stop position during trend continuation while allowing for trend reversal detection
Conditional Signal Generation
Generates entry signals only when price action meets both directional and volatility criteria
Produces exit signals based on trailing stop penetration
Incorporates position state awareness to prevent conflicting signals
Comprehensive Feedback System
Provides multi-layer visual information including dynamic stop lines, signal labels, and color-coded price action
Displays real-time metrics through an integrated dashboard
Offers configurable visualization options for different trading styles
Specific Trend-Following Methodology
DATR-TS employs a volatility-normalized trailing stop breakout approach, which differs significantly from common trend identification methods:
Not a moving average crossover system (like MACD or traditional MA crosses)
Not a channel breakout system (like Bollinger Band or Donchian Channel breaks)
Not a momentum oscillator system (like RSI or Stochastic trend following)
Not a price pattern recognition system (like head-and-shoulders or triangle breaks)
Instead, it belongs to the more specialized category of volatility-adjusted stop-and-reverse systems that:
Wait for market volatility to reach actionable levels
Establish positions when price confirms directional bias through stop penetration
Manage risk dynamically based on evolving market conditions
Exit positions when the trend exhausts itself through stop violation
Practical Application and Usage
Market Environment Optimization
Ideal Conditions:
Trending markets with sustained directional movement
Medium volatility environments (neither excessively calm nor chaotic)
Timeframes: 4-hour to daily charts for optimal signal quality
Instruments: Forex majors, commodity futures, equity indices
Suboptimal Conditions:
Ranging or consolidating markets
Extreme volatility events or news-driven spikes
Very short timeframes (below 1-hour)
Illiquid or highly manipulated instruments
Parameter Configuration Strategy
Core Parameter Philosophy:
ATR Length (Default: 21 periods)
Controls the system's memory of volatility
Shorter lengths increase sensitivity but may cause overtrading
Longer lengths provide smoother signals but may lag during volatility shifts
ATR Multiplier (Default: 6.3x)
Determines the initial risk buffer
Lower values (4-5x) create tighter stops for conservative trading
Higher values (6-8x) allow for larger trends but increase drawdown risk
Volatility Threshold (Default: 1.5%)
Filters out low-quality trading environments
Adjust based on market characteristics (higher for volatile markets)
Acts as a quality control mechanism for signals
Trading Workflow and Execution
Signal Interpretation and Action:
Entry Protocol:
Wait for BLUE "BUY" signal label appearance
Confirm volatility conditions meet threshold requirements
Enter long position at market or next reasonable opportunity
Set initial stop at displayed dynamic stop level
Position Management:
Monitor dynamic stop line for position adjustment
Allow profits to run while stop protects capital
No manual adjustment required—system manages stop automatically
Exit Protocol:
Exit on ORANGE "SELL" signal label appearance
Alternative exit if price hits dynamic stop level
System will generate new entry signal if conditions warrant re-entry
Risk Management Integration:
Position sizing based on distance to dynamic stop
Volatility filter prevents trades during unfavorable conditions
Clear visual feedback on current risk exposure
Built-in protection against overtrading
Philosophical Foundation and Market Theory
Core Trading Principles
DATR-TS embodies several foundational market principles:
Volatility Defines Opportunity
Markets don't trend continuously—they alternate between trending and ranging phases
Volatility provides the energy for trends to develop and sustain
By measuring and filtering volatility, we can focus on high-probability trend phases
Risk Should Be Proportional
Fixed percentage stops ignore market context
Dynamic stops that adjust with volatility provide more appropriate risk management
Position sizing should reflect current market conditions, not arbitrary rules
Simplicity Through Sophistication
Complex systems often fail in real-world conditions
A simple core algorithm with intelligent filtering outperforms complex multi-indicator approaches
Clear visual feedback reduces cognitive load and emotional interference
Trends Persist Until Proven Otherwise
Markets exhibit momentum characteristics
Once a trend establishes itself, it tends to continue
The trailing stop methodology captures this persistence while providing exit mechanisms
Mathematical and Statistical Foundation
The system operates on several statistical market observations:
Volatility Clustering Phenomenon
High volatility periods tend to follow high volatility periods
Low volatility periods tend to follow low volatility periods
By filtering for adequate volatility, we increase the probability of capturing meaningful trends
Trend Magnitude Distribution
Most trends are small to medium in magnitude
Very large trends are rare but account for disproportionate returns
The dynamic stop methodology allows capture of varying trend magnitudes
Autocorrelation in Price Movements
Price movements exhibit short-term positive autocorrelation during trends
This persistence allows trailing stops to capture continued movement
The system leverages this characteristic without requiring explicit autocorrelation calculation
Performance Characteristics and Expectations
Typical System Behavior
Signal Frequency:
Low to moderate signal generation (prevents overtrading)
Signals concentrated during trending market phases
Extended periods without signals during ranging conditions
Risk-Reward Profile:
Win rate typically 40-60% in trending conditions
Average win larger than average loss
Risk-reward ratios of 1:2 to 1:3 achievable
Drawdown Patterns:
Controlled through volatility adjustment
Larger drawdowns during extended ranging periods
Recovery typically follows when trending conditions resume
Comparison with Alternative Approaches
Versus Moving Average Systems:
Less prone to whipsaws during ranging markets
Better adaptation to changing volatility conditions
Clearer exit signals through stop levels
Versus Channel Breakout Systems:
More responsive to emerging trends
Lower false breakout probability
Dynamic risk adjustment rather than fixed parameters
Versus Momentum Oscillator Systems:
Better trend persistence capture
Less susceptible to overbought/oversold false signals
Clearer position management rules
Educational Value and Skill Development
Learning Opportunities
DATR-TS serves as more than just a trading tool—it provides educational value through:
Market Condition Awareness
Teaches traders to distinguish between trending and ranging markets
Develops understanding of volatility's role in trading opportunities
Encourages patience and selectivity in trade execution
Risk Management Discipline
Demonstrates dynamic position sizing principles
Illustrates the importance of adaptive stops
Reinforces the concept of risk-adjusted returns
Psychological Skill Development
Reduces emotional trading through clear rules
Builds patience through conditional execution
Develops discipline through systematic approach
Customization and Evolution
The system provides a foundation for further development:
Beginner Level:
Use default parameters for initial learning
Focus on signal recognition and execution discipline
Develop understanding of system behavior across market conditions
Intermediate Level:
Adjust parameters based on specific market characteristics
Combine with complementary analysis techniques
Develop personal variations based on trading style
Advanced Level:
Integrate with portfolio management systems
Develop automated execution frameworks
Create derivative systems for specialized applications
Conclusion: The Modern Trend-Following Paradigm
The Dynamic ATR Trailing System represents a significant evolution in trend-following methodology. By moving beyond simple price pattern recognition or fixed parameter oscillators, it embraces the complex reality of financial markets where volatility, trend persistence, and risk management interact dynamically.
This system doesn't claim to predict market direction or identify tops and bottoms. Instead, it provides a systematic framework for participating in trends when they emerge, managing risk appropriately as conditions change, and preserving capital during unfavorable environments.
For traders seeking a methodology that combines mathematical rigor with practical execution, adapts to changing market conditions rather than fighting against them, and provides clear, actionable information without cognitive overload, DATR-TS offers a sophisticated yet accessible approach to modern trend following.
The true value lies not in any single signal or parameter setting, but in the comprehensive philosophy of volatility-aware, risk-adjusted, conditionally-executed trend participation that the system embodies—a philosophy that aligns with how markets actually behave rather than how we might wish them to behave.
ULTIMATE Multi-TF Previous CloseULTIMATE Multi-TF Previous Close displays previous close levels across multiple timeframes in one simple, non-repainting indicator.
These levels often act as key decision points, providing natural support, resistance, and directional bias.
Ideal for day traders, swing traders, and scalpers who want higher-timeframe context without clutter.
Features include:
Yearly → 5-minute timeframe coverage
Right-extended horizontal levels
Optional labels with exact prices
Tick-accurate rounding
Designed for clarity. Built for precision.
Trading Sessions (London / New York / Tokyo / Sydney)Trading sessions for all assets with (time zone) adjustable trading sessions.
RS Score (1-100) vs NQ/ES/YM - TP# RS Score (1–100) vs NQ/ES/YM — How to Use & Interpret
## What this indicator is doing
It gives you a **single score from 1 to 100** that tells you whether a stock is acting like a **leader** or a **laggard** compared to the **overall U.S. market** (Nasdaq + S&P + Dow), using about **1 year of data**.
---
## The core idea: “Is this stock beating the market?”
This script compares your stock to a blended benchmark of:
* **Nasdaq futures (NQ)**
* **S&P futures (ES)**
* **Dow futures (YM)**
### Why that matters
A stock can be going up, but if the market is going up faster, the stock is **not a leader**.
This tool answers:
* “Is this stock outperforming the big market?”
* “Is it doing it consistently, or is it just wild and noisy?”
---
## What the 1–100 score means
Think of **50** as the “middle line.”
### The most important rule
* **Above 50 = outperforming the market blend**
* **Below 50 = underperforming**
* **Around 50 = roughly market-like**
### Easy interpretation bands
* **80–100 (Strong Leader):** stock is outperforming the market clearly and consistently
* **60–80 (Healthy):** generally outperforming, decent leadership
* **45–60 (Neutral-ish):** not special, close to market performance
* **30–45 (Weak):** lagging the market
* **1–30 (Very Weak):** strong underperformance
**Think “leaders live above 50,” and “real leaders tend to stay 70+.”**
---
## Why this score is “smarter” than just comparing returns
This script doesn’t just ask *“did it outperform?”*
It also asks *“did it outperform in a clean, steady way?”*
So it penalizes:
* choppy, unstable performance
* “one lucky spike” moves
That’s why it’s great for finding **higher-quality leadership**.
---
## Timeframe consistency: why it works on Daily, Weekly, Monthly
You added **Lock to last completed Daily bar**.
That means:
* it uses the **same daily reference point** no matter what chart timeframe you switch to
* your RS score won’t “walk around” just because the current day/week/month is still forming
**Practical meaning:**
If your score says 72, it should be 72 whether you’re looking at Daily, Weekly, or Monthly (as of the last completed day).
---
## The “RS New High” marker (NH) — what it’s telling you
The marker shows when your RS score hits a **new high** over your chosen lookback period (default ~252 trading days).
### In plain terms:
> “This stock is now showing its strongest relative performance vs the market (in about a year).”
### Why it’s powerful
A lot of the best leaders:
* show RS new highs **before** price breaks out
* or show RS new highs **during** breakouts
**So NH is a “leadership confirmation” signal.**
### How to use NH in real life
* **Best case:** RS hits a new high **while price is near breakout levels**
→ this often means institutions are accumulating and the stock is acting like a leader
* **Okay case:** price makes new highs but RS does not
→ stock is rising, but it’s not leading (could still work, but less attractive)
---
## Divergences: when RS and price disagree
This is one of the most useful ways to use RS.
### Bearish divergence (warning)
**Price makes a higher high, but RS makes a lower high.**
In simple terms:
> “The stock is still going up, but it’s losing leadership versus the market.”
This often shows up before:
* pullbacks
* breakout failures
* trend weakening
* rotation into stronger names
**It’s a caution sign, not an automatic sell.**
### Bullish divergence (early strength)
**Price makes a lower low, but RS makes a higher low.**
In simple terms:
> “The stock is holding up better than the market — strength is building underneath.”
This can happen before:
* reversals
* strong bounce setups
* early leadership emergence
---
## How to use this indicator in a simple trading workflow
### 1) Screening (finding leaders)
When scanning charts:
* Prefer stocks **above 50**
* Strong candidates are typically **70+**
* Bonus points if you see **NH markers** recently
**Quick rule:**
If RS < 50, it’s usually not worth your time unless you’re hunting deep value turnarounds.
---
### 2) Breakouts (confirming quality)
When a stock is near a breakout point:
* You want RS to be **rising**
* Ideally RS is near highs or prints **NH**
If price breaks out but RS is weak:
* it’s more likely to be a “meh breakout”
* sometimes it works, but it’s less “leader-like”
---
### 3) Managing positions (leadership health check)
If you’re already holding:
* RS staying high and rising = healthy leadership
* RS rolling over while price still rises = **possible early warning**
* RS plunging under 50 = the stock is now **lagging the market** (big red flag)
---
## Common “mistakes” and how to avoid them
### Mistake 1: Thinking RS > 50 means “guaranteed winner”
No — it means it’s acting **stronger than the market**, but price action still matters.
Use it with:
* trend structure
* volume/accumulation
* breakout levels
### Mistake 2: Overreacting to one divergence
One divergence is a warning.
You want confirmation like:
* failed breakout
* heavy sell volume
* loss of key moving averages
* repeated RS lower highs
### Mistake 3: Comparing RS values across totally different markets without context
RS works best when:
* comparing stocks within the same broad market environment
* keeping the same benchmark blend and same lookback
---
## Simple cheat sheet
* **RS > 50:** outperforming market (good)
* **RS 70–100:** leader zone
* **NH marker:** strongest relative strength in lookback window (leadership confirmation)
* **Price HH + RS LH:** bearish divergence (leadership weakening)
* **Price LL + RS HL:** bullish divergence (strength building)
Thank you!
High Probability Trend Continuation (1:5 RR)this strategy is based on a high-probability trend continuation pattern, one of the most frequently occurring setups in financial markets. It uses EMA trend alignment to identify strong bullish or bearish conditions and waits for a controlled pullback before entering a trade in the direction of the trend.
Risk management is fully automated using ATR-based stop losses, ensuring the strategy adapts to market volatility. Each trade is executed with a fixed 1:5 risk-to-reward ratio, allowing profitability even with a modest win rate.
The strategy is designed to work across multiple markets and timeframes, including forex, stocks, indices, and crypto, making it suitable for both intraday and swing trading.
WEEKEND BOX (FRIDAY 17:00 - SUNDAY 18:00 NY)As the name “Weekend Box” suggests, this indicator highlights the price range of cryptocurrencies between Friday 17:00 and Sunday 18:00 (New York time). It draws a box around this period to visualize how Bitcoin and other crypto assets behave while the forex market is closed. The goal is to provide a simple, educational tool for anyone interested in studying weekend volatility and market behavior in crypto. Thank you.
Alert vdv2Alert Vdv (shoulders and head) in a Strong mommentum for the other Symbol
1. There is a strong wave including many same color bars.
2. There is Vdv pattern inside that wave with the same dirrection.
Alert vdvAlert Vdv (shoulders and head) in a Strong mommentum.
1. There is a strong wave including many same color bars.
2. There is Vdv pattern inside that wave with the same dirrection.
Alert 2d 2Alert 2 Tops/bottoms in a Strong mommentum for other symbols
1. There is a strong wave including many same color bars.
2. There are 2 Tops/bottoms pattern inside that wave with the same dirrection.
YALGOS - Watermark What does the indicator do? The YALGOS - Watermark is a comprehensive visual dashboard that consolidates essential market data onto a single floating table on your chart. It tracks real-time metrics including volatility (ATR), Market Capitalization, daily percentage change, and Relative Volume (RVol). Additionally, it provides a countdown to upcoming earnings reports and identifies the specific sector and industry of the asset.
Why is it needed?
Centralized Information: It eliminates the need to toggle between different tabs or windows by providing a "birds-eye view" of both technical and fundamental data directly on the price action.
Risk Awareness: Through color-coded ATR logic, it alerts traders to abnormal volatility levels, helping them decide if a setup is too risky or within normal parameters.
Operational Efficiency: It ensures critical catalysts, such as earnings dates, are always visible, preventing costly mistakes. The built-in "Mobile Mode" also ensures that traders on the go have a clear, optimized view of their data.
StopLoss Calculator ... Manual or Chart Entry, EUR or perc. RiskStop-Loss Calculator for manual or chart entry, EUR or % risk. Works for long & short positions on all timeframes. Entry and stop-loss lines are fully customizable. Use at your own risk.
Stop-Loss Rechner für manuellen oder Chart-Einstieg, Risiko in EUR oder %. Funktioniert für Long- & Short-Positionen in allen Timeframes. Entry- und Stop-Loss-Linien sind vollständig anpassbar. Nutzung auf eigenes Risiko.
Stop-Loss Calculator – Manual or Chart Entry, EUR or % Risk
This indicator calculates the optimal stop-loss price for trades based on the selected entry, position size, and risk tolerance. You can choose between manual entry or using the current chart price, and define risk as either a fixed amount (EUR) or a percentage of your capital. It works for both long and short positions and is compatible with all timeframes.
The script plots the entry and stop-loss levels, with colors and line styles fully customizable.
How to Use
Entry Selection: Choose between the chart’s current price or a manual entry price.
Position Size: Enter the number of units/shares/contracts you are trading.
Risk Mode: Select Absolute (EUR) or Percent (%). Enter the corresponding value.
Direction: Choose Long or Short.
Stop-Loss: The script automatically calculates and displays the stop-loss line.
Previous Day High/Low - by Praveen Sigrohavery helpful tool if you consider previous day high and low important to use as benchmark for the next big move.
InfinityCandlePatternsLibrary "InfinityCandlePatterns"
isMorningStar(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isEveningStar(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isThreeWhiteSoldiers(o, h, c, atr)
Parameters:
o (float)
h (float)
c (float)
atr (float)
isThreeBlackCrows(o, l, c, atr)
Parameters:
o (float)
l (float)
c (float)
atr (float)
isBullishHarami(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isBearishHarami(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isBullishEngulfing(o, c)
Parameters:
o (float)
c (float)
isBearishEngulfing(o, c)
Parameters:
o (float)
c (float)
isThreeInsideUp(o, h, c, atr)
Parameters:
o (float)
h (float)
c (float)
atr (float)
isThreeInsideDown(o, l, c, atr)
Parameters:
o (float)
l (float)
c (float)
atr (float)
isTweezerBottom(o, l, c, atr)
Parameters:
o (float)
l (float)
c (float)
atr (float)
isTweezerTop(o, h, c, atr)
Parameters:
o (float)
h (float)
c (float)
atr (float)
isBullishKicker(o, c)
Parameters:
o (float)
c (float)
isBearishKicker(o, c)
Parameters:
o (float)
c (float)
isBullishBreakaway(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isBearishBreakaway(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isHammer(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isShootingStar(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isStandardDoji(o, c, atr)
Parameters:
o (float)
c (float)
atr (float)
isDragonflyDoji(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isGravestoneDoji(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isBullishMarubozu(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isBearishMarubozu(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
isSpinningTop(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
bullAny(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
bearAny(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
neutralAny(o, h, l, c, atr)
Parameters:
o (float)
h (float)
l (float)
c (float)
atr (float)
bullStrong(o, h, c, atr)
Parameters:
o (float)
h (float)
c (float)
atr (float)
bearStrong(o, l, c, atr)
Parameters:
o (float)
l (float)
c (float)
atr (float)
Cycle Timing Framework - Adaptive Point MappingThis indicator is a visual cycle-timing framework designed to help traders study when recurring turning points tend to occur within a repeating market cycle.
Instead of reacting only to indicators that respond after price moves, this tool focuses on time structure — mapping recurring points inside a fixed-length cycle and projecting that same structure across past, current, and forward cycles for contextual reference.
Each cycle point is fully configurable, allowing the model to be tuned to individual assets, timeframes, or market regimes.
🔍 What This Indicator Does
Draws a repeating cycle template (default: 122 bars)
Displays up to 35 recurring cycle points per cycle
Projects the same structure across:
Past cycles (for validation)
The current cycle (for context)
Future cycles (for planning reference)
Allows point-by-point customization:
Enable / disable any point
Independent bar offsets per point
Individual colors for visual grouping
Optional tolerance windows (± bars) around each point
Optional numbered markers for clean point identification
This is a non-predictive, non-trading tool intended for cycle research, timing context, and structural alignment.
🛠 How to Use It (Workflow)
1️⃣ Choose Your Timeframe First
Cycle behavior is timeframe-dependent.
Decide whether you are working on Daily, Weekly, or another timeframe before tuning offsets.
2️⃣ Define the Cycle
Cycle Length (bars)
Sets the total cycle duration (default: 122).
Bars Back to Current Cycle Start
Anchors the current cycle to a known starting point.
Bars Back Lookback
Controls how many historical cycles are displayed.
3️⃣ Tune the Points
In Point Offsets (Bars):
Adjust each point so its vertical line aligns with recurring highs, lows, or pivots.
Disable points that are not relevant to the asset.
Use color groupings to distinguish high-probability or structural points.
This tuning process is intentionally manual to encourage asset-specific calibration.
4️⃣ Use Window Bands for Flexibility
Enable ± Window Bands if turning points tend to vary by a bar or two.
This helps visualize timing zones instead of single-bar precision.
5️⃣ Validate with Bar Replay
Use TradingView’s Bar Replay feature to:
Step through historical price action
Observe how consistently points align
Refine offsets where necessary
This is the intended validation method for this indicator.
🎯 Intended Use Cases
Cycle and rhythm analysis
Timing context for other indicators
Structural alignment across market phases
Studying recurring turning points on a specific asset
Educational and research-oriented cycle mapping
This indicator is designed to complement — not replace — price action, trend analysis, or risk management.
⚠ Important Notes
This script does not place trades
It does not generate buy/sell signals
It does not guarantee future outcomes
Forward projections are visual references only
Always confirm with additional analysis
This tool is best used as a context layer, helping answer when something may be more likely to occur — not what will occur.
🧠 Final Thought
Markets often move with rhythm, but that rhythm is asset-specific.
This indicator is intentionally flexible so the same cycle engine can be adapted to different instruments without forcing a one-size-fits-all model.
If you study cycles, this script gives you a clean, disciplined framework to do so directly on the chart.
TimeframeAlignTHE PROBLEM THIS LIBRARY SOLVES
When you use `request.security()` to get data from a Higher Timeframe (HTF) and try to draw objects like boxes, lines, or labels, they appear at the wrong horizontal position . This is the "floating in space" problem.
Why does this happen?
The `bar_index` in Pine Script refers to where data was RECEIVED , not where the event OCCURRED .
Consider this scenario:
• You're on a 5-minute chart
• You request 1-hour data for drawing an FVG (Fair Value Gap)
• A 1H candle spans 12 chart bars (60min / 5min = 12)
• But your code draws at `bar_index - 1` or `bar_index - 3`
• The result: your FVG box is only 2-3 bars wide instead of spanning the correct 12-36 bars
This library solves that by tracking where HTF bars actually start and end on your chart timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE THIS LIBRARY
Step 1: Import the Library
```
import ArunaReborn/TimeframeAlign/1 as tfa
```
Step 2: Create a Tracker for Each HTF
```
var tfa.HTFTracker tracker1H = tfa.createTracker("60")
```
Step 3: Update the Tracker Every Bar
```
tfa.updateTracker(tracker1H, "60")
```
Step 4: Use Synced Drawing Functions
```
if tfa.htfBarChanged(tracker1H)
tfa.syncedBox(tracker1H, 3, 1, topPrice, bottomPrice, color.new(color.green, 80))
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXPORTED TYPES
TimeframePair
Stores metadata about the relationship between source and chart timeframes.
• sourceTimeframe - The HTF/LTF being compared
• chartTimeframe - Current chart timeframe
• isHTF - True if source is higher than chart
• isLTF - True if source is lower than chart
• barRatio - Chart bars per source bar
• secondsRatio - Time ratio between timeframes
MTFEventData
Stores synchronized event data with correct bar positions.
• price - Price level of the event
• eventTime - Unix timestamp of the event
• chartBarStart - Chart bar_index where event's TF bar started
• chartBarEnd - Chart bar_index where event's TF bar ended
• htfOffset - The HTF offset used
• isValid - True if synchronization succeeded
HTFTracker
Tracks HTF bar boundaries. Create one per timeframe you need to track.
• htfTimeframe - The timeframe being tracked
• currentStartBar - Where current HTF bar started
• currentEndBar - Where current HTF bar ends (provisional)
• startHistory - Array of historical start positions
• endHistory - Array of historical end positions
• lastUpdateBar - Last bar_index when updated
• barJustChanged - True if HTF bar changed on this chart bar (set by updateTracker)
SyncedBox
Managed box with synchronization metadata.
• bx - The Pine Script box object
• htfTimeframe - Source timeframe
• leftHtfOffset / rightHtfOffset - HTF offsets for edges
• topPrice / bottomPrice - Price boundaries
• extendRight - Auto-extend flag
SyncedLine
Managed line with synchronization metadata.
• ln - The Pine Script line object
• htfTimeframe - Source timeframe
• htfOffset - Anchor offset
• price - Price level (horizontal lines)
• isHorizontal - Line orientation
• extendRight - Auto-extend flag
SyncedLabel
Managed label with synchronization metadata.
• lbl - The Pine Script label object
• htfTimeframe - Source timeframe
• htfOffset - Anchor offset
• price - Price level
• anchorPoint - "start", "end", or "middle"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXPORTED FUNCTIONS
━━ CORE FUNCTIONS ━━
getTimeframeInfo(sourceTimeframe)
Analyzes relationship between a source TF and chart TF.
Returns: TimeframePair with comparison metadata
createTracker(htfTimeframe)
Creates a new HTF tracker. Call once per timeframe, store with `var`.
Returns: HTFTracker instance
updateTracker(tracker, htfTimeframe, historyDepth)
Updates tracker with current bar data. Call on every bar.
• htfTimeframe: The timeframe string (must match createTracker)
• historyDepth: Max HTF bars to track (default 500)
Returns: Updated tracker
getStartBar(tracker, htfOffset)
Gets chart bar_index where a specific HTF bar started.
• htfOffset: 0=current, 1=previous, 2=two bars ago, etc.
Returns: bar_index or na
getEndBar(tracker, htfOffset)
Gets chart bar_index where a specific HTF bar ended.
Returns: bar_index or na
htfBarChanged(tracker)
Detects when HTF bar just changed.
Returns: True on first chart bar of new HTF bar
findBarAtTime(timestamp, maxLookback)
Searches backward to find chart bar containing a timestamp.
• maxLookback: How far back to search (default 500)
Returns: bar_index or na
syncEventToChart(tracker, eventPrice, eventTime, anchorPoint)
Generic sync function mapping any event to correct chart position.
• anchorPoint: "start", "end", or "middle"
Returns: MTFEventData
━━ DRAWING CREATION FUNCTIONS ━━
syncedBox(tracker, leftHtfOffset, rightHtfOffset, topPrice, bottomPrice, bgcolor, ...)
Creates a box at correct HTF-aligned position.
• leftHtfOffset: HTF bars back for left edge
• rightHtfOffset: HTF bars back for right edge
• extendRight: Auto-extend to current bar
Returns: SyncedBox or na
syncedHLine(tracker, htfOffset, price, lineColor, lineStyle, lineWidth, extendRight)
Creates horizontal line anchored to HTF bar start.
• extendRight: If true, extends to current bar (default true)
Returns: SyncedLine or na
syncedVLine(tracker, htfOffset, atStart, lineColor, lineStyle, lineWidth)
Creates vertical line at HTF bar boundary.
• atStart: True=start of HTF bar, False=end
Returns: SyncedLine or na
syncedLabel(tracker, htfOffset, price, labelText, anchorPoint, ...)
Creates label at correct HTF-aligned position.
• anchorPoint: "start", "end", or "middle"
Returns: SyncedLabel or na
syncedPlotValue(tracker, value, htfOffset)
Returns value for plotting only at synced positions.
Returns: value if current bar is within HTF range, otherwise na
━━ UPDATE FUNCTIONS ━━
updateSyncedBox(syncedBox, extendToCurrentBar)
Extends existing box's right edge to current bar.
Returns: Updated SyncedBox
updateSyncedLine(syncedLine, extendToCurrentBar)
Extends existing horizontal line to current bar.
Returns: Updated SyncedLine
updateSyncedLabel(syncedLabel, tracker, newText, newPrice)
Updates label text/price while maintaining sync.
Returns: Updated SyncedLabel
━━ CONVENIENCE FUNCTIONS ━━
htfBarStartIndex(htfTimeframe, htfOffset, historyDepth)
Simple function to get HTF bar start without explicit tracker.
⚠️ Only tracks ONE timeframe. For multiple TFs, use createTracker pattern.
Returns: bar_index or na
htfBarEndIndex(htfTimeframe, htfOffset, historyDepth)
Simple function to get HTF bar end without explicit tracker.
⚠️ Only tracks ONE timeframe. For multiple TFs, use createTracker pattern.
Returns: bar_index or na
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
COMPLETE USAGE EXAMPLES
Example 1: FVG Box with Auto-Extend
```
//@version=6
indicator("FVG with Synced Drawing", overlay=true)
import ArunaReborn/TimeframeAlign/1 as tfa
htfInput = input.timeframe("60", "HTF for FVG")
// Create tracker for chosen timeframe
var tfa.HTFTracker fvgTracker = tfa.createTracker(htfInput)
tfa.updateTracker(fvgTracker, htfInput)
// Get FVG data from HTF (confirmed bars with offset)
= request.security(syminfo.tickerid, htfInput,
[low , high , low > high ],
lookahead=barmerge.lookahead_off)
// Store managed box
var tfa.SyncedBox fvgBox = na
// Create synced box when FVG detected
if fvgDetected and tfa.htfBarChanged(fvgTracker)
fvgBox := tfa.syncedBox(fvgTracker, 3, 1, fvgTop, fvgBot,
color.new(color.green, 85), color.green, 1, "FVG", color.white, true)
// Extend box to current bar each tick
if not na(fvgBox)
tfa.updateSyncedBox(fvgBox, true)
```
Example 2: HTF Support/Resistance Lines
```
//@version=6
indicator("HTF S/R Lines", overlay=true)
import ArunaReborn/TimeframeAlign/1 as tfa
htfInput = input.timeframe("240", "HTF for S/R")
// Create and update tracker
var tfa.HTFTracker srTracker = tfa.createTracker(htfInput)
tfa.updateTracker(srTracker, htfInput)
// Get HTF high/low (confirmed with offset)
= request.security(syminfo.tickerid, htfInput,
[high , low ], lookahead=barmerge.lookahead_off)
// Track lines
var tfa.SyncedLine resistanceLine = na
var tfa.SyncedLine supportLine = na
// Create new lines when HTF bar changes
if tfa.htfBarChanged(srTracker)
resistanceLine := tfa.syncedHLine(srTracker, 1, htfHigh, color.red, line.style_solid, 2, true)
supportLine := tfa.syncedHLine(srTracker, 1, htfLow, color.green, line.style_solid, 2, true)
// Auto-extend lines each bar
if not na(resistanceLine)
tfa.updateSyncedLine(resistanceLine, true)
if not na(supportLine)
tfa.updateSyncedLine(supportLine, true)
```
Example 3: Multiple Timeframes
```
//@version=6
indicator("Multi-TF Boxes", overlay=true)
import ArunaReborn/TimeframeAlign/1 as tfa
// Create separate tracker for each timeframe
var tfa.HTFTracker tracker1H = tfa.createTracker("60")
var tfa.HTFTracker tracker4H = tfa.createTracker("240")
var tfa.HTFTracker trackerD = tfa.createTracker("1D")
// Update ALL trackers every bar (pass the same TF string)
tfa.updateTracker(tracker1H, "60")
tfa.updateTracker(tracker4H, "240")
tfa.updateTracker(trackerD, "1D")
// Now use each tracker independently for drawing
// Each tracker maintains its own separate boundary history
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NON-REPAINTING COMPLIANCE
To ensure non-repainting behavior, always use this pattern with request.security:
```
= request.security(syminfo.tickerid, htfTimeframe,
[value1 , value2 ], // Use offset for confirmed data
lookahead=barmerge.lookahead_off) // Never use lookahead_on
```
The ` ` offset ensures you're using the previous completed HTF bar, not the current forming bar.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HISTORY DEPTH PARAMETER
The `historyDepth` parameter controls how many HTF bars are tracked:
• Default: 500 HTF bars
• Maximum: Limited by Pine Script's array constraints
• Higher values = more historical accuracy but more memory usage
• Lower values = less memory but may return `na` for older offsets
Adjust based on your needs:
```
tfa.updateTracker(tracker, 100) // Track 100 HTF bars (light)
tfa.updateTracker(tracker, 1000) // Track 1000 HTF bars (heavier)
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
IMPORTANT NOTES
1. One Tracker Per Timeframe : If you need multiple HTFs, create separate trackers for each. The convenience functions (htfBarStartIndex, htfBarEndIndex) only track one TF.
2. Update Every Bar : Always call updateTracker() unconditionally on every bar, not inside conditionals.
3. HTF Only : This library is designed for Higher Timeframe data. For LTF aggregation, use findBarAtTime() for time-based lookups.
4. Drawing Limits : Pine Script has limits on drawing objects. Use box.delete(), line.delete(), label.delete() to clean up old objects.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TROUBLESHOOTING
Q: My boxes/lines still appear at wrong positions
A: Make sure you're calling updateTracker() on every bar (not inside an if statement) and using the correct htfOffset values.
Q: Functions return na
A: The htfOffset might be larger than available history. Increase historyDepth or use a smaller offset.
Q: Multiple timeframes don't work correctly
A: Don't use the convenience functions for multiple TFs. Create separate HTFTracker instances with createTracker() for each timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CHANGELOG
v1 - Initial release
• HTFTracker pattern for reliable multi-TF tracking
• Synced drawing functions for boxes, lines, labels
• Update functions for extending drawings
• Convenience functions for simple single-TF use cases
Wick & Body % with upper wick thresholdA simple indicator to give the sizes of wicks and main body of the last candle as percentage of high - low. No negative figures. If the candle is red, the table will be red and vice versa. Table could be located as per user preference. Upper wick threshold is user defined and will be red beyond the threshold.
Plan Limit TimerA Pine Script library that helps developers monitor script execution time against TradingView's plan-specific timeout limits. Displays a visual debug table with runtime metrics, percentage of limit consumed, and color-coded status warnings.
WHAT THIS LIBRARY DOES
TradingView enforces different script timeout limits based on subscription tier:
• Basic : 20 seconds
• Essential / Plus / Premium : 40 seconds
• Ultimate : 100 seconds
This library measures your script's total execution time and displays it relative to these limits, helping you optimize indicators for users on different plans.
THE DEBUG TABLE
When enabled, a table appears on your chart showing:
• Plan : The selected TradingView subscription tier
• Limit : Maximum allowed execution time for that plan
• Runtime : Measured script execution time
• Per Bar : Average time spent per bar
• Bars : Number of bars processed
• % Used : Percentage of timeout limit consumed (color-coded)
• Status : OK (green), WARNING (yellow), DANGER (orange), or EXCEEDED (red)
HOW IT WORKS
The library captures a timestamp at the start of your script using timenow, then calculates the elapsed time at the end. It compares this against the selected plan's timeout limit to determine percentage used and status.
Technical Note : Pine Script's timenow variable has approximately 1-second precision. Scripts that execute in under 1 second may display 0ms. This is a platform limitation, not a library issue. For detailed per-function profiling, use TradingView's built-in Pine Profiler (More → Profiler mode in the Editor).
EXPORTED FUNCTIONS
startTimer()
Call at the very beginning of your script. Returns a timestamp.
getStats(startTime, plan)
Calculates timing statistics. Returns a TimingStats object with all metrics.
showTimingTable(stats, plan, tablePosition, showOnlyOnLast)
Renders the debug table on the chart.
debugTiming(startTime, plan, tablePosition)
Convenience function combining getStats() and showTimingTable() in one call.
isApproachingLimit(stats, threshold)
Returns true if execution time has reached the specified percentage of the limit.
getRemainingMs(stats)
Returns milliseconds remaining before timeout.
formatSummary(stats)
Returns a compact single-line string for labels or tooltips.
addTimingLabel(stats, barIdx, price, labelStyle, textSize)
Creates a color-coded chart label displaying timing statistics. Useful for visual debugging without the full table. Returns the label object for further customization.
EXPORTED CONSTANTS
• LIMIT_BASIC = 20
• LIMIT_ESSENTIAL = 40
• LIMIT_PLUS = 40
• LIMIT_PREMIUM = 40
• LIMIT_ULTIMATE = 100
EXPORTED TYPE: TimingStats
Object containing:
• totalTimeMs (float): Total execution time in milliseconds
• timePerBarMs (float): Average time per bar
• barsTimed (int): Number of bars measured
• barsSkipped (int): Bars excluded from measurement
• planLimitMs (int): Plan timeout in milliseconds
• percentUsed (float): Percentage of limit consumed
• status (string): "OK", "WARNING", "DANGER", or "EXCEEDED"
HOW TO USE IN YOUR INDICATOR
//@version=6
indicator("My Indicator", overlay = true)
import YourUsername/PlanLimitTimer/1 as timer
// User selects their TradingView plan
planInput = input.string("basic", "Your Plan", options = )
// START TIMING - must be first
startTime = timer.startTimer()
// Your indicator calculations here
sma20 = ta.sma(close, 20)
rsi14 = ta.rsi(close, 14)
plot(sma20)
// END TIMING - must be last
timer.debugTiming(startTime, planInput)
ADVANCED USAGE EXAMPLE
//@version=6
indicator("Advanced Example", overlay = true)
import YourUsername/PlanLimitTimer/1 as timer
planInput = input.string("basic", "Plan", options = )
startTime = timer.startTimer()
// Your calculations...
sma = ta.sma(close, 200)
plot(sma)
// Get stats for programmatic use
stats = timer.getStats(startTime, planInput)
// Option 1: Use addTimingLabel for a quick visual indicator
if barstate.islast
timer.addTimingLabel(stats, bar_index, high)
// Option 2: Show custom warning label if approaching limit
if timer.isApproachingLimit(stats, 70.0) and barstate.islast
label.new(bar_index, low, "Warning: " + timer.formatSummary(stats),
color = color.orange, textcolor = color.white, style = label.style_label_up)
// Display the debug table
timer.showTimingTable(stats, planInput, position.bottom_right)
IMPORTANT LIMITATIONS
1. Precision : Timing precision is approximately 1 second due to timenow behavior. Fast scripts show 0ms.
2. Variability : Results vary based on TradingView server load. The same script may show different times across runs.
3. Total Time Only : This library measures total script execution time, not individual function timing. For per-function analysis, use the Pine Profiler in the Editor.
4. Historical Bars : On historical bars, timenow reflects when the script loaded, not individual bar processing times.
USE CASES
• Optimization Debugging : See how close your script is to timeout limits
• Multi-Plan Support : Help users select appropriate settings for their subscription tier
• Performance Regression : Detect when changes increase execution time
• Documentation : Show users the performance characteristics of your indicator
SMA Convergence Finder (7, 25, 50)This to detect and show the three SMAs(7,25,50)convergence's point.
small orange cicle is showed at the point.






















