The "Theta-Flux Credit Spread Overnight" algorithm is a quantitative trading strategy designed to identify and execute credit spread trades on NIFTY options. It aims to capitalize on short-term volatility compression and the divergence between implied and realized volatility to generate trading signals. The core methodology involves analyzing high-frequency minute-by-minute options data, calculating volatility-based features, and applying a time series ranking to normalize the trading signal. The algorithm evaluates whether to initiate a credit put spread (selling a put option and buying a further out-of-the-money put option) or a credit call spread (selling a call option and buying a further out-of-the-money call option) based on the calculated "alpha" values, which represent the strength and direction of the trading signal.
The signal generation logic relies on two "alpha" values derived from volatility and open interest analysis. Alpha1 is calculated from the 'compression_factor' (ratio of long-term to short-term volatility of volatility), 'vol_divergence' (difference between long-term implied and realized volatility), and 'denoised_momentum' (smoothed spot returns). Alpha2 is derived from the difference between call and put implied volatility skew, adjusted by the ratio of put to call open interest and volume. The algorithm enters a credit put spread if both alpha values are above a predefined threshold and a credit call spread if both are below another threshold. The algorithm avoids trading on expiry days and during specific market hours. Risk management includes setting stop-loss and target levels as a percentage of the required margin and premium received, respectively. The algorithm implements a kill switch on the advisor and utilizes OpenTelemetry for monitoring execution times.