Playing around with anaSuperTrend and some SuperTrend strategies here in this forum, I have noticed that some of these anaSuperTrend versions are a bit different in the plotting and arrow trend signaling.
Would someone be able to tell me the differences between the anaSuperTrend and the anaSuperTrendM11 in reference to the calculations behind it?
I know that the M11 version allows user to change the stop-line and stop dots appearances, but when using the same parameter settings, as you can see from the attached pic, the stop-lines are plotted differently and thereby on a few instances, there can be a arrow trend change on one version, while the other version stays with the current trend.
Your observations are exact. Let me try to explain the differences.
Technical Analysis was originally performed by chartists on daily charts
Most of the indicators were not designed for day trading, but were originally applied to a printed chart, once the market had closed. So the chartist would perform the calculation of the formula once and write down the result. The best book that I have seen to show how this was done is Welles Wilder's "New Concepts in Technical Trading Systems".
Why it is ridiculous to use these indicators on tick-by-tick real-time data
Let us take the example of a Bollinger Band. It uses the standard deviation over a lookback period, which is a relatively complex calculation. For these calculations it includes the current value of price. So with every incoming tick you need to recalculate the standard deviation. What you get in return is a band that moves away from price, when price approaches it. So if you check price against that Bollinger Band, you essentially get a feedback loop with negative feedback.
Conclusion: Recalculating Bollinger Bands tick by tick causes a high CPU load which creates negative feedback. In short this is mathematical nonsense.
How to implement indicators correctly?
For use with real-time, you want a low impact indicator, which serves the purpose. For the Bollinger Bands it would be good enough to replace the standard deviation StdDev(20) with the StdDev(19) and calculate this only once when the first tick of the new bar is detected. The chart below shows the original Bollinger Band (orange) and the modified Bollinger Band (red). Teh difference is that during a news release the red bands will not trigger a few thousand calculations of the standard deviation and freeze your trading software.
The worst coding example that I have seen is the VWAP, as is calculates the standard deviation back to the beginning of the session with each incoming tick. Freeze guranteed, if you use it CalculateOnBarClose = false.
Now what about the SuperTrend M11?
The SuperTrend uses the median and the average true range to calculate the stop bands. As seen for the Bollinger Bands it is neither necessary nor helpful to include the current value of price to calculate the bands. Therefore the stop value is calculated from the median of the last period anaMedian(MedianPeriod) and the true range of the last period ATR(ATRPeriod). This makes it robust and possible to use it in CalculateOnBarClose = false mode,which is necessary if you want to get the alerts in real-time. The SuperTrend M1 only had the ATR calculated one bar back, but still calculated the median with each incoming tick.
So it is just a starting point to replace all the nonsense indicators with indicators that are adapted for use with real-time data. The difference between the two indicators is negligible. What you have to do though, if you compare the SuperTrend M11 to the SuperTrend M1: You need to reduce the Median period of the Supertrend M11 by 1 to come as close as possible.
The following 38 users say Thank You to Fat Tails for this post:
I have few questions for you guys, especially for @Fat Tails, because he is the creator of the indicator.
I currently use (actually just discovered it this morning) anaSuperTrendMod, where could i find anaSuperTrendM11 ?
What is the meaning of the gray and red line from anaSuperTrendMod, and how should they be used?
Is there a possibility to disable the plot for them?
Last edited by Colin F; December 2nd, 2011 at 03:26 PM.