OPEN-SOURCE SCRIPT
HMK-2 | PCA-1 + Rejim + Chebyshev + VWAP (Input'lu, v6)

📌 HMK-2 | PCA-1 + Regime + Chebyshev + VWAP Strategy
1️⃣ Core Structure
Instead of relying on a single indicator, this system uses the Z-Score normalized average of three oscillators (RSI, MFI, ROC).
Signal (PCA-1):
RSI(14), MFI(14), ROC(5) → each is converted into a z-score.
Their average becomes the “composite signal,” our PCA-1 value.
Trend direction: If the Z-score EMA is rising → trend UP. If falling → trend DOWN.
2️⃣ Side Filters
Regime Filter (ADX + EMA)
ADX is calculated manually.
If ADX > 20 → trend exists → a 50-period EMA of this value smooths it.
This turns “trend regime” into a probability between 0–1.
Chebyshev Filter
A return series is checked against mean ± k*sigma bands.
If the return is within this band → valid signal. Extreme moves are filtered out.
VWAP Filter
Long trades: price must be above VWAP.
Short trades: price must be below VWAP.
Trades are only taken on the correct side of institutional cost averages.
3️⃣ Entry Conditions
Long:
PCA-1 signal crosses above threshold.
Trend Up + Regime OK + Chebyshev OK + Above VWAP.
Short:
PCA-1 signal crosses below threshold.
Trend Down + Regime OK + Chebyshev OK + Below VWAP.
4️⃣ Exit Mechanism
Main Exit: ATR-based stop/target.
Stop = entry price – ATR × (SL factor).
Take profit = entry price + ATR × (TP factor).
Additional Exit:
If price crosses to the opposite side of VWAP.
If PCA-1 signal crosses zero.
👉 Prevents trades from being locked, makes exits adaptive.
5️⃣ Labels / Visualization
AL / SHORT → entry points.
SAT / COVER → exit points.
VWAP line plotted in blue.
🧩 Strategy Features
Optimizable parameters:
Z-window (zWin)
Threshold
Chebyshev factor
ATR stop/target multipliers
This system works with:
Disciplined core (PCA-1 signal)
Triple protection (Regime + Chebyshev + VWAP)
Adaptive exits (ATR + VWAP/signal cross)
👉 Not a “single-indicator robot,” but a multi-filtered trade direction engine.
💡 Final Note
This is a base model of the system — open for further development.
I’ve shared the logic to give you a roadmap.
If you spot errors, fix them → that’s how you’ll improve it.
Don’t waste time asking me questions — refine and build it better yourselves.
Wishing you profitable trades. Stay well 🙏
1️⃣ Core Structure
Instead of relying on a single indicator, this system uses the Z-Score normalized average of three oscillators (RSI, MFI, ROC).
Signal (PCA-1):
RSI(14), MFI(14), ROC(5) → each is converted into a z-score.
Their average becomes the “composite signal,” our PCA-1 value.
Trend direction: If the Z-score EMA is rising → trend UP. If falling → trend DOWN.
2️⃣ Side Filters
Regime Filter (ADX + EMA)
ADX is calculated manually.
If ADX > 20 → trend exists → a 50-period EMA of this value smooths it.
This turns “trend regime” into a probability between 0–1.
Chebyshev Filter
A return series is checked against mean ± k*sigma bands.
If the return is within this band → valid signal. Extreme moves are filtered out.
VWAP Filter
Long trades: price must be above VWAP.
Short trades: price must be below VWAP.
Trades are only taken on the correct side of institutional cost averages.
3️⃣ Entry Conditions
Long:
PCA-1 signal crosses above threshold.
Trend Up + Regime OK + Chebyshev OK + Above VWAP.
Short:
PCA-1 signal crosses below threshold.
Trend Down + Regime OK + Chebyshev OK + Below VWAP.
4️⃣ Exit Mechanism
Main Exit: ATR-based stop/target.
Stop = entry price – ATR × (SL factor).
Take profit = entry price + ATR × (TP factor).
Additional Exit:
If price crosses to the opposite side of VWAP.
If PCA-1 signal crosses zero.
👉 Prevents trades from being locked, makes exits adaptive.
5️⃣ Labels / Visualization
AL / SHORT → entry points.
SAT / COVER → exit points.
VWAP line plotted in blue.
🧩 Strategy Features
Optimizable parameters:
Z-window (zWin)
Threshold
Chebyshev factor
ATR stop/target multipliers
This system works with:
Disciplined core (PCA-1 signal)
Triple protection (Regime + Chebyshev + VWAP)
Adaptive exits (ATR + VWAP/signal cross)
👉 Not a “single-indicator robot,” but a multi-filtered trade direction engine.
💡 Final Note
This is a base model of the system — open for further development.
I’ve shared the logic to give you a roadmap.
If you spot errors, fix them → that’s how you’ll improve it.
Don’t waste time asking me questions — refine and build it better yourselves.
Wishing you profitable trades. Stay well 🙏
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.