Montecarlo Oscillator
- Indicatori
- Giuseppe Pajusco
- Versione: 1.0
- Attivazioni: 20
A statistically-driven oscillator that quantifies directional market pressure through Monte Carlo simulation — designed for reversal traders who want probability on their side.
What is this indicator?
The Monte Carlo Oscillator measures the probability that price will be higher in the future based on the statistical distribution of recent returns. It does not use moving averages, RSI formulas, or any fixed mathematical transformation. Instead, it runs hundreds of randomized price simulations at every bar and asks a simple question: in how many of these scenarios does price end up higher than today?
The result is a clean oscillator ranging from 0 to 1:
- Values near 1.0 mean the simulations overwhelmingly expect price to rise — which in a mean-reversion context signals the market is statistically overbought
- Values near 0.0 mean the simulations expect price to fall — signaling the market is statistically oversold
- Values around 0.5 indicate no directional statistical edge
Key Levels
| Level | Color | Interpretation |
|---|---|---|
| ≥ 0.70 | 🔴 Red | Statistically overbought → potential SHORT reversal |
| ≤ 0.30 | 🟢 Green | Statistically oversold → potential LONG reversal |
| 0.50 | — Gray | Neutral zone, no statistical edge |
The 0.30 and 0.70 thresholds are fully configurable via input parameters.
How the Monte Carlo Engine works
- Collects the last N candles of log-returns (default: 150)
- Runs M simulations (default: 300), each time randomly sampling from the historical return distribution (bootstrap resampling)
- Projects price forward H candles (default: 15) per simulation
- Counts the percentage of simulations where the final simulated price exceeds the current price
- That percentage becomes P_up — the oscillator value plotted on your chart
This approach is model-free: it makes no assumption about normality or trend. It purely reflects what the recent price history implies about future probabilities.
Visual Layout
- Blue line — continuous P_up value (0 to 1)
- Red line — highlights bars where P_up ≥ 0.70 (overbought zone)
- Green line — highlights bars where P_up ≤ 0.30 (oversold zone)
- Dashed gray line — midline at 0.50
- Dashed horizontal levels — configurable thresholds at 0.70 and 0.30
Input Parameters
| Parameter | Default | Description |
|---|---|---|
| MC_Lookback | 150 | Historical candles used to build the return distribution |
| MC_Simulations | 300 | Number of Monte Carlo paths per bar |
| MC_Horizon | 15 | Candles projected forward in each simulation |
| Level_High | 0.70 | Overbought threshold |
| Level_Low | 0.30 | Oversold threshold |
Recommended Usage
Best timeframes: H1, H4, D1 Best assets: Forex majors, indices, gold — instruments with mean-reverting tendencies Confluence: Works well combined with support/resistance levels, Bollinger Bands, or session filters Signal: Enter reversal when the oscillator crosses back inside the extreme zone (e.g. drops below 0.70 from above)
Important: Like all oscillators, this tool performs best in ranging or mean-reverting conditions. In strong trending markets, overbought and oversold readings can persist for extended periods. Always use proper risk management.
Performance Notes
The indicator uses incremental calculation ( prev_calculated ) to process only new bars on each tick, keeping CPU usage low even with 300 simulations. On historical bars the value is computed once and stored. Increasing MC_Simulations above 500 improves curve smoothness at the cost of additional processing time.
Monte Carlo Oscillator is a probabilistic analysis tool. Past statistical patterns do not guarantee future results. Always backtest on your specific instrument and timeframe before live trading.
