Prisma Hilbert Spectral Cycle Oscillator
- 指标
- 版本: 3.0
- 激活: 10
Most indicators never ask the most important question: is there actually a cycle running right now? Prisma asks it on every bar. When the answer is no, it stays silent. When the answer is yes, it tells you exactly where inside that cycle price currently sits — and signals the crossover at the right moment.
The result is an oscillator that filters out the noise that destroys most fixed-period indicators, and fires only when three independent scientific systems agree.
Three Scientific Layers
1. Ehlers Hilbert Transform
John Ehlers adapted electrical engineering's Digital Signal Processing to financial markets. His Hilbert Transform decomposes price into orthogonal In-Phase and Quadrature components, producing two critical outputs on every bar:
- Phase angle (0 to 360 degrees) — the exact position of price within its dominant cycle. Rising phase means the cycle is ascending; falling phase means descending.
- Dominant cycle period — how many bars one full cycle currently takes. Every RSI calculation inside Prisma uses this value divided by two as its period. A 20-bar cycle gives RSI(10). A 30-bar cycle gives RSI(15). No fixed arbitrary settings.
2. Discrete Fourier Transform — Spectral Power
The DFT scans recent log-returns and measures the energy at each frequency, then calculates the ratio of the dominant frequency's power to the average power across all frequencies. This Signal-to-Noise Ratio is expressed as a 0 to 100 percent reading shown on the live dashboard.
- Above 60% — strong dominant cycle present, STRONG label, full signal weight
- 35 to 60% — moderate cycle present, MOD label
- Below 25% — noise dominates, WEAK label, no signal is issued
This spectral gate is why Prisma stays silent in choppy, ranging conditions where most oscillators fire continuously and generate losses.
3. K-Means Volatility Regime Detection
A rolling K-Means clustering algorithm groups ATR(14) history into three volatility regimes without fixed thresholds. The clusters adapt automatically to each symbol and timeframe.
- LOW VOL — tight range, conservative signal weighting
- MED VOL — normal conditions, full signal weight
- HIGH VOL — explosive or news-driven move; requires spectral power above 55% before signalling
What Appears on the Chart
Sub-window oscillator
- Blue line — Prisma composite score, range -100 to +100
- Orange line — EMA signal line; crossovers trigger BUY and SELL arrows
- Magenta dotted line — dominant cycle length indicator, centred at 20 bars
- Green up arrows — BUY signals
- Red down arrows — SELL signals
- Dashed reference levels at +80, 0 and -80
Live dashboard panel (top-right of main chart)
Cycle : 18.4 bars Phase : 127.3 deg Cycl.pos : Falling Power : 74% STRONG Regime : MED VOL Score : +62.1 Bias : Bullish Grade : A TRADE ------------------------ ATR(14) : 9.2 pips SL dist : 13.8 pips TP dist : 20.7 pips
All columns use Consolas monospaced font with fixed-width labels so every value aligns precisely.
Cycle extrapolator (main chart)
Projects the dominant Fourier cycle forward onto the price chart as a sinusoidal path with ATR uncertainty bands and quarter-cycle turn markers shown as gold dots. This is a cycle rhythm guide — it shows the expected oscillation cadence to help with entry and exit timing.
Entry and Exit Rules
BUY signal — all four conditions required
- Prisma line crosses above the Signal line
- Phase angle is between 0 and 180 degrees (rising half of cycle)
- Spectral power is above 25%
- Volatility regime is Low or Medium (or power above 55% in High regime)
Enter at the next bar open. Stop Loss at 1.5 x ATR(14) below entry. Take Profit at 2.25 x ATR(14) above entry. Both levels are printed as text labels on the main chart at the signal bar.
SELL signal — mirror conditions
- Prisma line crosses below the Signal line
- Phase angle is between 180 and 360 degrees (falling half of cycle)
- Same spectral power and regime filters apply
Exit: Opposite crossover, or when Prisma reaches the +80 or -80 reference levels indicating a cycle extreme.
Alert System
Four alert types are independently toggleable in the input panel:
- Pop-up dialog — standard MT4 alert window
- Sound — WAV file playback; separate files configurable for BUY and SELL
- Email — sent via MT4 mail settings
- Push notification — sent to the MT4 mobile app
Each bar triggers at most one BUY alert and one SELL alert. No repeated alerts on ticks within the same bar.
Trade Grade System
The dashboard grades every bar based on three independent pass/fail checks:
| Grade | Checks passed | Meaning |
|---|---|---|
| A TRADE | 3 of 3 | All conditions aligned — highest confidence |
| B WATCH | 2 of 3 | Setup is forming, monitor closely |
| C WEAK | 1 of 3 | Low confidence, caution advised |
| WAIT | 0 of 3 | No setup present, stay flat |
The three checks are: spectral power above 40%, volatility regime Low or Medium, and absolute Prisma score above 35.
Compatible Trading Styles
| Style | Timeframe | Recommended pairs |
|---|---|---|
| Scalping | M1, M5 | EUR/USD, USD/JPY |
| Intraday | M15, H1 | Any major or minor pair |
| Swing trading | H4, Daily | Any major pair |
| Binary options | M1 to M5 | EUR/USD, GBP/USD (enable Binary Mode) |
Input Parameters
Core Settings
| Parameter | Default | Description |
|---|---|---|
| InpLookback | 40 | DFT analysis window in bars. Increase for slower pairs or higher timeframes. |
| InpSignalPeriod | 5 | Signal line EMA smoothing. Higher values produce fewer crossovers. |
| InpKMeansIter | 20 | K-Means clustering iterations. 10 to 30 is the practical range. |
| InpRiskMult | 1.5 | ATR multiplier for Stop Loss. Take Profit uses 1.5x this value. |
Display
| Parameter | Default | Description |
|---|---|---|
| InpShowLabels | true | Print SL and TP price levels on the main chart at each signal bar. |
| InpShowDash | true | Show the information dashboard panel in the top-right corner. |
| InpShowExtrap | true | Draw the cycle projection path ahead of the current bar. |
| InpExtrapBars | 15 | Number of bars to project forward. |
Alerts
| Parameter | Default | Description |
|---|---|---|
| InpAlertPopup | true | MT4 pop-up alert on new signal. |
| InpAlertSound | true | Sound file playback on new signal. |
| InpAlertEmail | false | Email alert via MT4 mail configuration. |
| InpAlertPush | false | Push notification via MT4 mobile app. |
| InpAlertSound_B | alert.wav | Sound file name for BUY signals. |
| InpAlertSound_S | alert2.wav | Sound file name for SELL signals. |
Trading Mode
| Parameter | Default | Description |
|---|---|---|
| InpBinaryMode | false | Adds a Prisma score threshold filter (above +45 for BUY, below -45 for SELL) for binary options use. |
Technical Notes
- Platform: MetaTrader 4, build 600 and above
- Minimum bars to initialise: InpLookback + 40
- All calculations use MQL4 native functions only — no external libraries
- Tested on EUR/USD, GBP/USD, USD/JPY, AUD/USD across M5, M15, H1 and H4
Scientific references: Ehlers, J.F. — Rocket Science for Traders (Wiley, 2001). Ehlers, J.F. — Cybernetic Analysis for Stocks and Futures (Wiley, 2004).
