OPEN-SOURCE SCRIPT

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

679
📌 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 🙏

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.