What's OPT_EXP in ThinkScript?

BenTen

BenTen

Administrative
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?
 
T

tomsk

Well-known member
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:



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);
 
BenTen

BenTen

Administrative
Staff
VIP
Thanks @tomsk. Will take a look at that script.
 
T

tomsk

Well-known member
VIP
@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 hide_on_intraday;
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:
BenTen

BenTen

Administrative
Staff
VIP
@tomsk It certainly did. I think both monthly and OPT_EXP are similar, like you suggested.
 

Similar threads

Top