Buy Vs Build: Using ThinkOrSwim to Kill subscriptions

Randolph_Nomad

New member
VIP
Good Day all,
I've been a member for a few years, and everytime i use something on this site it teaches me; improving my technical analysis AND learning to read signals.

I decided to give some coding a try. forgive the pseudo program mgr context, but its easier for me to manage the approach this way.

Situation: there are services in the market (MTOptions and OptionRun) that chareg approx $140/mth to provide option signal trades. their records are pretty good, but the method doesn;t appear to be significantly proprietary. it seems to be a blend of the Stochastic forecasting, mean reversion & momentum components, with predictive signals and time based thresholds.
Mission/Goal: Use TOS to duplicate this process, Thus reducing or eliminating 3rd party need to generate cash consistently.
Approach:
  • Build scanner Stochastic Processes
    • Capture Randomness & Probability Weightings for Directional Moves
  • Include Momentum & Mean-Reversion Components
  • Calibrate the Stochastic Process
  • Generate Probability Readings
  • Identify Attractive Option Strikes & Expirations
    • Use one of the 3rd party vendors as a baseline (Parallel test if the toll comes up with similar or identical recommendation)
  • Implement Entry & Exit Criteria
    • Duplicate criteria from 3rd party vendor
  • Combine with Technical & Fundamental Analysis
    • Identify what additional analysis/existing charts can improve confidence in execution of options trade
Execution (in progress): Since TOS cannot perform advanced stochastic differential equations, the approach must be hybrid. leveraging or building TOS studies, using momentum oscillators, mean reversion signals, IV data, and basic probability estimations.
My first step was to try and build a Stochastic Parameter:

Goal: Approximate a stochastic process that:
  • Tracks near-term volatility dynamics (implied or realized).
  • Flags momentum vs. mean-reversion conditions.
  • Outputs a “probability reading” (or score) indicating the likelihood of a near-term run.
here's the code for the study: as I continue, any feedback is greatly appreciated

Code:
declare lower;

# -- 1) Declare inputs as "constant" values for lengths --
input HVLength = 20;       # Historical Volatility lookback
input RSIlength = 14;      # RSI lookback
input BollLength = 20;     # Bollinger (mean-reversion) lookback

# -- 2) Basic Price & Volatility Inputs --
def price = close;

# For HV, we can approximate with the standard deviation of log returns:
def dailyReturn = Log(price / price[1]);
def HV = StDev(dailyReturn, HVLength);
def IV = imp_volatility();  # TOS built-in implied volatility for the underlying

# -- 3) Momentum (RSI) --
# Instead of RSI(price, rsiLen), use RSI(length = RSIlength)
def rsiValue = RSI(length = RSIlength);

# -- 4) Mean-Reversion (Bollinger Z-Score) --
def avgPrice = Average(price, BollLength);
def stDevPrice = StDev(price, BollLength);
def zScore =
    if stDevPrice != 0 then
        (price - avgPrice) / stDevPrice
    else
        0;

# -- 5) Composite Probability-Like Score --
# Momentum Part: normalized RSI
def momentumPart = (rsiValue - 50) / 50;  # -1 (oversold) to +1 (overbought) scale

# Volatility Part: comparing IV and HV
def volPart =
    if IV < HV then
        1  # “Cheap” implied volatility vs realized
    else
        HV / IV;  # If IV > HV, ratio < 1

# Mean-Reversion Part: if zScore < -1, bullish snapback, if > +1, bearish
def mrPart =
    if zScore < -1 then
        1
    else if zScore > 1 then
        -1
    else
        0;

# Weight them (adjust coefficients to taste)
def stochParamRaw = (0.5 * momentumPart) + (0.3 * volPart) + (0.2 * mrPart);

# Convert raw value to 0-100 scale, just for a nicer read
def stochParamScore = Round(50 + 50 * stochParamRaw, 0);

# -- 6) Plot the "StochasticParam" Score --
plot SPScore = stochParamScore;
SPScore.SetDefaultColor(Color.CYAN);
 
Last edited:
  • I'm watching this!
Reactions: sum

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
320 Online
Create Post

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