Neural Spectrogram Heatmapis an AI cycle prediction indicator: a wavelet spectrogram of every market cycle, with machine learning neural networks that forecast the next highs and lows and keep score of how far their forecasts land.
The engine scans every cycle length at once, follows the dominant cycle as it stretches and compresses, rebuilds it on the price chart, and projects its next turning points with timing windows sized from its own track record. Most cycle tools assume a fixed length: an RSI set to 14 has already decided the market moves in a 14 bar rhythm. Here, the data picks the rhythm. Traders familiar with Hurst cycles, Fourier spectra or Ehlers DSP will recognise the goal:measure the dominant cycle, then time its turns. It works on crypto, forex, stocks, commodities and indices, on any timeframe with enough history.
Note on Architecture: This is a single, interdependent engine. The heatmap finds the dominant cycle, the overlay rebuilds and projects it, and twoNeuraLibneural networks may correct the forecast only once they have proven, out of sample, that they improve it.
Below, on Bitcoin’s 3 day chart: the dominant cycle drawn over price, colour graded by its length, the dotted forecast leading to the next projected low and high with their timing windows, and the heatmap in the pane underneath.
—————————————————————————————————————-
🔷 1.0 – Cycles and Wavelengths
A cycle is a repeating swing from a high (thecrest) to a low (thetrough) and back. Its length in bars is thewavelength.
Below are three pure cycles, 10, 22 and 45 bars long. Added together, they already look like price:
Real price is many cycles at once, mixed with trend and noise, and their lengths drift as conditions change. The indicator answers three questions:which cycle is in control,how long it is, andwhen it turns next.
—————————————————————————————————————-
🔷 2.0 – The Cycle Wave and Forecast
The strongest cycle is pulled out of price and drawn on top of it. Left of the dotted line it is final, right of it still forming. Past the last bar, the dotted forecast runs on to the next projected low and high, each with its timing window:
On the chart, the overlay is made of:
- Cycle Wave: the isolated dominant cycle over the candles, colour graded by its wavelength, with a dot at each past high and low.
- Repaint Line: left of it, the wave isfinal. Right of it, the wavelet window is still filling, and the wave refines as new bars arrive.
- Projected Path: the forecast, coloured by the wavelength it expects, between two ghost paths at the10% and 90% period forecasts.
- Turn Windows: every predicted high (red) and low (green) carries a timing bar, faint across its80% windowand stronger across its50% window, labelled with the bars remaining. Hover any label for the full readout.
—————————————————————————————————————-
🔷 3.0 – The Spectrogram Heatmap
The heatmap is how the dominant cycle is found. A wavelet, a short burst of wave, is slid along price at every length: each column is one moment, each row one wavelength, and brightness is how well that wavelength fits. Strictly, this makes it ascalogram, the wavelet form of a spectrogram: where a spectrogram measures every cycle through one fixed window, the wavelet sizes its window to each cycle, so short cycles stay sharp in time and long ones sharp in length.
Here, the three cycles of section 1.0 are mixed into one market. Each one lights up its own row, exactly at its wavelength, while it is in control, and the price line on top takes the colour of whichever cycle leads:
On a real chart, the heatmap pane adds:
- Dominant Ridge: the cyan line tracks the band the wave follows,solidwhere final anddottedwhere it can still change.
- Cone of Influence: near the right edge, long cycles cannot be resolved yet. That area is dimmed and excluded from every measurement.
- Colour Key: the wavelength spectrum, with theDominantandLiveperiods. The Dominant label is highlighted only when the cycle beats red noise, and an arrow means the strongest cycle sits at the edge of the scan range.
—————————————————————————————————————-
🔷 4.0 – How the Cycle Is Measured
Anyone can draw a sine wave on a chart. A cycle has to earn the label “dominant”:
- Log price detrending: a centred Gaussian low-pass removes the trend, so trend power cannot flood the long periods.
- Complex Morlet wavelet (cmor8.0-1.0): its output is already the analytic signal, so amplitude, phase and turns come out directly, with no added lag.
- Scale normalisation: magnitude is divided by scale (Liu et al. 2007), so long periods get no free advantage.
- Cone of influence(Torrence & Compo, 1998): edge-contaminated cells never enter the dominant cycle or the significance test.
- AR(1) red noise test: the dominant peak must beat what autocorrelated noise would produce, at your chosen confidence level.
- Live edge estimate: where the zero-phase wavelet goes blind at the right edge, a causal Ehlers band-pass bank takes over.Fuse Live at Edgeswitches this off.
—————————————————————————————————————-
🔷 5.0 – AI Cycle Prediction
The projection continues the cycle from the wave’s current value and slope, with no jump at the last bar. Two compact neural networks then work on what a fixed sine cannot know.
🔸 5.1 – Period Network: predicts the dominant period at four horizons from causal inputs only (the live band-pass spectrum, its drift, and the volatility and cycle energy regimes), so a cycle about to compress or stretch is drawn that way.
🔸 5.2 – Turn Network: learns how the edge’s reading relates to the final wave: whether turns comeearly or late, andhow farthe cycle really reaches.
🔸 5.3 – Network Design: both arefeed-forward neural networks(multilayer perceptrons) built onNeuraLib‘s Sequential API:9 inputs, one hidden layer of12 tanh neurons, and a linear output layer, with 4 outputs for the period path and 3 for the turn correction (phase shift and height). They train with theAdamWoptimiser on aHuber loss, with gradient clipping, taking two passes over up to 320 of the newest samples after every second new one. Every input is dimensionless, so the same networks work on any symbol and timeframe, and fixed seeds mean the same history always trains the same networks.
🔸 5.4 – Proven Before Use: both networks train walk-forward, on your chart. Every sample is predicted out of sample and scored against the plain projection before it is learned, and a network’s output is used only once it beats the plain projection with95% confidence. The timing windows are measured the same way: they come from the 80th percentile of the latest 120 errors between the edge’s turns and the final wave.
Every tooltip shows what is in use, its score, its confidence and its sample count. On many charts the timing correction stays off, because a cycle’s phase cannot be known before its prices happen. The height correction usually qualifies first.
—————————————————————————————————————-
- 1)Frame the range: setMin / Max Periodto the cycles you care about. An arrow on the Dominant label means the cycle sits at the edge of the range: widen it.
- 2)Check the verdict: a highlighted Dominant label has beaten the red noise test. Dimmed means descriptive, not tradable.
- 3)Read the ridge: a rising ridge means the cycle is lengthening and momentum is slowing; a falling ridge means the rhythm is speeding up. Dominant and Live drifting apart usually marks a regime change.
- 4)Time with the windows: the 50% bar is where turns most often land, the 80% bar is the range to plan for. Use them as a timing bias alongside your own levels and confirmation, not as a trigger.
Learned ForecastandExtra Training Historycontrol the networks. More history gives them a better chance to prove themselves, at the cost of a slower load.
—————————————————————————————————————-
🔹 Alerts
Cycle low / high window opensfires on the bar close at which the next predicted turn enters its 80% window.Any alert() function callcarries the same events with their details: bars until the turn, where the window ends, and the current cycle period.
🔹 Performance
The heatmap holds 64,000 cells at the default settings, and 90,000 on the publication chart (a 2,000 bar History Window at 900 columns and 90 rows), each a weighted sum over hundreds of bars. The engine works incrementally: it updates once per bar close, computes every cell once when its window completes, and caches each bar’s final wave, so an update only recomputes the unfinished edge. The heatmap is rendered byPineCanvasas merged colour regions, and the rolling stores useOptiPinerow rings.
⚠️ Repainting
The wavelet is zero-phase: each bar uses bars on both sides of it, which keeps turns aligned with price and free of lag. The newest bars (230 at the default settings) are therefore still refining, and are marked by the repaint line, the dotted ridge and the faded turn dots. Everything left of the line is final. Drawings update once per confirmed bar, never intrabar. Predicted turns are an extrapolation of the current cycle, not a promise: cycles drift, vanish and reappear. The script needs roughly the History Window plus the Extra Training History plus a few hundred bars, and says on the chart when it has too little.
This indicator is built on three Alien_Algorithms libraries:NeuraLibfor the neural networks,PineCanvasfor the heatmap graphics andOptiPinefor the rolling data stores. Its
Disclaimer: Past performance is not indicative of future results. This indicator is an analytical and educational tool, not a signal service, and offers no promise of financial gain. Use it as one component of a broader trading process, under your own responsibility. Conceptual architecture and quantitative development by Alien_Algorithms.
—————————————————————————————————————-
This work is licensed under(CC BY-NC-SA 4.0), meaning usage is free for non-commercial purposes given thatAlien_Algorithmsis credited in the description for the underlying software. For commercial use licensing, contactAlien_Algorithms
Open-
In true TradingView spirit, the creator of this script has made it open-udos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules
Alien_Algorithms
Documentation for Indicators and Libraries on 👉alienalgorithms.com/
Sentiment Analysis Platform 👉Sentalysis.com/
AICyclesforecastingheatmapmachinelearningneuralnetworkpredictionspectrogramTrend Analysiswavelet
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
AICyclesforecastingheatmapmachinelearningneuralnetworkpredictionspectrogramTrend Analysiswavelet
Open-
Sentiment Analysis Platform 👉Sentalysis.com/
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
![Neural Spectrogram Heatmap [AI Cycle Prediction] Neural Spectrogram Heatmap [AI Cycle Prediction]](https://s3.tradingview.com/k/K7i5eBut_big.png?v=1792357335)