PROTECTED SOURCE SCRIPT
NQ Market DNA Map

NQ Market DNA Map
The Market DNA Map indicator is designed to visualize key trading sessions (Asia, London, and New York) on the chart while providing a probabilistic lookup table based on historical session patterns. This tool draws session boxes with midline references, extends session highs and lows until mitigated or a daily hardstop (16:00 in the selected timezone), and displays a summary table with statistical metrics derived from predefined historical data. The data mappings are hardcoded, reflecting an analytical approach for session-based price action. Note that all probabilities and metrics are based on past observations and should not be interpreted as predictions or guarantees of future market behavior. These statistics are only tested and generated based on NQ futures. This indicator is for educational and informational purposes only; trading decisions should incorporate additional analysis and risk management.
Key Features
• Session Visualization:
o Draws colored boxes for the Asia, London, and New York sessions, updating in real-time as the session progresses.
o Includes a dotted midline within each box for quick reference to the session's midpoint.
o Extends horizontal lines from the final session high and low until price mitigates them (crossing both above and below) or the daily hardstop is reached.
• Probabilistic Table:
o A customizable-position table appears on the chart (once the New York open is detected), summarizing conditions and metrics for the current day's setup.
o Conditions include: Asia range relative to its rolling average, London open relative to Asia's midpoint, London sweep type (high only, low only, both, or none), and New York open relative to London's midpoint.
o Metrics displayed include:
First High Sweep %: Probability (based on historical data) that the high of the prior session is swept first during New York.
First Low Sweep %: Probability that the low is swept first.
Med Pen ↑ (High): Median penetration distance (in points) above the session high.
Med Pen ↓ (Low): Median penetration below the session low.
Fail High -> Low %: Failure rate where an initial high sweep fails and reverses to sweep the low.
Fail Low -> High %: Failure rate for an initial low sweep reversing to the high.
Sample Size: Number of historical observations for the matching pattern (n value), with a rating of "High" (n ≥ 150), "Mid" (n ≥ 75), or "Low" (n < 75) to indicate data reliability.
o The table uses color-coding for quick interpretation: Green for above-average/above-mid conditions, red for below, and neutral tones for metrics.
• Asia Range Ratio: Calculates a rolling average of Asia session ranges over a user-defined lookback period to classify the current Asia range as above or below average.
• Hardstop Logic: All extensions cease at 16:00 in the selected timezone to align with typical daily cycle resets.
Inputs and Customization
• Calculation Timezone: Select from predefined options (e.g., "America/New_York", "Europe/London") to align session times with your preferred market clock. Default: "America/New_York".
• Session Times:
o Asia Session: Default "2000-0200" (8:00 PM to 2:00 AM in the selected timezone).
o London Session: Default "0200-0800" (2:00 AM to 8:00 AM).
o NY Session: Default "0800-1600" (8:00 AM to 4:00 PM). These can be adjusted to match specific market hours or personal preferences.
• Asia Ratio Rolling Window: Integer lookback (default: 20) for calculating the average Asia session range ratio (range divided by open price).
• Table Position: Choose where the summary table appears on the chart (e.g., top_right, bottom_right). Default: top_right.
• Colors: Customizable box fill and border colors for each session (Asia: yellow tones, London: blue, NY: gray) with transparency settings for overlay compatibility.
How It Works
1. Session Detection: The indicator checks the current bar's time against user-defined sessions in the selected timezone. Sessions are non-overlapping and assume a 24-hour cycle.
2. Box and Line Drawing:
o At session start, a box is initialized from the open/high/low.
o As the session progresses, the box expands to capture the live high/low, with the midline updating dynamically.
o Upon session end, final high/low are locked, and extension lines are drawn horizontally.
o Extensions persist until price fully mitigates the level (high ≥ level and low ≤ level) or the hardstop time is passed.
3. Asia Ratio Calculation: Maintains a historical array of Asia range ratios (high-low divided by open). The current ratio is compared to the average over the lookback to classify as "Above Avg" or "Below Avg".
4. Key Generation and Lookup:
o A unique key is built from four binary/ternary codes: Asia classification (0/1), London open vs. Asia mid (0/1), London sweep type (0=high only, 1=low only, 2=both, 3=none), NY open vs. London mid (0/1).
o This key queries a hardcoded map of historical data (e.g., "0_0_0_0" for above-avg Asia, above-mid London open, high-only sweep, above-mid NY open).
o Data includes sample size, probabilities, failure rates, and median penetrations, all derived from historical analysis (total samples across all keys: approximately 5,000+ based on the provided mappings).
5. Table Rendering: On the last bar (real-time), the table populates with the current key's data. Metrics are formatted for readability, and penetration values are scaled to the current London high/low in points for context.
6. Performance Notes: The indicator uses up to 500 lines and boxes for extensions and visuals, ensuring compatibility with TradingView limits. It is overlay=true, so it plots directly on the price chart.
Data Source and Limitations
The probabilistic data is hardcoded and represents a compilation of historical session patterns from backtested or observed market behavior on NQ futures. Exact data collection methodology is not specified in the script, but values are presented as-is for illustrative purposes. Users should verify applicability to their specific symbol/timeframe, as markets evolve and past patterns may not repeat. Low-sample patterns (rated "Low") have higher uncertainty.
This indicator does not generate buy/sell signals, alerts, or trading strategies—it solely provides visual and statistical context. Always combine with other tools, fundamental analysis, and proper risk controls. Trading involves risk of loss; no performance guarantees are implied. If republishing or modifying, please credit the original structure and adhere to TradingView's publication guidelines. For questions on usage, refer to TradingView documentation on session indicators and probabilistic tools.
The Market DNA Map indicator is designed to visualize key trading sessions (Asia, London, and New York) on the chart while providing a probabilistic lookup table based on historical session patterns. This tool draws session boxes with midline references, extends session highs and lows until mitigated or a daily hardstop (16:00 in the selected timezone), and displays a summary table with statistical metrics derived from predefined historical data. The data mappings are hardcoded, reflecting an analytical approach for session-based price action. Note that all probabilities and metrics are based on past observations and should not be interpreted as predictions or guarantees of future market behavior. These statistics are only tested and generated based on NQ futures. This indicator is for educational and informational purposes only; trading decisions should incorporate additional analysis and risk management.
Key Features
• Session Visualization:
o Draws colored boxes for the Asia, London, and New York sessions, updating in real-time as the session progresses.
o Includes a dotted midline within each box for quick reference to the session's midpoint.
o Extends horizontal lines from the final session high and low until price mitigates them (crossing both above and below) or the daily hardstop is reached.
• Probabilistic Table:
o A customizable-position table appears on the chart (once the New York open is detected), summarizing conditions and metrics for the current day's setup.
o Conditions include: Asia range relative to its rolling average, London open relative to Asia's midpoint, London sweep type (high only, low only, both, or none), and New York open relative to London's midpoint.
o Metrics displayed include:
First High Sweep %: Probability (based on historical data) that the high of the prior session is swept first during New York.
First Low Sweep %: Probability that the low is swept first.
Med Pen ↑ (High): Median penetration distance (in points) above the session high.
Med Pen ↓ (Low): Median penetration below the session low.
Fail High -> Low %: Failure rate where an initial high sweep fails and reverses to sweep the low.
Fail Low -> High %: Failure rate for an initial low sweep reversing to the high.
Sample Size: Number of historical observations for the matching pattern (n value), with a rating of "High" (n ≥ 150), "Mid" (n ≥ 75), or "Low" (n < 75) to indicate data reliability.
o The table uses color-coding for quick interpretation: Green for above-average/above-mid conditions, red for below, and neutral tones for metrics.
• Asia Range Ratio: Calculates a rolling average of Asia session ranges over a user-defined lookback period to classify the current Asia range as above or below average.
• Hardstop Logic: All extensions cease at 16:00 in the selected timezone to align with typical daily cycle resets.
Inputs and Customization
• Calculation Timezone: Select from predefined options (e.g., "America/New_York", "Europe/London") to align session times with your preferred market clock. Default: "America/New_York".
• Session Times:
o Asia Session: Default "2000-0200" (8:00 PM to 2:00 AM in the selected timezone).
o London Session: Default "0200-0800" (2:00 AM to 8:00 AM).
o NY Session: Default "0800-1600" (8:00 AM to 4:00 PM). These can be adjusted to match specific market hours or personal preferences.
• Asia Ratio Rolling Window: Integer lookback (default: 20) for calculating the average Asia session range ratio (range divided by open price).
• Table Position: Choose where the summary table appears on the chart (e.g., top_right, bottom_right). Default: top_right.
• Colors: Customizable box fill and border colors for each session (Asia: yellow tones, London: blue, NY: gray) with transparency settings for overlay compatibility.
How It Works
1. Session Detection: The indicator checks the current bar's time against user-defined sessions in the selected timezone. Sessions are non-overlapping and assume a 24-hour cycle.
2. Box and Line Drawing:
o At session start, a box is initialized from the open/high/low.
o As the session progresses, the box expands to capture the live high/low, with the midline updating dynamically.
o Upon session end, final high/low are locked, and extension lines are drawn horizontally.
o Extensions persist until price fully mitigates the level (high ≥ level and low ≤ level) or the hardstop time is passed.
3. Asia Ratio Calculation: Maintains a historical array of Asia range ratios (high-low divided by open). The current ratio is compared to the average over the lookback to classify as "Above Avg" or "Below Avg".
4. Key Generation and Lookup:
o A unique key is built from four binary/ternary codes: Asia classification (0/1), London open vs. Asia mid (0/1), London sweep type (0=high only, 1=low only, 2=both, 3=none), NY open vs. London mid (0/1).
o This key queries a hardcoded map of historical data (e.g., "0_0_0_0" for above-avg Asia, above-mid London open, high-only sweep, above-mid NY open).
o Data includes sample size, probabilities, failure rates, and median penetrations, all derived from historical analysis (total samples across all keys: approximately 5,000+ based on the provided mappings).
5. Table Rendering: On the last bar (real-time), the table populates with the current key's data. Metrics are formatted for readability, and penetration values are scaled to the current London high/low in points for context.
6. Performance Notes: The indicator uses up to 500 lines and boxes for extensions and visuals, ensuring compatibility with TradingView limits. It is overlay=true, so it plots directly on the price chart.
Data Source and Limitations
The probabilistic data is hardcoded and represents a compilation of historical session patterns from backtested or observed market behavior on NQ futures. Exact data collection methodology is not specified in the script, but values are presented as-is for illustrative purposes. Users should verify applicability to their specific symbol/timeframe, as markets evolve and past patterns may not repeat. Low-sample patterns (rated "Low") have higher uncertainty.
This indicator does not generate buy/sell signals, alerts, or trading strategies—it solely provides visual and statistical context. Always combine with other tools, fundamental analysis, and proper risk controls. Trading involves risk of loss; no performance guarantees are implied. If republishing or modifying, please credit the original structure and adhere to TradingView's publication guidelines. For questions on usage, refer to TradingView documentation on session indicators and probabilistic tools.
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。