Rough cut of TOS SCAN sorted by Extrinsic % of underlying

garyw

Active member
This is a simple/rough clip relating to Tim's query of TOS SCAN using Extrinsic % of underlying.




The snip of thinkscript in the clip should be modified as shown below: To reflect the option MID (current mid) instead of the close.
1599660140192.png
 
Last edited:

garyw

Active member
Sorry! I mistakenly thought I could post there for free. Unable to post the clip in Aeromir (complained that the 5MB size was too great), so was looking for a way to post it.
Try this one:

You may need to download, then play it.

If anyone has a recommendation for a location to post such things for free, let me know.
 

status1

Active member
I tried to type it in but it comes up with a lot of syntax errors
Was that written in some other language ? Think script doesn't seem to like it It says invalid statement for the first line
Although I must admit I am no expert in think script
It's not that important to me but hopefully Tim can figure it out
 

garyw

Active member
This may be easier to read, but is identical functionality.
FYI: ThinkScript is not the most intuitive syntax and is not a programming language, but can be coerced into providing useful functionality.

# Create Metric of Extrinsic as % of underlying
def strike= getStrike();
def put = isPut();
def EquityPrice = close(getunderlyingSymbol());
def optionPrice=(bid+ask)/2;
def intrinsic= if put then strike - EquityPrice else EquityPrice - strike;
def extrinsic = if intrinsic <= 0 then optionPrice else optionPrice - intrinsic;
plot ExtrinsicDivEquity=100*(extrinsic/EquityPrice);
 

Tim

Member
Staff member
Yes we did talk about it. I think Tom just hasnt got the recording posted.

meanwhile i continue to improve it with Gary. We have something now that makes it easier to rank possible trades. I will talk about it more next Thursday.
 

lvj trader

New member
Gary/Tim,
Can you to post the Thinkscript for the last column used to create the scan for - ITM_CC_Weighting, in this forum please.
1- I've created and added the column (from your notes above) to calculate the %ExtoftheStock column.
2- Now I am ready for the code to create the last column to combine the %ITM and %Extrinsic to come up with a value for ITM_CC_Weighting.
Men, this has been a learning experience, but if I can get this last column setup, I'll have the scan you showed thursday. I like it!
thank you both
 

garyw

Active member
FYI: Those additional columns are there for "moral support" to allow you to gain confidence of what you are looking at and therefore are handy until you get accustomed with the column used for sorting/grading. If Tim provides you something, you should use his instead of mine! (I am here to merely assist, not drive)
Here is what I have for that %ITM column:
----------------------------------------
def strike = GetStrike();
def EquityPrice = close(GetUnderlyingSymbol());
def ITMPercent=100*((EquityPrice/strike)-1);
plot ITMamount = ITMPercent;
--------------------------------------
For the %Ext col:
--------------------------------------
# Create Metric of Extrinsic as % of underlying
def strike= getStrike();
def put = isPut();
def EquityPrice = close(getunderlyingSymbol());
def optionPrice=(bid+ask)/2;
def intrinsic= if put then strike - EquityPrice else EquityPrice - strike;
def extrinsic = if intrinsic <= 0 then optionPrice else optionPrice - intrinsic;
plot ExtrinsicDivEquity=100*(extrinsic/EquityPrice);
---------------------------------------
And finally the one that combines both for the sort/qualification:
---------------------------------------
# Create Qualified Metric of Extrinsic as % of underlying
# Value is -1 if unqualified
input MinITM=5.0;
input MinExt=4.0;
def strike = GetStrike();
def put = IsPut();
def EquityPrice = close(GetUnderlyingSymbol());
def optionPrice = (bid + ask) / 2;
def intrinsic = if put then strike - EquityPrice else EquityPrice - strike;
def extrinsic = if intrinsic <= 0 then optionPrice else optionPrice - intrinsic;
def ExtPercent = 100 * (extrinsic / EquityPrice);
def ITMPercent=100*((EquityPrice/strike)-1);
def Pass=ExtPercent >= MinExt and ITMPercent>=MinITM;
plot Metric=if Pass then ExtPercent+ITMPercent else -1; # Equal weighting to ext% and ITM%?
-----------------------------------------------------

However, as mentioned above: Tim is actively using and may be improving it, so if he provides something, use his instead as his the "golden one"
 

Tim

Member
Staff member
This is the most current code. Easy to modify the last line of the last one, that allows us to sort/qualify above to do weighting, like this:

plot Metric=if Pass then ExtPercent * .7 + ITMPercent * .3 else -1;

But, in my testing, it doesnt make a material difference and I think both are important so equal weighting works just fine
 
Top