Here is a simple prototype code with a display dashboard for the System traders who want to calculate ATM Call or ATM Put from the underlying spot price/future price for options backtesting or automated execution purpose.
It is a simple straight forward calculation derived from underlying spot or futures data. Hence, Amibroker data subscription is required to compute ATM CE or ATM PE strikes. However, when it comes to backtesting one need an array of ATM CE & ATM PE strike price and hence static arrays are used to create & store an array of ATM CE & ATM PE symbols which can be further extended to the backtest or automate option trading ideas.
Once ATM CE & PE strikes are calculated it can be even further elongated to calculated ITM or OTM CE or PE strikes.
ATM Calculation – Amibroker AFL Code