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 🙏
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。