Since you have requested a custom watchlist column solution, I had to move your question out of the "Chart Studies" topic and into the "Watch Lists" topic.
In Thinkscript, we have a built-in function named GetUnderlyingSymbol(). Details here:
https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Option-Related/GetUnderlyingSymbol
We can use that to get the underlying symbol of an option contract. Within the option chain we do that with the following line of code:
plot data = close(GetUnderlyingSymbol());
You can add that to a custom column in your option chain to verify that it gives the correct value. From there it's pretty simple to convert that into a value you can use in your own code:
def askPrice = close(priceType = “ASK”);
def bidPrice = close(priceType = “BID”);
def stockPrice = close(GetUnderlyingSymbol());
plot spreadPercent = 100 * (askPrice - bidPrice) / stockPrice;
Notice I have cleaned up the code a bit. When you do not include spaces between variables and operators it makes it very difficult to read. And more importantly, will often cause websites to break the code as it will consider some of those characters to be treated as HTML tags. And.... I got rid of the AddLabel() statement and replaced it with a simple plot statement.
For those interested in applying this solution. The time frame must be set to an intraday time frame and this only works within the option chain columns of the Trade tab on Thinkorswim. This will not work as a chart study or within a watchlist gadget.
Oh, and all the value will display as 0.0 using your original code. So I am multiplying the value by 100 to convert it into a percent value.