Option Delta Diff from Max delta for the day and current

sam147

New member
Hi All,

I am trying to create a study for Options Delta change from Max delta for the day. I have written the code which works well on lower Chart but when i create it as a watchlist column with same code its shows wrong info. Any idea what i am doing wrong?

Some of the Symbols for your test:
.DASH210827C190
.GOOGL210827C2780
.PENN210827C70


Code in Lower Study: ( Daily 3 Minute Chart )
Ruby:
Code in Lower Study: ( Daily 3 Minute Chart )

##
# Find Max Delta and substract to find out Delta Max Change
#

declare lower;
def epsilon = 0.01 * close(GetUnderlyingSymbol());
def delta = (OptionPrice(underlyingPrice = close(GetUnderlyingSymbol()) + epsilon) - OptionPrice()) / epsilon;

#Find Highest Delta
def highdelta = if barnumber() == 1 then delta[0]

else if delta[0] > highdelta[1]

then delta[0]

else highdelta[1];
#def highdelta= if Highest(delta,length) > delta[0] then Highest(delta,length) else delta;

def Flag= if delta[1] > delta[0] then 0 else 1;

plot DeltaDiff = AbsValue(highdelta-delta[0])*100;

DeltaDiff.AssignValueColor(if Flag==1 then Color.GREEN else Color.RED);

AddLabel(YES,"DeltaChange="+ DeltaDiff ,(if Flag == 0 then Color.red else color.green));




Code in Watchlist with 3 minute Aggregation:

##
#declare lower;
def epsilon = 0.01 * close(GetUnderlyingSymbol());
def delta = (OptionPrice(underlyingPrice = close(GetUnderlyingSymbol()) + epsilon) - OptionPrice()) / epsilon;

#Find Highest Delta
def highdelta = if barnumber() == 1 then delta[0]

else if delta[0] > highdelta[1]

then delta[0]

else highdelta[1];
#def highdelta= if Highest(delta,length) > delta[0] then Highest(delta,length) else delta;

#def Flag= if highdelta[0] > delta[0] then 0 else 1;

plot DeltaDiff = AbsValue(highdelta[0]-delta[0])*100;

#AddLabel(yes,+ DeltaDiff , Color.RED);

AddLabel(Yes,+DeltaDiff,(if DeltaDiff > 2 and DeltaDiff < 5 then color.green else if DeltaDiff >=5 and DeltaDiff <=10 then color.yellow else if DeltaDiff >=11 then color.red else color.white));

#AddLabel(yes, Close_going_up ,color.green);



Any help will be appricaited.
 
Last edited:
Hi All,

I am trying to create a study for Options Delta change from Max delta for the day. I have written the code which works well on lower Chart but when i create it as a watchlist column with same code its shows wrong info. Any idea what i am doing wrong?

Some of the Symbols for your test:
.DASH210827C190
.GOOGL210827C2780
.PENN210827C70


Code in Lower Study: ( Daily 3 Minute Chart )

##
# Find Max Delta and substract to find out Delta Max Change
#

declare lower;
def epsilon = 0.01 * close(GetUnderlyingSymbol());
def delta = (OptionPrice(underlyingPrice = close(GetUnderlyingSymbol()) + epsilon) - OptionPrice()) / epsilon;

#Find Highest Delta
def highdelta = if barnumber() == 1 then delta[0]

else if delta[0] > highdelta[1]

then delta[0]

else highdelta[1];
#def highdelta= if Highest(delta,length) > delta[0] then Highest(delta,length) else delta;

def Flag= if delta[1] > delta[0] then 0 else 1;

plot DeltaDiff = AbsValue(highdelta-delta[0])*100;

DeltaDiff.AssignValueColor(if Flag==1 then Color.GREEN else Color.RED);

AddLabel(YES,"DeltaChange="+ DeltaDiff ,(if Flag == 0 then Color.red else color.green));




Code in Watchlist with 3 minute Aggregation:

##
declare lower;
def epsilon = 0.01 * close(GetUnderlyingSymbol());
def delta = (OptionPrice(underlyingPrice = close(GetUnderlyingSymbol()) + epsilon) - OptionPrice()) / epsilon;

#Find Highest Delta
def highdelta = if barnumber() == 1 then delta[0]

else if delta[0] > highdelta[1]

then delta[0]

else highdelta[1];
#def highdelta= if Highest(delta,length) > delta[0] then Highest(delta,length) else delta;

#def Flag= if highdelta[0] > delta[0] then 0 else 1;

plot DeltaDiff = AbsValue(highdelta[0]-delta[0])*100;

#AddLabel(yes,+ DeltaDiff , Color.RED);

AddLabel(Yes,+DeltaDiff,(if DeltaDiff > 2 and DeltaDiff < 5 then color.green else if DeltaDiff >=5 and DeltaDiff <=10 then color.yellow else if DeltaDiff >=11 then color.red else color.white));

#AddLabel(yes, Close_going_up ,color.green);


Any help will be appricaited.
I think whenever you need to scan in watchlist don't used word plot and used DEF
change it and try it if it works.
 
is your watchlist just a list of option symbols , not stocks?

column studies use just 1 function for output. 1 plot OR 1 addlabel.
you have 2 of each. you need to disable 3 of them.
then determine if you can combine you formulas and display your desired data in 1 addlabel. or make another study for another column.
( i guessed addlabel will work for you, because it can display text and numbers)

in a column, the addlabel color will be the font color.
to change the background color of the cell, use AssignBackgroundColor
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AssignBackgroundColor
hal_col
 
Last edited:
yes my Watchlists are only Options... My watchlist code has only one plot and one label others twos are actually commented. I will try to experiment little bit more and see if it works..
 
Last edited:
yes my Watchlists are only Options... My watchlist code has only one plot and one label others twos are actually commented. I will try to experiment little bit more and see if it works..
I am speaking from memory. Studies and things that are normally possible on non-options are sometimes not possible on options themselves. I will need to check my references.

For example. I changed your script to plot the epsilon value that merely uses the underlying price. I could not see that value posted on the watchlist, where as it works for regular equity. Please see if that helps.
 
Last edited:

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