RND/README.md

44 lines
1.7 KiB
Markdown

2026-08-14 00:09:51 +00:00
# RND
Recovers the market's own probability distribution from an option chain, using
the Breeden-Litzenberger identity.
Companion code for the MQL5 article: https://www.mql5.com/en/articles/23788
## What it does
Option prices across strikes encode what the market thinks the distribution of
future prices looks like. Breeden-Litzenberger makes that precise: the second
derivative of call price with respect to strike is the risk-neutral density.
You cannot differentiate a real chain twice and get anything usable. Strikes are
sparse, quotes are noisy, and the second derivative amplifies both into garbage.
The article deals with that directly, which is most of the work here.
Once the density is reconstructed it can be read for what the market is pricing,
and compared against the realised distribution from historical returns. The gap
between the two is the risk premium, which `HistoricalDensity.mqh` supports.
The chain can come from a CSV or from native MetaTrader 5 options.
## Layout
```
Include/RND/BlackScholes.mqh pricing, inversion, the forward
Include/RND/RndCore.mqh density reconstruction
Include/RND/RndData.mqh chain handling
Include/RND/HistoricalDensity.mqh realised distribution and risk premium
Include/RND/RndProviderNative.mqh native MT5 options feed
Indicators/RND/RndProfile.mq5 the density plot
Files/RND/rnd_chain_sample.csv sample chain
Files/RND/rnd_chain_flatvol.csv flat-vol chain, as a sanity case
```
The flat-vol chain is the useful starting point: a known input whose output you
can check by eye.
## Disclaimer
Educational code. Past behaviour of any model or dataset says nothing about
future results. Test on your own data and broker conditions before drawing
conclusions.