OPEN-SOURCE SCRIPT

ATK / DEF Temporal Session Position & Market State Engine

425
ATK / DEF — Temporal Session Position & Market State Engine is a quantitative market analysis framework built around multiple timeframes and multiple market sessions.

The framework combines HTF / MTF / LTF temporal structure with the Asian, London, and New York sessions, while calculating price position, volume relationships, volatility, statistical dispersion, and market states.

Unlike conventional multi-timeframe analysis, which primarily compares directional conditions across different periods, this framework extends the temporal structure into a quantitative relationship between price position, volume, volatility, session activity, and structural location.

## Multi-Timeframe Structure

The framework includes:

* Monthly — HTF
* Weekly — HTF
* Daily — MTF
* 4-Hour — LTF
* 1-Hour — LTF

Each timeframe provides calculated and volume data together with relative volume conditions.

The data from different periods is organized within the same analytical structure to observe changes in price position and volume relationships across multiple temporal layers.

## Multi-Session Structure

The framework calculates three major market sessions:

* Asian Session
* London Session
* New York Session

Each session maintains calculated:

* Open
* Close
* High
* Low
* Volume

Session data is further used to calculate:

* Drive
* Burst
* Decay
* Reversal

Session calculations use the exchange timezone of the selected symbol.

This creates two complementary temporal dimensions: **timeframe structure and market-session structure**.

## Quantitative Price Position

The framework calculates the current price position within the high-low range of the Monthly, Weekly, Daily, 4-Hour, and 1-Hour periods.

The multi-period position data is furth calculated into:

* Position Average
* Position Dispersion
* Alignment
* Divergence

Position Average represents the average calculated position across the available timeframe layers.

Position Dispersion represents the statistical separation between those timeframe positions.

These calculations provide a quantitative reference for observing alignment and differences between temporal layers.

## Volume & Volatility

Volume conditions are calculated through the relationship between current volume and its historical average.

Volatility is calculated using ATR relative to its ATR average and classified into:

* Very Low
* Normal
* High
* Extreme

The framework also identifies volatility state changes as:

* Expanding
* Contracting
* Flat

These states are generated from mathematical conditions defined within the script and represent calculated market-state classifications.

They do not claim to directly identify instl activity, capital flws, or specific market participants.

## Structural Reference

Swing High and Swing Low calculations provide structural price references with Support and Resistance labels.

These structural references are displayed together with timeframe position, session conditions, volume relationships, and volatility measurements.

## Statistical Observation

The core framework combines:

**Timeframe Structure

* Session Structure
* Price Position
* Volume Relationship
* Volatility
* Statistical Dispersion

The resulting structure provides a multi-dimensional analytical view of relationships between different timeframe layers and market sessions.

## Analytical Purpose

ATK / DEF is designed solely for market observation and analytical reference.

All displayed values and classifications are generated from defined mathematical conditions within the srpt. Different instr, data envir, and paras may produce different calculated results.

The displayed information is intended to remain subject to the own interpretation and defined decision-making.

Market observation, analytical reference, and decision-making only.**

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน