1.4 KiB
Gamma Exposure (GEX)
Dealer gamma exposure computed from an option chain and drawn on the chart in MQL5.
Companion code for the MQL5 article: https://www.mql5.com/en/articles/23410
What it does
Gamma exposure estimates how dealers have to hedge as spot moves. Where net gamma is positive, hedging leans against price and dampens it. Where it is negative, hedging pushes with price. The zero-gamma flip is the level between the two, and it is the number most of this is built to find.
The Black-Scholes core prices options, inverts price to implied volatility, and
returns gamma. GexData aggregates the chain into a profile per strike, and
GexMap.mq5 draws it beside the price axis.
The chain can come from a CSV or from native MetaTrader 5 options, so the tool works whether or not your broker carries the instruments.
Layout
Include/GEX/BlackScholes.mqh pricing, IV inversion, greeks
Include/GEX/GexData.mqh chain aggregation and the flip level
Include/GEX/GexProviderNative.mqh native MT5 options feed
Indicators/GEX/GexMap.mq5 the chart map
Files/GEX/gex_chain_sample.csv sample chain, for running without a feed
The sample CSV lets you run the indicator before wiring up 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.