ThinkOrSwim Code: Covered Call 2.0

This is custom code for the ThinkOrSwim Platform to calculate covered calls yields:

Direct Import Link: http://tos.mx/!dAw4MD3H

ThinkScript Code

# Monthly % return on stock from selling this option (uses last trade price)
# Adjustable Days Till Expiration (DTE) input

def DTE = GetDaysToExpiration()+1;  # manually set days until this option expires

def stock   = close(GetUnderlyingSymbol());  # underlying stock price
def premium = bid();                        # last traded option price

# Remove intrinsic value from call premium (only count extrinsic)
def intrinsic = Max(stock - GetStrike(), 0);
def extrinsic = Max(premium - intrinsic, 0);

plot MonthlyReturn =
    if stock != 0 and DTE > 0
    then (extrinsic / stock) * (30.0 / DTE) * 100
    else Double.NaN;