# What's OPT_EXP in ThinkScript?

#### BenTen

Staff member
Staff
VIP
I was playing around with different AggregationPeriod in thinkscript, and I saw an option that says, "OPT_EXP." According to this reference page, this is what it does:

Defines aggregation period equal to option expiration (2,678,400,000 milliseconds)...This example script draws the Close price plot with aggregation period equal to option expiration. Note that aggregation period used in this example cannot be less than chart aggregation period.

Anyone have experience with this aggregation period?

I was playing around with different AggregationPeriod in thinkscript, and I saw an option that says, "OPT_EXP." According to this reference page, this is what it does:

Anyone have experience with this aggregation period?

@BenTen Seems like that is similar to around a month, so if I were to guess, perhaps one uses that for monthly expirations
Run the following study for some interesting numbers

Code:
``````input agg0  = aggregationPeriod.OPT_EXP;
input agg1  = aggregationPeriod.FOUR_HOURS;
input agg2  = aggregationPeriod.TWO_HOURS;
input agg3  = aggregationPeriod.HOUR;
input agg4  = aggregationPeriod.MONTH;

AddLabel(1, "Agg0: " + (agg0/1000/60)+ " min", Color.White);
AddLabel(1, "Agg1: " + (agg1/1000/60)+ " min", Color.White);
AddLabel(1, "Agg2: " + (agg2/1000/60)+ " min", Color.White);
AddLabel(1, "Agg3: " + (agg3/1000/60)+ " min", Color.White);
AddLabel(1, "Agg4: " + (agg4/1000/60)+ " min", Color.White);``````

Thanks @tomsk. Will take a look at that script.

Thanks @tomsk. Will take a look at that script.

Compare the numbers returned for MONTH and OPT_EXP, they are real close

@BenTen As a follow up I found an application where the OPT_EXP is used.
It is a study I obtained from the lounge several years ago called EPS and P/E Label.
Run this on aggregations of DAILY and above, i.e. WEEK, MONTH, etc
Hope this helps you

Code:
``````# EPS Label
# TSL/2016

declare zerobase;

def div = if GetAggregationPeriod() == AggregationPeriod.DAY then 272
else if GetAggregationPeriod() == AggregationPeriod.WEEK then 54
else if GetAggregationPeriod() == AggregationPeriod.MONTH then 13
else if GetAggregationPeriod() == AggregationPeriod.OPT_EXP then 13
else 1;

def AE = if IsNaN(GetActualEarnings()) then 0 else GetActualEarnings();
def EPS_TTM = if IsNaN(close) then Double.NaN else Sum(AE, div);

AddLabel(yes, "EPS: " + AsText(EPS_TTM, NumberFormat.DOLLAR), if EPS_TTM < 0 then Color.RED else Color.GREEN);``````

Last edited:
@tomsk It certainly did. I think both monthly and OPT_EXP are similar, like you suggested.

87k+ Posts
658 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?