Options: Automatically plot price level for strike price of owned option

oretodd

New member
Hello,

I would like to create a study that will automatically plot a "price level" line at the strike price of any options for which I currently hold a position.
For example, if the current symbol is MSFT, and I have one or more PUT options for MSFT, it would plot a price level at the strike price for each of those options. If this is possible, it would also be nice to be able to use different colors based on the expiration date of the option in question.

I've studied the ThinkScript docs and it appears that "GetStrike()" only works when the current symbol is an option. In my case, I'll be looking at a chart for the underlying symbol, and want to see price levels for the strike price of all options I currently hold on that symbol.

Possible?
 
@oretodd There is not automagic way to code what you are describing using Thinkscript... You can use several of the Option related functions to get option symbols and then extrapolate the current option prices, but this is a long drawn out process and quite possibly more work than its worth... Manually entering the strike price into a Study would be easier...

Let me ask you what the purpose of this information would be...??? Is it just the actual strike price or the current option price that you are looking for...???
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hi @rad14733 Thanks for your reply.

I have a large number of various options positions open, and I have a back-end process that keeps a custom watchlist updated that contains all of the underlying stocks for my options positions. I have that watchlist linked to a chart window that shows me the chart for the underlying stock. If I have a credit PUT spread open, for example, I will be short on one option/strike price and long on another. The strike prices are obviously very important for my options strategy, and when I look at the chart, I would like to be able to see at a glance where the strikes of my options positions are.

Since I open and close positions relatively frequently, I don't want to have to manually set those "price level drawings" for each underlying stock. I'd just like them to be shown automatically, or as part of a study that I can attach to the chart window.

Does that make sense?

Thanks again.
 
@oretodd Thanks for the more in-depth explanation... Unfortunately, as I stated previously, Thinkscript does not have the capabilities to do what you are describing... Essentially, we can't extrapolate the active option positions for a specific symbol via Thinkscript... It simply cannot be done because the functions don't exist for accessing that portfolio data... While unfortunate, we have to live within the constraints of the TOS platform... That was why I made the manual entry suggestion even though that would require a chart for every symbol you have option positions open for...
 
Thanks @rad14733 That's a bummer :-(

As for adding those price levels manually: Is there a faster way than using the mouse for entering those price levels? I.e. maybe some kind of shortcut key sequence, and then I just type in the price? This would be much faster than having to use the mouse to find the exact price, etc.
 
Thanks @rad14733 That's a bummer :-(

As for adding those price levels manually: Is there a faster way than using the mouse for entering those price levels? I.e. maybe some kind of shortcut key sequence, and then I just type in the price? This would be much faster than having to use the mouse to find the exact price, etc.
draw a price line anywhere. double click it. type in the price level. ( thats what i do )
 
@oretodd Another method would be to create a Study and use the following... Modify to suit your needs...

Ruby:
input strike1 = 100.25;
input strike2 = 110.50;

plot line1 = strike1;
line1.SetDefaultColor(Color.WHITE);

plot line2 = strike2;
line2.SetDefaultColor(Color.YELLOW);

AddLabel(yes, "Strike1: " + strike1, Color.WHITE);
AddLabel(yes, "Strike2: " + strike2, Color.YELLOW);
 
Last edited:
@oretodd Another method would be to create a Study and use the following... Modify to suit your needs...

Ruby:
input strike1 = 100.25;
input strike2 = 110.50;

plot line1 = strike1;
line1.SetDefaultColor(Color.WHITE);

plot line2 = strike2;
line2.SetDefaultColor(Color.YELLOW);

AddLabel(yes, "Strike1: " + strike1, Color.WHITE);
AddLabel(yes, "Strike2: " + strike2, Color.YELLOW)
[/QUOTE]
 
Hey @rad14733. That's a great idea. Much better than adding them all manually. Thanks! One question though, how can I set the study inputs to stick with a particular symbol, rather than being the same for all symbols? I can see that "drawings" stay with the symbol, but study inputs seem to be global...
 
Last edited:
Hey @rad14733. That's a great idea. Much better than adding them all manually. Thanks! One question though, how can I set the study inputs to stick with a particular symbol, rather than being the same for all symbols? I can see that "drawings" stay with the symbol, but study inputs seem to be global...

you could have several inputs, each defaulted to a different symbol.
then compare them to getsymbol(). if a match, do stuff ,( plot lines). i appended en to the variable name to mean enable.

input sym1 = "SPY";
def sym1en = (sym1 == getsymbol());
plot z = if sym1en then .....

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/GetSymbol

i searched on getsymbol( , and found this post.

https://usethinkscript.com/threads/...e-level-with-horizontal-line.3472/#post-32132
 
you could have several inputs, each defaulted to a different symbol.
then compare them to getsymbol(). if a match, do stuff ,( plot lines). i appended en to the variable name to mean enable.

input sym1 = "SPY";
def sym1en = (sym1 == getsymbol());
plot z = if sym1en then .....

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/GetSymbol

i searched on getsymbol( , and found this post.

https://usethinkscript.com/threads/...e-level-with-horizontal-line.3472/#post-32132

Thanks @rad14733 , that may be the best way to do it. I can create a study that does something like:

AddLabel(yes, GetSymbol());

switch((GetSymbol()){

case "ZM" :
{ plot p_100 = 100;
plot P_207 = 207;
plot P_319 = 319;
plot P_429 = 429; }

case "AAPL":

{ Plot P_100 = 100;
Plot P_250 = 250;
Plot P_275 =275; }

etc.

And whenever I open new positions, I have to go in an edit the study. It's not the cleanest approach, but it might be the only way short of manually adding those price levels for each. The silver lining here is that all the price levels can be defined inside one place (the study script).
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
432 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