Thanks for the source, I saw lots of interesting things.
The original article from Cynthia Kase shows that she departed from the concept of the average true range as introduced by Welles Wilder. She probably used the Chandelier Stop, but was not satisfied with the way, how it treated volatility. So instead of using the average, she wanted to use a confidence interval based on the real distribution of volatility, taking into account the skew of that distribution.
As she did not want to be stopped out by two bar reversals, she used the average true range of a double bars. I have used an approximation for the 2-bar average true range several times by multiplying the standard average true range with the square root of 2. Cynthia Kase probably would not have liked this, as it assumes that the average true range is normally distributed, and this clearly does not hold. So let us first to try to the real thing without proxies.
The lines of the DevStop are based on 1, 2 and 3 standard deviations of volatility as measured by the n-period average true range of double-bars. The values 2 and 3 were corrected for the skew, which she determined empirically, and thus became 2.2 and 3.6
Coding this should be straight forward. The only problem that I can imagine is the use of the NinjaScript MAX and MIN methods which are used to determine the Trade High or Trade Low as Cynthia calls it. Also it should be avoided to perform all calculations with every incoming tick, when connected. Otherwise the indicator cannot be used in real time.
I will code it because the concept makes sense. You convinced me.
Last edited by Fat Tails; May 13th, 2011 at 07:42 PM.
The following user says Thank You to Fat Tails for this post:
Made a quick test, whether the 2-bar Average True Range can be approximated by using the 1- bar average true range.
The first indicator panel shows the two bar average true range divided by SQRT(2) plotted against the classical average true range. As you can see the error does not look large. The blue line is the ATR, the green line is the ATBTR.
The second indicator panel shows the percentage error which is made when calculating the ATBTR from the ATR. The results shows that the error can be significant. For smaller timeframes I have found values up to 25%.
So I will abandon the idea of using the ATR multiplied with the factor SQRT(2) as a proxy.
Have coded a first version of the indicator. Please do expect bugs and further changes.
If you compare it to the DevStop2 indicator, which I downloaded from the NinjaTrader forum, the two indicators do not have much in common.
I am still not happy with the result and will need to check some of the assumptions. In particular the trend filter needs to be reworked. Also I am not sure whether the calculation of volatility and standard deviation are correct.
Will further check into this. Please participate in testing, any comments appreciated.
The following 11 users say Thank You to Fat Tails for this post:
Broker/Data: Mirus Futures/Zen-Fire, TransAct/Infinity
Favorite Futures: 6E
Posts: 31 since Nov 2009
Thanks: 14 given,
Good job !
You used to compare the second edition from ninja forum, although on the ninja forum there is the first edition, which visually appears to be correct. In the second edition throw most of the code and used to calculate the EMA. In general, at first glance it is clear that the standard deviations there are calculated not according to the concept, and lose their meaning.
Your version is very similar to the first edition, which can be seen on the screen shots.
The first version from the NinjaTrader forum crashed my PC, and it is really bad coding, so I do not want to use that anymore. The second version does not calculate the standard version correctly, as you noticed.
Indicator built by using the articles from Cynthia Kase
I have tried to build the indicator directly by using information from the articles of Cynthia Kase, and to understand how she came to develop the concept. These are basic ideas that led to the development of the indicator
-> she wanted to develop a volatility stop, starting point was the Chandelier stop, which is based on Wilder's ATR
-> from her trading experience she wanted to avoid to get stopped out by two bar reversals, hence the use of the two-bar average true range instead of the average true range
-> she wanted to take into account two statistical measures for determining confidence intervals: the mean and the standard deviation of the two bar volatility average over a period of n bars
I simply applied these ideas without looking at the corrupted code of the other indicator.
Now these are the weak points of my indicator, with which I still have to deal:
-> I used the exponential average of the two-bar average true range. Maybe I should have used a simple moving average, as this would reflect the confidence intervals that are obtained by adding the multiples of the standard deviation
-> I really do not like that trend filter based on moving averages, I would rather prefer a trendfilter based on volatility, as I have used with the SuperTrend indicator
Mathematically the ideas of Cynthia Kase are absolutely correct. However, this does not mean that the concept beats a triple SuperTrend indicator, which is simply based on the ATR and multiples of the ATR without using the standard deviation. I guess, we need to do some backtesting.
The following 4 users say Thank You to Fat Tails for this post: