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:
My first step was to try and build a Stochastic Parameter:
Goal: Approximate a stochastic process that:
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
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.
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: