Can Thinkscript track the mark price of an option?

thetabrent

New member
Hello All...long time coder but brand new to ThinkScript :)

After doing some research and playing around a bunch, it's unclear if it's even possible to do what I want, so I thought I'd post here and let the experts offer their thoughts!

Here's what I want to do:

I'm using a variation of the iron condor, and the strategy involves selling options and continuously checking the mark price of an option, and taking action if the increase in value mark exceeds 4x the premium collected. It's easy enough to do this manually by looking in the mark column on the Monitor screen, but I'd love to find a way to put that number (current mark/premium) on the screen to make it much easier to manage.

As an example, let's say I'm trading SPY and the market price is 620, and I'm selling a CALL at 630 and receiving a premium of $0.05. What I want the study to do is divide the current mark by the original premium, and put that number on the screen. As SPY rises, that CALL option becomes more and more valuable; in this example, it might be that SPY rises to 625, and mark on the option goes up to $0.20; I'd want to put "4x" on the screen (since the original premium of $.05 multiplied by 4 = $.20).

Is this even possible?

From what I understand, it is not possible to iterate through open positions in ThinkScript. However this strategy is extremely low volume (usually just the two sides of the iron condor plus stop losses), so it is acceptable (though not desirable!) to manually code both the premiums collected and the strike prices of the CALL and PUT each day before running the script. Is this workable?

My thought would be that maybe if we start with the GetOptionATM and then GetNextITMOpen,, we can find the option (the one we sold) by checking the strike price against what is manually coded in? But I hope there an easier way!?

And then maybe use something like this to get the current mark for that option?
input priceType = PriceType.MARK; plot MarkPrice = close(priceType = priceType);

Obviously we would have to do this twice, once for the call side and once for the put side.

Hope that makes sense...please ask if there's more info I can provide here! :)

thanks so much for your help...

-Brent
 
Last edited by a moderator:
Solution
This should at least help you get started.

Ruby:
declare lower;

input Sym = ".SPY250729C637";
input Prm = 0.25;

plot M = close(Sym, priceType = PriceType.MARK);
plot A = close(Sym, priceType = PriceType.ASK);
plot B = close(Sym, priceType = PriceType.BID);

def Ratio = M / Prm;

addchartBubble(!(barnumber() % 3),M,
    "Mark: " + M + "\n" +
    "Prrm: " + Prm + "\n" +
    "Mult: " + Ratio
,color.white);

oqJC4Ml.png
This should at least help you get started.

Ruby:
declare lower;

input Sym = ".SPY250729C637";
input Prm = 0.25;

plot M = close(Sym, priceType = PriceType.MARK);
plot A = close(Sym, priceType = PriceType.ASK);
plot B = close(Sym, priceType = PriceType.BID);

def Ratio = M / Prm;

addchartBubble(!(barnumber() % 3),M,
    "Mark: " + M + "\n" +
    "Prrm: " + Prm + "\n" +
    "Mult: " + Ratio
,color.white);

oqJC4Ml.png
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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