Can anyone infer how NextSignals is coding these indicators

Glefdar

Active member
Link:
enPXbCH.png


One of the replies says that calls sold vs. bought and puts sold vs. bought is determined as follows:

Determined by the option positions Greeks. Gamma is positive for both long calls and long puts, negative for the opposite. long a call and short puts positive Short calls and long puts negative Would help to understand color and charm’s effect too.

I could be wrong but I am guessing this must be a chart of a single strike level, and the "Calls" lower study is using the call for that strike as the data source and the "Puts" lower study is using the put for that strike as the data source. But it's not clear to me how gamma is being used to disambiguate volumes of contracts sold vs. bought in that case. Maybe someone has a better understanding of what he's doing?
 
I was wondering the same thing and am honestly kind of skeptical about how accurate that indicator could really be given what data is available to work with in thinkscript.

That response that the buys/sells are determined by the option's greeks does not make sense to me. From an outsider perspective, AFAIK, a contract has the same greeks whether it was bought or sold. But maybe there is something I fundamentally don't understand.

My best guess would be that he is somehow combining large transactions in the options market with price movement in the underlying to infer whether a trade was a buy/sell but that is a shot in the dark.

On a side note, I attempted to recreate a different indicator of his that gives the total premium traded for the front month OPEX during each aggregation period. I eventually hit a wall here and gave up, but I think it might be kind of close.

As seen in below image, many bars are plotting identical premium amounts which is obviously not right, on top of that I can only get the histogram to plot on a SPY chart with extended trading hours turned off. (even though i'm trying to plot SPX premiums, they wont show up on SPX or /ES chart for example)

jWhd9tJ.png


Here is the script in case someone better at thinkscript than me wants to troubleshoot and fix it.

This is what I have for Calls (Put script is identical with 'OptionClass.CALL' swapped out to '.PUT'

Code:
declare lower;
input symbol = "SPX";
def series = 1;
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());
def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstFridayDOM1 = if Day1DOW1 < 6
                          then 6 - Day1DOW1
                          else if Day1DOW1 == 6
                          then 7
                          else 6;
def RollDOM = FirstFridayDOM1 + 14;
def ExpMonth1 = if RollDOM > CurrentDOM
                    then CurrentMonth + series - 1
                    else CurrentMonth + series;
def ExpMonth2 = if ExpMonth1 > 12
                    then ExpMonth1 - 12
                    else ExpMonth1;
def ExpYear = if ExpMonth1 > 12
                  then CurrentYear + 1
                  else CurrentYear;
def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);
def FirstFridayDOM = if Day1DOW < 6
                         then 6 - Day1DOW
                         else if Day1DOW == 6
                         then 7
                         else 6;
def ExpDOM = FirstFridayDOM + 14;
def date = ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM + 1;
def Premium = if IsNaN(volume(symbol = GetATMOption(symbol, date, OptionClass.CALL)) * (close(symbol = GetATMOption(symbol, date, OptionClass.CALL)) * 100))
                     then Premium[1]
                     else (volume(symbol = GetATMOption(symbol, date, OptionClass.CALL)) * (close(symbol = GetATMOption(symbol, date, OptionClass.CALL)) * 100));
def CallTotal = Premium;
AddLabel(yes, symbol + " " + ExpMonth2 + "/" + ExpDOM + " Call Premiums: " +  CallTotal, Color.GREEN);

plot calls = if IsNaN(close) then Double.NaN else CallTotal;
calls.AssignValueColor(Color.GREEN);
calls.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
# End Study

Anyways, sorry for long post but I'm interested as well, I've tried DMing him in the past with no response so gave up on that route.
 
Seems like the calcs are running separately for calls and puts. So first he's identifying the type of option, then by looking at the underlying greeks he can tell if the flow is a SELL or a BUY order (using gamma). From there, once he has the above done for both of them, he combines the net premium effect for the price series in the main chart (the red and green bars).
 
Anyone have any idea on how to code something like the option volume inidcator here:


FupONGWWIAAWGmb?format=jpg&name=large.jpg


I am not sure how he is able to get all the volume from each of the strike prices on an indicator for the expiration date.

If anyone knows the code to do so I would appreciate it! I assume it would be similar to the get ATM option code (but modified for volume):

plot AprilATMPutPrice = close(GetATMOption(GetUnderlyingSymbol(), 20120421, OptionClass.PUT));

This is from Thinkscript tutorial.

Thanks
 
Anyone have any idea on how to code something like the option volume inidcator here:


FupONGWWIAAWGmb?format=jpg&name=large.jpg


I am not sure how he is able to get all the volume from each of the strike prices on an indicator for the expiration date.

If anyone knows the code to do so I would appreciate it! I assume it would be similar to the get ATM option code (but modified for volume):

plot AprilATMPutPrice = close(GetATMOption(GetUnderlyingSymbol(), 20120421, OptionClass.PUT));

This is from Thinkscript tutorial.

Thanks

here is a massive study that shows open interest for many strikes. it could be changed to read volume.
https://usethinkscript.com/threads/option-heatmap-and-oi-strikes-for-thinkorswim.10664/
 
I've been trying to build something like this but am quite stuck. Anyone have something like this?
You would have to build an API for Thinkscript's intereface. You can't get individual Put/Call bid or ask prints from the Thinkscript function calls in TOS. Yes, the time and sales should be able to give you this, but it doesn't. You can't break apart the buy/sell data with just Thinkscript, but I think the API will let you pull the data if you build it for something else.
 
Seems like the calcs are running separately for calls and puts. So first he's identifying the type of option, then by looking at the underlying greeks he can tell if the flow is a SELL or a BUY order (using gamma). From there, once he has the above done for both of them, he combines the net premium effect for the price series in the main chart (the red and green bars).
TOS data doesn't tell you which (unless you can pull it out using an API). So the only way to guess from gamma if it is a buy/sell is by watching what the price does (which will usually go in the opposite direction of the Put or Call Volume as they hedge the other side of the transaction.
 
Link:
View attachment 18456

One of the replies says that calls sold vs. bought and puts sold vs. bought is determined as follows:



I could be wrong but I am guessing this must be a chart of a single strike level, and the "Calls" lower study is using the call for that strike as the data source and the "Puts" lower study is using the put for that strike as the data source. But it's not clear to me how gamma is being used to disambiguate volumes of contracts sold vs. bought in that case. Maybe someone has a better understanding of what he's doing?
In my view and experience (4 years studying Gex) each strike has both an "up" gamma and "down" gamma which results in a calculated positive or negative Exposure for that strike (GEX).

It would appear he has found a platform that will easily map and print (chart) those zones where the Gamma changes from + to - and vice versa clearly. Add that to the volume of the sales and you can see where institutions want to place their hedges and structure the market accordingly. I have done something similar on TOS but it's not nearly as clear as this. We have attempted to coax Dr. Harlin into sharing some of his research, but he simply does not wish to claiming "it's his life's work." Anyhow, this is the best example I have seen from him that quantifies directional Gamma changes as it happens.

The main relationship is to the Gamma P&L function from what I can tell, and the High Gex and low Gex P&L at a specific strike will tell you where the MMs intend to lay their orders off and hedge to go the other way. The best use is intraday swing trading on SPX for returns of up to 34x on good volatile days (up or down), 1x-5x on normal days non-compounded.
 
Saw this post & a search yielded me no results for any sort of Options Vanna indicator...curious if anybody here could tackle it based on the post. Intrigued at the potential for leveraging this as a strategy...


He then also made a reply that stated "I coded the vanna Thinkscript from the formula, below. It's not that hard." but I feel like I'm just going to screw up translating the formula haha...
1695505167163.png
 
I am not completely certain yet, but this should be the direct translation of the zero dividends Vanna formula shown. I am having trouble locating examples for a good comparison.

Code:
def Under =
    Close(GetunderlyingSymbol());
def Strike =
    GetStrike();
def DTE =
    GetDaysToExpiration() / 365;
def Rate =
    GetInterestRate() * 0.01;
def Div =
    if !isNaN(GetDividend()) then GetDividend()
    else Div[1];
def Yield =
    if Div then Div / Under
    else 0;
def IV =
    Imp_Volatility(GetUnderlyingSymbol());
def Pi =
    Double.Pi; #3.14
def e =
    2.718281828; #Euler's number (sort of like Pi)
def D1 =
    (Log(Under/Strike) + (rate - yield + (Power(IV,2) / 2)) * DTE) / (IV * Sqrt(DTE));
def N1D1 =
    power(e,-(power(D1,2)/2)) * (1 / (2 * Pi));
def Van =
    SqRt(DTE) * N1D1 * (1 - D1); #assumes 0 dividend

plot Vanna = Van * -1;

Edit: Further decimalized the interest rate, inverted the plot (still not sure why), found an example with a chart that TOS would actually load.

CJuuYfA.png
 
Last edited:
He put 2 indicators without values are normalized on the lower section which resulted in a percent y-axis. If you scroll the chart, points he is highlighting is not going to line up the same. There is nothing there.
 

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
318 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