OPEN-SOURCE SCRIPT
MARS V4.0

MARS 4.0 is a trend-structure and portfolio management framework designed to identify, classify, and manage equity trends through their full lifecycle.
Rather than functioning as a traditional buy/sell indicator, MARS 4.0 acts as a market regime engine that evaluates:
structural trend quality,
trend maturity,
price extension,
trend efficiency,
portfolio suitability,
and capital deployment opportunity.
The system is built around the principle that:
“A good stock is not always a good entry.”
MARS 4.0 distinguishes between:
early-stage developing trends,
mature structural leaders,
deteriorating trends,
repair/recovery phases,
and excessively extended momentum conditions.
This allows the framework to support:
portfolio construction,
risk management,
capital rotation,
watchlist prioritisation,
and discretionary decision-making.
Core Components
Trend Structure Engine
The script evaluates:
fast trend alignment,
slow structural trend alignment,
moving average relationships,
persistence of trend behaviour,
and pullback integrity.
This creates a dynamic classification of market state.
Trend Maturity Analysis
MARS 4.0 measures how developed a trend has become.
Early trends may offer:
better asymmetry,
lower extension risk,
and stronger future upside potential.
Mature trends may still be strong holdings but require:
reduced aggression,
tighter risk control,
and careful position sizing.
Extension & Risk Framework
The system measures extension using ATR-based distance from equilibrium.
This helps identify:
chase-risk conditions,
exhaustion phases,
elevated volatility risk,
and poor reward-to-risk entries.
Rather than blindly rewarding strength, MARS evaluates whether:
the move is still investable,
or already overcrowded and statistically stretched.
Portfolio Classification System
The framework classifies securities into operational portfolio states such as:
Core Hold
Hold / Wait
Watchlist / Repair
Reduce Aggression
Avoid / No Action
This converts technical structure into practical portfolio guidance.
MARS 4.0 Scanner Engine
MARS 4.0 introduces hidden quantitative outputs that allow the framework to operate as a ranking and scanning engine.
MARS4 Alpha Score
A composite quality score combining:
regime strength,
maturity,
efficiency,
opportunity quality,
and extension risk.
Higher scores indicate stronger deployable trend quality.
MARS4 Scan State
A simplified operational state model:
State Meaning
0 Neutral
1 Watchlist / Repair
2 Fresh Money OK
3 Early Trend
4 Core Hold
5 Reduce / Avoid
This enables:
portfolio triage,
systematic scanning,
and capital allocation workflows.
Intended Use
MARS 4.0 is designed for:
swing traders,
trend-following investors,
discretionary portfolio managers,
and long-term equity trend analysis.
The framework is particularly effective for:
weekly timeframe analysis,
portfolio rotation,
and identifying institutional-quality trend behaviour.
Design Philosophy
MARS 4.0 prioritises:
clarity over complexity,
structure over prediction,
and risk-adjusted opportunity rather than pure momentum.
The system intentionally avoids excessive indicator stacking and instead focuses on refining:
trend behaviour,
market structure,
extension dynamics,
and portfolio context.
The objective is not to predict markets, but to:
systematically identify where risk/reward conditions are most favourable across the trend lifecycle.
Rather than functioning as a traditional buy/sell indicator, MARS 4.0 acts as a market regime engine that evaluates:
structural trend quality,
trend maturity,
price extension,
trend efficiency,
portfolio suitability,
and capital deployment opportunity.
The system is built around the principle that:
“A good stock is not always a good entry.”
MARS 4.0 distinguishes between:
early-stage developing trends,
mature structural leaders,
deteriorating trends,
repair/recovery phases,
and excessively extended momentum conditions.
This allows the framework to support:
portfolio construction,
risk management,
capital rotation,
watchlist prioritisation,
and discretionary decision-making.
Core Components
Trend Structure Engine
The script evaluates:
fast trend alignment,
slow structural trend alignment,
moving average relationships,
persistence of trend behaviour,
and pullback integrity.
This creates a dynamic classification of market state.
Trend Maturity Analysis
MARS 4.0 measures how developed a trend has become.
Early trends may offer:
better asymmetry,
lower extension risk,
and stronger future upside potential.
Mature trends may still be strong holdings but require:
reduced aggression,
tighter risk control,
and careful position sizing.
Extension & Risk Framework
The system measures extension using ATR-based distance from equilibrium.
This helps identify:
chase-risk conditions,
exhaustion phases,
elevated volatility risk,
and poor reward-to-risk entries.
Rather than blindly rewarding strength, MARS evaluates whether:
the move is still investable,
or already overcrowded and statistically stretched.
Portfolio Classification System
The framework classifies securities into operational portfolio states such as:
Core Hold
Hold / Wait
Watchlist / Repair
Reduce Aggression
Avoid / No Action
This converts technical structure into practical portfolio guidance.
MARS 4.0 Scanner Engine
MARS 4.0 introduces hidden quantitative outputs that allow the framework to operate as a ranking and scanning engine.
MARS4 Alpha Score
A composite quality score combining:
regime strength,
maturity,
efficiency,
opportunity quality,
and extension risk.
Higher scores indicate stronger deployable trend quality.
MARS4 Scan State
A simplified operational state model:
State Meaning
0 Neutral
1 Watchlist / Repair
2 Fresh Money OK
3 Early Trend
4 Core Hold
5 Reduce / Avoid
This enables:
portfolio triage,
systematic scanning,
and capital allocation workflows.
Intended Use
MARS 4.0 is designed for:
swing traders,
trend-following investors,
discretionary portfolio managers,
and long-term equity trend analysis.
The framework is particularly effective for:
weekly timeframe analysis,
portfolio rotation,
and identifying institutional-quality trend behaviour.
Design Philosophy
MARS 4.0 prioritises:
clarity over complexity,
structure over prediction,
and risk-adjusted opportunity rather than pure momentum.
The system intentionally avoids excessive indicator stacking and instead focuses on refining:
trend behaviour,
market structure,
extension dynamics,
and portfolio context.
The objective is not to predict markets, but to:
systematically identify where risk/reward conditions are most favourable across the trend lifecycle.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.