Methodology

State Transition Analysis

Price Detail

The number of indicators analyzed has grown to 32 from 16. The naming convention is in a state of flux at the moment, currently the period is first and the letter designating the type of indicator follows. The reasoning for this will be discussed below.

The four types of indicators analyzed are:

  • L = Least Square Moving Average
  • M = Simple Moving Average
  • R = Rate of Change
  • E = Exponential Moving Average

The eight lengths remains the same Friedmanacci sequence: 3,7,13,21,31,43,57, and 73. The moving average calculation has been changed to (CloseX – Mx(xw)) / Mx(xw) * 100 from (CloseX – Mx(xw)) / CloseX) * 100, this makes no difference for above/below determinations as that is determined from the difference.

Number of States

The program logic will handle any number of states, but that is currently constrained to 256. The current program looks at an 8 element array that defines the columns to consider. Since each element can be in 1 of 2 possible states: 2 to the 8th power = 256. Generally, the most positive combination (all above zero) for a stock will have the largest number of periods, and the most negative combination (all below zero) will have the second most.

As a practical matter, I’ve been analyzing 1 column / 2 states, at a time, checking only above or below 0. Logic was developed to look at Up or down in addition to above and below. This adds significant coding complexity for an unclear gain, so at the moment, I only look at above or below.

State Merge

A few new columns were added to this. EntryX1, HighX1, and LowX1 show the status of the given indicator through the state. The idea there is to potentially consider exit and entry strategies different than the state transition.

ETF Summary

This is a copied pivot table with some columns added. The default order now has the various lengths as the major sort field. This might be more useful than having the indicator type first, for example, E03 instead of 03E. Analyzing different indicators with the same length is a reasonable way to look at the numbers. Any of the columns can be sorted, and they each provide interesting insights into price behavior,

Each indicator type has important characteristics. Least square moving average, for example, is notable for having more transition states and . The differences between exponential and simple moving averages are interesting

The column meanings are discussed below:

  • SProf = sum of the profit with a $100,000 fixed amount invested at the start of each trade.
  • HProf = buy and hold profit assuming that $100,000 of the ETF was purchased at the start of the accounting period, which in this case, started on April 19, 2004.
  • AProf = Average profit for the state. All numbers other than HProf are based on a fixed amount.
  • AMax = Average maximum unrealized profit observed.
  • AMin = Average minimum unrealized profit (or loss) observed.
  • ALen = Average length of the state.
  • TLen = Total length of time in the state. Total length of a condition (for example, 03EA and 03EB) is obtained by adding the two TLens together. So this study from January 2017 has total 661 days.
  • CStat = Number of state changes (or number of trades).
  • Win% = Percentage of profitable state changes (trades).
  • APPer = Average profit (or loss) per period (per day in this case).
  • AR0 = Average profit or loss the day of the state change.
  • AR1s = Average profit or loss of the first holding period.
  • AR1e = Average profit or loss during the last day of the holding period.
  • AAtr = Average of the True Range observed during the holding period.
  • AEx1 = Average indicator value at the start of the state. X1 is the column number of the indicator on the detail spreadsheet.
  • AHx1 = Average High of the indicator during the state.
  • ALx1 = Average low of the indicator during the state.
  • Len = the length of the last trade for the state.
  • Prof = Profit from last trade for the state.
  • CX1 = Current reading of the indicator.
  • EX1 = Indicator value when state changed.
  • HX1 = High of indicator observed during state.
  • LX1 = Low of indicator observed during state.
  • Active = Shows “Active” If the state is currently active.

Note: I decided to change the base amount to $10,000 from $100,000. This seems like a better number to use for position sizing. For example, if a given type/condition/state combination seems inferior, $10,000 is a reasonable number to decrease position size and risk, similarly if a combination is favorable, $10,000 can be used to increase position size.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s