OPEN-SOURCE SCRIPT
Intra-Bar Activity Index (IAI) [Adaptive Volume & Volatility]

… is an adaptive percentrank-based analysis of Volume and Volatility (true-range). It dynamically toggles between request.lower_tf-reconstruction and cumulative lower_tf chart data (simulating continual ltf_request).
Core Features:
1. The Formula for True Activity
The IAI doesn't just measure price action; it calculates the energetic density behind every bar.
• Volume + Volatility = Activity: You have full control over how these metrics are weighted via individual thresholds. You can set a pure volume signal, a pure volatility signal, or any mix to your liking. Institutional engagement only becomes visible once your calibrated thresholds are breached.
• Individual Calibration: Through the ltf_request and percentrank, you define your own statistical benchmark and how "exclusive" a signal should be.
2. Adaptive Live-Mode (The Signal Bridge)
The system seamlessly switches to Live-Transfer mode as soon as you zoom into lower timeframes.
• Early Warning System: The Live-Tracker detects signals while the higher timeframe (HTF) bar is still forming.
• Hidden Signals: It uncovers activity spikes that would be "smoothed out" if you only looked at the final close of the HTF bar (e.g., H2).
3. Dashboard for Data Integrity (Data Honesty)
We visualize technical limits instead of hiding them.
• 🛡️ Verified: Live data matches the „historical baseline“.
• ⚠️ Warning: The Live-Tracker deviates statistically (e.g., due to Pine Script's 4900-bar limit).
• No Stat. Control: Transparent notification in Replay Mode when no historical reference data is available for your setup.
4. Intelligent Alert System
• In Live-Mode, you receive alerts as soon as a lower-timeframe interval (e.g., M10) completes with high energy, providing a lead-time advantage over the final HTF bar close
• Context-Sensitive: The message informs you directly about the current mode (HTF-Request vs. Live-Transfer) and the data status.
🚀 Quick Calibration Tips
1. Sensitivity: Increase the Lookback Period for more stable, long-term statistics; decrease it for a more reactive, fast-paced Index.
2. Threshold Setup: Start with 85% for both Volatility and Volume.
3. The Visual Check: Open the settings menu and activate the Price Chart Dots. Calibrate your Thresholds by observing the position of the dots until they match your market interpretation.
4. Dashboard Check: Always keep an eye on the Confidence Score. If it drops or turns red, consider adjusting your Timeframe or Lookback to maintain full Data Integrity.
🎨 Visual Guide: How to Read the Index
• Navy Bars (Normal Engagement): The market is healthy and active, but hasn’t reached "exceptional" levels yet. This represents standard participation.
• Gray Bars (Low Interest): Market is in a "Dry Volume" phase. Volume is below your Low Volume Threshold. Institutional interest is currently negligible.
• Silver/Orange Area (Volatility): This background area represents the Volatility Percentile. Even if volume is low, you can instantly see if the price activity (True Range) is expanding.
• Orange Bars (IAI Active): The "High Energy" phase. These appear only when both Volatility and Volume cross your individual thresholds simultaneously. (The bar height continues to represent the Volume Percentrank).
• Price Chart Dots (IAI Anchor): Optional orange circles that appear directly on your candles (High/Low). They provide a quick visual link between the oscillator's momentum and the specific price action.
⚠️ Important Technical Notifications
1. The "Signal Bridge" Logic (Rolling vs. Fixed Window)
• HTF-Request Mode (Fixed Window): On a H2 chart, the index measures activity starting from the candle open (e.g., 12:00 PM). At 12:40 PM, the calculation only includes the first 40 minutes of data. It grows as the bar progresses.
• Live-Transfer Mode (Rolling Window): On a M10 chart, the IAI simulates the H2 energy by always analyzing the last 120 minutes. At 12:40 PM, it processes the window from 10:40 AM to 12:40 PM.
• Early Detection: This provides a significant lead-time advantage. You detect institutional spikes as they happen, regardless of the official HTF clock. Both modes converge at the close of the H2 candle (e.g., at 02:00 PM).
2. Data Integrity & Timeframe Anomalies
The 5000-bar limit is not the only factor for "Data Honesty".
• Session Gaps: Using D1 as the Main-TF can be tricky in Forex markets, where Sunday sessions often only last a few hours. Such irregularities can cause statistical shifts depending on your Lookback Period.
• Action: Always monitor the Confidence Score (🛡️). If it drops, consider adjusting your Timeframe or Lookback to maintain a solid statistical baseline.
3. Replay Mode & Historical Gaps
• The IAI transparently displays "No Stat. Control" during Bar Replay if historical lower-timeframe data is unavailable for that specific segment. We prioritize data honesty over showing "estimated" or faked data.
4. How to set Alerts (Smart Signals)
To activate the IAI early warning system, follow these steps in the TradingView Alert Menu:
1. Condition (1st Box): Select "pct_IAI".
2. Trigger Logic (2nd Box): Change the setting to "Any function call"
3. Frequency / Timeframe:
• The alert frequency is automatically managed by the script (once_per_bar_close) to ensure data honesty and prevent repainting.
• The type of signal depends on your chart: Use the Main-TF (e.g., H2) for final HTF-signals, or a Lower-Timeframe (e.g., M10) to receive the Live-Tracker early warnings.
Intelligence: You don’t need to type a message. The alert is fully dynamic—it automatically reports the Mode (Live vs. HTF), the Safeguard-Status, and the Data Integrity (Verified vs. Low Integrity) directly to your device.
📊 Understanding the Data Window (Statistical Transparency)
The IAI performs complex statistical comparisons under the hood. To keep the chart clean, these raw metrics are not plotted visually but are displayed exclusively in the TradingView Data Window (right sidebar). They provide full transparency:
• Runtime-Safe LTF: Displays the analysis interval currently in use. If this value is red, the script automatically adjusted the interval to prevent a runtime error (e.g., if your chart timeframe is larger than your selected LTF).
• Max Safe Lookback for this TF: The mathematical limit for your current setup. It calculates at which point your Lookback Period exceeds Pine Script's technical 5,000-bar limit.
• Active Bar Limit: The actual usable data foundation. If this value turns red, your selected lookback is statistically "clipped" because not enough historical data points can be retrieved.
• Converted Sum of LTF Request Bars: This converts the historical baseline (HTF-Request) into current chart units. It serves as the anchor point for the comparison with the Live-Tracker.
• Relative Live-Data Size: The numerical basis of your Confidence Score. It shows the ratio between the real-time data stream and the historical expectation. A value near 100% indicates absolute statistical integrity.
• Overall Requested Bars: The total number of individual data points analyzed within your selected Lookback Period.
Core Features:
1. The Formula for True Activity
The IAI doesn't just measure price action; it calculates the energetic density behind every bar.
• Volume + Volatility = Activity: You have full control over how these metrics are weighted via individual thresholds. You can set a pure volume signal, a pure volatility signal, or any mix to your liking. Institutional engagement only becomes visible once your calibrated thresholds are breached.
• Individual Calibration: Through the ltf_request and percentrank, you define your own statistical benchmark and how "exclusive" a signal should be.
2. Adaptive Live-Mode (The Signal Bridge)
The system seamlessly switches to Live-Transfer mode as soon as you zoom into lower timeframes.
• Early Warning System: The Live-Tracker detects signals while the higher timeframe (HTF) bar is still forming.
• Hidden Signals: It uncovers activity spikes that would be "smoothed out" if you only looked at the final close of the HTF bar (e.g., H2).
3. Dashboard for Data Integrity (Data Honesty)
We visualize technical limits instead of hiding them.
• 🛡️ Verified: Live data matches the „historical baseline“.
• ⚠️ Warning: The Live-Tracker deviates statistically (e.g., due to Pine Script's 4900-bar limit).
• No Stat. Control: Transparent notification in Replay Mode when no historical reference data is available for your setup.
4. Intelligent Alert System
• In Live-Mode, you receive alerts as soon as a lower-timeframe interval (e.g., M10) completes with high energy, providing a lead-time advantage over the final HTF bar close
• Context-Sensitive: The message informs you directly about the current mode (HTF-Request vs. Live-Transfer) and the data status.
🚀 Quick Calibration Tips
1. Sensitivity: Increase the Lookback Period for more stable, long-term statistics; decrease it for a more reactive, fast-paced Index.
2. Threshold Setup: Start with 85% for both Volatility and Volume.
3. The Visual Check: Open the settings menu and activate the Price Chart Dots. Calibrate your Thresholds by observing the position of the dots until they match your market interpretation.
4. Dashboard Check: Always keep an eye on the Confidence Score. If it drops or turns red, consider adjusting your Timeframe or Lookback to maintain full Data Integrity.
🎨 Visual Guide: How to Read the Index
• Navy Bars (Normal Engagement): The market is healthy and active, but hasn’t reached "exceptional" levels yet. This represents standard participation.
• Gray Bars (Low Interest): Market is in a "Dry Volume" phase. Volume is below your Low Volume Threshold. Institutional interest is currently negligible.
• Silver/Orange Area (Volatility): This background area represents the Volatility Percentile. Even if volume is low, you can instantly see if the price activity (True Range) is expanding.
• Orange Bars (IAI Active): The "High Energy" phase. These appear only when both Volatility and Volume cross your individual thresholds simultaneously. (The bar height continues to represent the Volume Percentrank).
• Price Chart Dots (IAI Anchor): Optional orange circles that appear directly on your candles (High/Low). They provide a quick visual link between the oscillator's momentum and the specific price action.
⚠️ Important Technical Notifications
1. The "Signal Bridge" Logic (Rolling vs. Fixed Window)
• HTF-Request Mode (Fixed Window): On a H2 chart, the index measures activity starting from the candle open (e.g., 12:00 PM). At 12:40 PM, the calculation only includes the first 40 minutes of data. It grows as the bar progresses.
• Live-Transfer Mode (Rolling Window): On a M10 chart, the IAI simulates the H2 energy by always analyzing the last 120 minutes. At 12:40 PM, it processes the window from 10:40 AM to 12:40 PM.
• Early Detection: This provides a significant lead-time advantage. You detect institutional spikes as they happen, regardless of the official HTF clock. Both modes converge at the close of the H2 candle (e.g., at 02:00 PM).
2. Data Integrity & Timeframe Anomalies
The 5000-bar limit is not the only factor for "Data Honesty".
• Session Gaps: Using D1 as the Main-TF can be tricky in Forex markets, where Sunday sessions often only last a few hours. Such irregularities can cause statistical shifts depending on your Lookback Period.
• Action: Always monitor the Confidence Score (🛡️). If it drops, consider adjusting your Timeframe or Lookback to maintain a solid statistical baseline.
3. Replay Mode & Historical Gaps
• The IAI transparently displays "No Stat. Control" during Bar Replay if historical lower-timeframe data is unavailable for that specific segment. We prioritize data honesty over showing "estimated" or faked data.
4. How to set Alerts (Smart Signals)
To activate the IAI early warning system, follow these steps in the TradingView Alert Menu:
1. Condition (1st Box): Select "pct_IAI".
2. Trigger Logic (2nd Box): Change the setting to "Any function call"
3. Frequency / Timeframe:
• The alert frequency is automatically managed by the script (once_per_bar_close) to ensure data honesty and prevent repainting.
• The type of signal depends on your chart: Use the Main-TF (e.g., H2) for final HTF-signals, or a Lower-Timeframe (e.g., M10) to receive the Live-Tracker early warnings.
Intelligence: You don’t need to type a message. The alert is fully dynamic—it automatically reports the Mode (Live vs. HTF), the Safeguard-Status, and the Data Integrity (Verified vs. Low Integrity) directly to your device.
📊 Understanding the Data Window (Statistical Transparency)
The IAI performs complex statistical comparisons under the hood. To keep the chart clean, these raw metrics are not plotted visually but are displayed exclusively in the TradingView Data Window (right sidebar). They provide full transparency:
• Runtime-Safe LTF: Displays the analysis interval currently in use. If this value is red, the script automatically adjusted the interval to prevent a runtime error (e.g., if your chart timeframe is larger than your selected LTF).
• Max Safe Lookback for this TF: The mathematical limit for your current setup. It calculates at which point your Lookback Period exceeds Pine Script's technical 5,000-bar limit.
• Active Bar Limit: The actual usable data foundation. If this value turns red, your selected lookback is statistically "clipped" because not enough historical data points can be retrieved.
• Converted Sum of LTF Request Bars: This converts the historical baseline (HTF-Request) into current chart units. It serves as the anchor point for the comparison with the Live-Tracker.
• Relative Live-Data Size: The numerical basis of your Confidence Score. It shows the ratio between the real-time data stream and the historical expectation. A value near 100% indicates absolute statistical integrity.
• Overall Requested Bars: The total number of individual data points analyzed within your selected Lookback Period.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.