38 lines
1.4 KiB
Markdown
38 lines
1.4 KiB
Markdown
# Implied Volatility Surface
|
|
|
|
The implied volatility surface built and rendered in 3D inside MetaTrader 5,
|
|
using the platform's own DirectX bindings.
|
|
|
|
Companion code for the MQL5 article: https://www.mql5.com/en/articles/23385
|
|
|
|
## What it does
|
|
|
|
An option chain gives prices. The surface is what you get after inverting every
|
|
one of those prices back to the volatility that would produce it, then laying
|
|
the results out across strike and expiry.
|
|
|
|
The Black-Scholes core does the inversion. `IVSurfaceData` builds the grid,
|
|
handling the fact that a real chain is ragged rather than a neat rectangle.
|
|
`IVSurface3D.mq5` renders it with DirectX, so the surface is rotatable on the
|
|
chart rather than a flat heatmap.
|
|
|
|
The chain can come from a CSV or from native MetaTrader 5 options.
|
|
|
|
## Layout
|
|
|
|
```
|
|
Include/IVSurface/BlackScholes.mqh pricing and IV inversion
|
|
Include/IVSurface/IVSurfaceData.mqh grid construction
|
|
Include/IVSurface/IVProviderNative.mqh native MT5 options feed
|
|
Indicators/IVSurface/IVSurface3D.mq5 the DirectX renderer
|
|
Files/IVSurface/iv_chain_sample.csv sample chain
|
|
```
|
|
|
|
DirectX rendering needs a terminal build that supports it. The sample CSV lets
|
|
you run without a live chain.
|
|
|
|
## 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.
|