Trying to plot Max Pain and Strike Price



I love this site and I just found it today; so much to watch. I searched through the forums for a few hours but haven’t been able to find anything about Maximum Pain.

I have been trying to calculate Max Pain in Thinkorswim but can’t figure it out. I know the logic I want to use (I’m familiar with some scripting). I’m sure you know what Maximum Pain is; here is what I’m trying to do:

create a strike price  2 dimensional array with strikeprice and cashvalue options

for each open option:

set cashvalue = strike price * open interest

if the strike doesn’t exist in the array, add the strike and cashvalue

else for that strike set the cashvalue column to the current value + cashvalue

plot MaxPain = strike price with the lowest cashvalue that isn’t zero

plot StrikePrice = the strike price for any options contracts I’m currently in

I know that will just create a line at the current Maximum Pain value; which is what I want.

I’ve attached an example that I’m currently using where the max pain and my strike price are inputs I update manually.

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on November 24, 2021 8:10 pm
Private answer

The only good news I have for you is that you can stop spending any more time trying to get this to work on Thinkorswim. Along with that you no longer need to spend any more time trying to find someone who has figured this out for Thinkorswim.

Why? Because it is totally impossible to do this on Thinkorswim given it's current suite of programming tools. We cannot even get close. There are no custom arrays in Thinkorswim and there is no way to write code for Thinkorswim that is able to loop through a set of strike prices, check which ones exist and assemble a list of available strike prices.

I could go on to describe the many other limitations that make this completely impossible for Thinkorswim, but until we can accomplish those two simple things none of the other hurdles are worth discussing.

Looking for trading platforms that just might be able to pull this off?

  • TradeStation
  • NinjaTrader
  • Sierra Chart
  • Esignal

I know some folks will be tempted to ask for a solution built for one of those platforms so I will provide that answer now. An indicator of this type is extremely expensive to build. If you find one that is already built and available for another platform you should expect to pay several hundred dollars for this. If you wanted to hire someone to build this from scratch it would cost several thousand dollars.

Solutions of this type are light-years beyond the scope of solutions we can provide free of charge in this forum.

Marked as spam
Posted by (Questions: 39, Answers: 3752)
Answered on November 25, 2021 8:27 am
Thank you very much. I've spent several dozen hours over the last couple of weeks trying to figure it out. It's nice to know it won't work so I don't waste any more time. I appreciate you taking the time to answer my question.
( at November 25, 2021 8:37 am)