OPEN-SOURCE SCRIPT
PCA Projection Pulse [forexobroker]

PCA Projection Pulse runs Principal Component Analysis on a 2-D feature space (z-scored close, z-scored volume) over a rolling window. The first principal component is the direction of maximum joint variance; projecting the current point onto PC1 measures how strongly current price-and-volume aligns with that direction. Signals fire on edge crossings of the projection threshold.
🔶 ALGORITHM
1. zC = (close - mean_close) / sd_close; zV = (volume - mean_volume) / sd_volume.
2. 2x2 covariance matrix entries: s11 = var(close), s22 = var(volume), s12 = cov(close, volume).
3. trace = s11 + s22; det = s11 * s22 - s12^2; eigenvalue lambda1 = (trace + sqrt(trace^2 - 4 * det)) / 2.
4. PC1 eigenvector ~ (lambda1 - s22, s12); normalise to unit length (ux, uy).
5. Projection = zC * ux + zV * uy.
6. Pulse regime when |projection| >= threshold.
🔶 SIGNAL LOGIC
- Buy: projection >= +threshold edge AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: projection <= -threshold edge.
- Position-lock state machine.
🔶 INPUTS
- Covariance Window (default 40)
- Projection Threshold (default 0.50)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, xcross with PC text, PC1 direction line, buy / sell colors
🔶 ALERTS
PPP Buy, PPP Sell, PPP Any Signal, PPP Pulse Up, PPP Pulse Down, PPP Strong Pulse, PPP Single Direc, PPP Same Sign, PPP Webhook JSON.
🔶 LIMITATIONS
- 2-D PCA captures only the dominant joint direction; higher-D variants (more features) would extract richer signals but require larger covariance matrices.
- Closed-form eigendecomposition is exact for 2x2 cases; for richer feature spaces an iterative solver is needed.
- Forex tick volume noise can dominate PC1; assets with reliable volume produce cleaner pulses.
- The "PC1 direction line" is anchored at EMA20 and scales projection by ATR — visual cue, not a level.
🔶 ALGORITHM
1. zC = (close - mean_close) / sd_close; zV = (volume - mean_volume) / sd_volume.
2. 2x2 covariance matrix entries: s11 = var(close), s22 = var(volume), s12 = cov(close, volume).
3. trace = s11 + s22; det = s11 * s22 - s12^2; eigenvalue lambda1 = (trace + sqrt(trace^2 - 4 * det)) / 2.
4. PC1 eigenvector ~ (lambda1 - s22, s12); normalise to unit length (ux, uy).
5. Projection = zC * ux + zV * uy.
6. Pulse regime when |projection| >= threshold.
🔶 SIGNAL LOGIC
- Buy: projection >= +threshold edge AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: projection <= -threshold edge.
- Position-lock state machine.
🔶 INPUTS
- Covariance Window (default 40)
- Projection Threshold (default 0.50)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, xcross with PC text, PC1 direction line, buy / sell colors
🔶 ALERTS
PPP Buy, PPP Sell, PPP Any Signal, PPP Pulse Up, PPP Pulse Down, PPP Strong Pulse, PPP Single Direc, PPP Same Sign, PPP Webhook JSON.
🔶 LIMITATIONS
- 2-D PCA captures only the dominant joint direction; higher-D variants (more features) would extract richer signals but require larger covariance matrices.
- Closed-form eigendecomposition is exact for 2x2 cases; for richer feature spaces an iterative solver is needed.
- Forex tick volume noise can dominate PC1; assets with reliable volume produce cleaner pulses.
- The "PC1 direction line" is anchored at EMA20 and scales projection by ATR — visual cue, not a level.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.