Spx gamma Levels

Carlosack

New member
There's this company that posts and gives live data of certain gamma levels throughout the day on the spx chain. Anyone here know how they obtain this data? I want to see if I can obtain these gamma levels on my own. The bigger the candle the more its always attracted to it. Thank you
The video is an example. Thank you
1703079201127.png
 
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 * Exp(-r * T) * normdist(dm, 0, 1) / (S * S * vol * Sqrt(T));
}

return OI * 100 * S * S * 0.01 * gamma;
}

# Chart: Gamma Exposure Profile for XOM
def levels = CompoundValue(1, close, 0);
def totalGamma = 0;
def totalGammaExNext = 0;
def totalGammaExFri = 0;

# Loop through strike levels
for level in levels {
# Calculate gamma exposure at each strike level
def callGammaEx = calcGammaEx(level, GetStrike(), GetVolatility(), GetDTE(), 0, 0, "call", GetOpenInterest());
def putGammaEx = calcGammaEx(level, GetStrike(), GetVolatility(), GetDTE(), 0, 0, "put", GetOpenInterest());

# Aggregate gamma exposure
totalGamma += callGammaEx - putGammaEx;

# Excluding next expiry
if (GetExpDate() != GetNextExpDate()) {
totalGammaExNext += callGammaEx - putGammaEx;
}

# Excluding next monthly expiry
if (!IsMonthlyExp()) {
totalGammaExFri += callGammaEx - putGammaEx;
}
}

# Find Gamma Flip Point
def zeroCrossIdx = fold i = 1 to TotalItems(levels) with zeroCross = 0 do if Sign(totalGamma) != Sign(totalGamma[i - 1]) then i else zeroCross;
def negGamma = totalGamma[zeroCrossIdx];
def posGamma = totalGamma[zeroCrossIdx + 1];
def negStrike = levels[zeroCrossIdx];
def posStrike = levels[zeroCrossIdx + 1];
def zeroGamma = posStrike - ((posStrike - negStrike) * posGamma / (posGamma - negGamma));

# Plot
plot ChartGamma = totalGamma / 1000000; # Gamma Exposure in millions for XOM
ChartGamma.SetPaintingStrategy(PaintingStrategy.LINE);
ChartGamma.SetLineWeight(2);
ChartGamma.SetDefaultColor(Color.CYAN);
AddVerticalLine(close, "XOM Spot", Color.RED);

# End of Script
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
313 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top