This is an updated Tradestation Equity Curve for my Dual Moving Average System (again not a crossover!). Thankfully I never traded to it. And yes the all-time peak (Aug 2018) was when this was developed. This is one of big concerns with data mining to try and find biases. Very difficult to know when you have found something and when it's just spurious! This is why I asked "if you now revisited the analysis trying to improve your states (switch earlier or later) do you feel that you would have introduced a bias?"

Can you help answer these questions from other members on futures io?

I'm trying to avoid biases. most of my thinking about possible trading strategies is how to integrate them into the VBA logic. Presumably some version of the state analysis I've been discussing would be used by the investment/trading routine.

It is pretty clear that buys should be done in the below state at some point and sells in the above. It seems obvious that the buy can wait to take advantage of the seemingly inevitable further deterioration of the indicator, but then there is the possibility of missing a move. I imagine virtually all one day trades in the below state are profitable, I meant to check that out today, the tables I posted here were originally an attempt to look at that but I got distracted by how cool they seemed to be.

Selling when an above state transitions to below appears to be wrong, certainly too late.

"The exponentially weighted moving average (EWMA) introduces lambda, which is called the smoothing parameter. Lambda must be less than one. Under that condition, instead of equal weights, each squared return is weighted by a multiplier..."

That looks better than my feeble attempts, I unknowingly reinvented a weighting method a few months ago that is used by Martin Pring in one of his K studies, maybe Mr. Pring has special insight but I concluded it was worthless.

Hi @semiopen finally got around to reading your posts in detail.

While I found it very interesting I'm actually a little confused what the pivot tables show. For example

So what does the pivot table show? I understand how the states work but is it one single indicator with one single time period (13?) or is it all 4 indicators with one single time period (13?) or am I completely misinterpreting "Condition 13L"

I recently did something similar in R but a lot larger, and only focused on next day returns not the total return until the state changes. I took about 30 conditions, some were price related, some volatility, some range, each having a True(1) or False(0) flag. I then combined the conditions in every single possible pair combination. So 30*2*29*2 = approximately 3500 different state combinations. For example One Pair would be Condition 1 False and Condition 19 True which might equate to Price Not Above SMA and Volatility High. I then ranked all possible pairs to see which performed best (potential buy) and worse (potential sale) and also applied some other filters (min number occurrences etc). I did this 4 months in a row, for 4 different symbols, picking pairs that historically did well. I then used the results to develop 4 systems that I then entered into a four 6 month 'incubation' competitions. Obviously I know this was some extreme data mining but was curious how they would perform. The first system is now 4.5 months in and after a few good weeks has turned negative. The second system is 3.5 months in and every single trade has been a loss. The third system is 1.5 months in and was up until a bad trade last week. The fourth system is 0.5 months in and has been stopped out on all 3 trades. So extremely ugly. Data mining at it's extreme worse.

With regards to EWMAs, you might want to also look at Adaptive Moving Averages. If you want to get really technical take a look at Digital Signal Processing. An EWMA is basically a Single Pole Low Pass Filter in DSP.

The following user says Thank You to SMCJB for this post:

13L is a 13 day least square moving average. I'm changing the naming convention to L13. Both states are combined in the chart so it show the results of buy and hold in addition to the other two investment styles.

I was kind of thinking of drawing random lines as opposed to other indicators. Then the idea is to see how far back in time the line has to go to equalize returns between above and below that line.

This is a report i just created. It shows major ETFs and the current status of 6 rate of change strategies - R03 is the 3 period rate of change. R03P shows the number of days the current state has been active and R03R is the profit as a percent from the start of the state. If the state is above zero, R03P (or other P column) is positive; if it is below zero it will be negative.

This one is current state of exponential moving averages. Notice all XLV averages turned positive today. Unfortunately XLV doesn't play above the line real well.