input DOE = 20191122;
def OI = open_interest(GetATMOption(GetUnderlyingSymbol(), DOE, OptionClass.CALL), period = AggregationPeriod.DAY);
def Vol = volume(GetATMOption(GetUnderlyingSymbol(), DOE, OptionClass.CALL), period = AggregationPeriod.MIN);
plot scan = Vol > 2 * OI;
Cindy Faber TOS: Select one of the custom watchlist columns and replace code in it with this. Then open option chain and select your new custom column's name as an option chain column.
IMPORTANT REMINDER: per industry regulation OI is updated only once/day, a few hours after market close.
#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain
plot OI_NetChg = open_interest() - open_interest()[1];
OI_NetChg.SetDefaultColor(color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
else if OI_NetChg < 0
then color.RED
else color.GRAY);
Or a more space efficient version:
def OI_NetChg = open_interest() - open_interest()[1];
AddLabel(yes, Round(OI_NetChg, 0), color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
else if OI_NetChg < 0
then color.RED
else color.GRAY);
here is another way to use one of your custom columns to create an option chain column:
#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain. It is blank if volume is lower than open_interest allowing it to act as an alert by only appearing when volume is higher than open_interest
def alert = volume > open_interest;
AddLabel(yes, if alert then "volume vs OI" else ".", color.BLACK);
AssignBackgroundColor(if alert == 1 then color.RED else color.LIGHT_GRAY);
is there a possibility of writing a Scan code of peramenter
[ today's volume>open interest by 200% and with days to expire of less than 180 and 50% or more traded on the offer ]
you can possibly do this from a chart, but not from the scanner as TOS doesnt allow the using of custom scripts to scan against options related data. However the study would be long tedious and complex code and the fact it hasnt been even remotely done yet (or at least not publicly) makes it a large task to accomplish as you would have define the entire option chain for the instrument. In reality you are pretty much stuck with whatever parameters TOS provides you with in the default option hacker scanner parameters. And last but not least there is no way for tos to scan against if the transaction was on the bid or ask.is there a possibility of writing a Scan code of peramenter
[ today's volume>open interest by 200% and with days to expire of less than 180 and 50% or more traded on the offer ]
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | Capture Option Chain Data via Thinkscript | Questions | 3 | |
R | Pull full order book into thinkscript | Questions | 2 | |
S | Ford Equity Research Bands In ThinkScript | Questions | 27 | |
N | Thinkscript - Stop trading after first loss | Questions | 3 | |
T | ThinkScript strategy orders seem off | Questions | 5 |