I was attempting to get that to chart for SPX and any other ticker symbol (XOM for instance) but I can not seem to get it to work.
# Gamma Exposure Profile Indicator for ThinkOrSwim (XOM)
# Define Inputs
input fromStrike = 0;
input toStrike = 200;
# Define Variables
def todayDate = GetYYYYMMDD();
def fromStrikePrice = fromStrike;
def toStrikePrice = toStrike;
# Calculate Gamma Exposure
def calcGammaEx(S, K, vol, T, r, q, optType, OI) {
if (T == 0 || vol == 0) {
return 0;
}
def dp = (Log(S / K) + (r - q + 0.5 * vol ** 2) * T) / (vol * Sqrt(T));
def dm = dp - vol * Sqrt(T);
def gamma;
if (optType == 'call') {
gamma = Exp(-q * T) * normdist(dp, 0, 1) / (S * vol * Sqrt(T));
} else {
gamma = K *...