OPEN-SOURCE SCRIPT
ATK / DEF Directional Movement State Engine

Description
ATK / DEF Directional Movement State Engine is a market condition analysis framework built around the Directional Movement Index (DMI) system.
Unlike traditional DMI tools that mainly display +DI, -DI, and ADX values, this indicator focuses on interpre the effectiveness and current condition of directional movement through multiple analytical layers.
The engine combines directional strength, trend structure, volatility behavior, and price action characteristics to provide a structured view of market conditions.
The purpose of this framework is to evalu the qual of directional movement and understand the current state of market behavior.
Directional Movement Core
The foundation of this indicator is based on the DMI and ADX framework.
It analyzes:
+DI directional pressure
-DI directional pressure
ADX directional strength
The relationship between these components is used to class the current movement environment, including:
Strong directional conditions
Weak directional conditions
Balanced movement
Swinging conditions
Rather than focusing on a single numeri rea, the engine evalua how directional components interact with the broader market structure.
ATK / DEF Market State Concept
The ATK / DEF framework represents two different market behaviors.
ATK (Attack State)
Describes environments where directional movement demonstrates stronger activity and clearer momentum characteristics.
DEF (Defense State)
Describes environments where directional movement becomes weaker, balanced, or less defined.
The engine observes these states through directional strength, price structure, and movement behavior to describe the current market condition.
Directional Radar System
The Radar module analyzes current price behavior by combining candle structure and market movement characteristics.
It evaluates:
Candle body efficiency
Price range behavior
Directional pressure
Trend positioning
Short-term movement characterist
The radar provides a visual representation of the current behavioral condition, helping use understand whether the market is displaying expansion, decline, compression, or swing characteristics.
Trend Structure Analysis
The trend module evaluates market structure through multiple moving average relationships and price positioning.
It observes:
Short- trend direction
Medium-alignment
Long- structural condition
This provides additional context for understanding the relationship between directional movement and the overall price structure.
Velocity Measurement
The Velocity component measures current movement intensit through volatility conditions.
It evalua price movement range relative to recent market activity to describe different leve of movement speed.
This helps identify whether the current environment is experiencing:
Lower activity conditions
Normal movement conditions
Higher volatility conditions
Market Regime Observation
The Regime module evaluates changes in market activity using volatility structure.
It observes:
Expansion conditions
Contraction conditions
Range environments
This provides additional context around how the market is currently behaving.
ADX State Classification
The ADX state engine combines ADX strength with DI relationships to categorize directional conditions.
The classification includes:
Strong U
Strong D
Weak U
Weak D
Swing Condition
These states are designed to describe the current directional environment rather than forecast future market movement.
Integrated Dashboard
The built-in dashboard organizes multiple analytical components into a single view:
Engine status
Velocity level
Radar condition
Trend direction
Market regime
ADX state
Current price information
The dashboard provides a compact overview of market structure and directional behavior.
Design Philosophy
ATK / DEF Directional Movement State Engine is designed around the concept that market movement should be analyzed through multiple layers rather than a single indicator value.
By combining:
Directional movement analysis
ADX strength evaluation
Trend structure
Volatility behavior
Price action characteristics
the indicator provides a structured framework for observing market conditions and understanding directional movement effectiveness.
This tool is designed for analytical purposes, helping users stu market behavior, movement structure, and directional dynamics.
ATK / DEF Directional Movement State Engine is a market condition analysis framework built around the Directional Movement Index (DMI) system.
Unlike traditional DMI tools that mainly display +DI, -DI, and ADX values, this indicator focuses on interpre the effectiveness and current condition of directional movement through multiple analytical layers.
The engine combines directional strength, trend structure, volatility behavior, and price action characteristics to provide a structured view of market conditions.
The purpose of this framework is to evalu the qual of directional movement and understand the current state of market behavior.
Directional Movement Core
The foundation of this indicator is based on the DMI and ADX framework.
It analyzes:
+DI directional pressure
-DI directional pressure
ADX directional strength
The relationship between these components is used to class the current movement environment, including:
Strong directional conditions
Weak directional conditions
Balanced movement
Swinging conditions
Rather than focusing on a single numeri rea, the engine evalua how directional components interact with the broader market structure.
ATK / DEF Market State Concept
The ATK / DEF framework represents two different market behaviors.
ATK (Attack State)
Describes environments where directional movement demonstrates stronger activity and clearer momentum characteristics.
DEF (Defense State)
Describes environments where directional movement becomes weaker, balanced, or less defined.
The engine observes these states through directional strength, price structure, and movement behavior to describe the current market condition.
Directional Radar System
The Radar module analyzes current price behavior by combining candle structure and market movement characteristics.
It evaluates:
Candle body efficiency
Price range behavior
Directional pressure
Trend positioning
Short-term movement characterist
The radar provides a visual representation of the current behavioral condition, helping use understand whether the market is displaying expansion, decline, compression, or swing characteristics.
Trend Structure Analysis
The trend module evaluates market structure through multiple moving average relationships and price positioning.
It observes:
Short- trend direction
Medium-alignment
Long- structural condition
This provides additional context for understanding the relationship between directional movement and the overall price structure.
Velocity Measurement
The Velocity component measures current movement intensit through volatility conditions.
It evalua price movement range relative to recent market activity to describe different leve of movement speed.
This helps identify whether the current environment is experiencing:
Lower activity conditions
Normal movement conditions
Higher volatility conditions
Market Regime Observation
The Regime module evaluates changes in market activity using volatility structure.
It observes:
Expansion conditions
Contraction conditions
Range environments
This provides additional context around how the market is currently behaving.
ADX State Classification
The ADX state engine combines ADX strength with DI relationships to categorize directional conditions.
The classification includes:
Strong U
Strong D
Weak U
Weak D
Swing Condition
These states are designed to describe the current directional environment rather than forecast future market movement.
Integrated Dashboard
The built-in dashboard organizes multiple analytical components into a single view:
Engine status
Velocity level
Radar condition
Trend direction
Market regime
ADX state
Current price information
The dashboard provides a compact overview of market structure and directional behavior.
Design Philosophy
ATK / DEF Directional Movement State Engine is designed around the concept that market movement should be analyzed through multiple layers rather than a single indicator value.
By combining:
Directional movement analysis
ADX strength evaluation
Trend structure
Volatility behavior
Price action characteristics
the indicator provides a structured framework for observing market conditions and understanding directional movement effectiveness.
This tool is designed for analytical purposes, helping users stu market behavior, movement structure, and directional dynamics.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.