Search | User Listing Vidsite | Calendars | Quotes
Home Page ->  Markets & Methods -> Development of New Tools -> View ThreadLogon (or Register, or Join TradeTight)

You are logged in as a limited-access Guest.To join TradeTight, first read the info in the Organization & Content room, then click the link above. 

2 Chronicles 26:5 (NIV) … (Uzziah) sought God during the days of Zechariah, who instructed him in the fear of God. As long as he sought the LORD, God gave him success.


Sticky Versatile New Composite Moving Averages
Jump to page : 1
Now viewing page 1 [50 msgs/pg]
Jump to room :
JimDean
Posted 4/4/2014 11:16 AM (#5747)
Subject: Versatile New Composite Moving Averages



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
I started out fiddling around with Heikin-Ashi (HA) bars, finding and tuning TWO major improvements to them (one is discussed a bit below - Guts-Mop (GM) bars) ... then, as I decided to test the differences and started plugging in to RSI and Moving Average formulae, I got hooked on finding ways to improve the basic MA types that we all know and love (and some less well known ones).

This post is designed to give a fairly comprehensive overview of the inter-relationships of different MA types, and of the different basis-bar and basis-price types, without getting too much into specific math and logic details. I'll try to describe things in enough detail to support the conclusion, without burying you in gobbledegook. Despite that, some might consider this writeup to be fairly "heavy" ... the results are worth it, but get a cuppa coffee and clear your brain before diving in :~)



1. There are essentially two different "kinds" of MA calculation methods ... fixed-window and infinite-series. WMA, SMA, TMA, etc are fixed ... their calc's only draw from a fixed-width, sliding window of bars, and the coefficients get locked in for each weighting slot in the window. In contrast, EMA, ZMA, Wilder's, Ehler's, etc use and infinite series, and a cumulative decay rate, with an unending string of coefficients, incorporating to a diminishing degree every single historical bar that is loaded.

2. When the infinite data series is compared to a "bounded" data region that uses the same decay-rate formula but limits the lookback to a window that is some multiple of the Periods, that window size can be adjusted to provide differing levels of "error" (versus a true infinite series). The initial "seed" value of the calc is SMA(Periods) - if the seed is then followed by 4*Periods more of the iterative decay-type calc's, the error is almost always less than 0.04% (ie with a big sample of 3000 symbols) ... usually well under 0.02% ... ie, one penny error for an MA of a symbol with $500/share price. (EhlerDC calc's require ~3*Periods, Wilder requires ~6*Periods.)

3. The advantage of using a bounded series is faster calc speed, and stable/accurate results. Reason for the improved calc speed is obvious ... FAR fewer bars (bounded vs infinite) need to be processed, when a huge number are loaded ... example: 5000 bars loaded, and 20bar EMA calc'd ... it needs only 80 bars warmup for 0.01% accuracy, so the routine can skip the other 4920 before that, if only a single output value is needed at the Hard Right Edge (HRE), for instance. This makes little/no difference if a full-range plot is being done, other than to prevent the plot from appearing on the screen at the far left, until the warmup is sufficient for the desired accuracy. But there is a huge difference when just one EMA value is needed for decision-making (typically at the HRE but could be anywhere) ... as for a FocusList column or OmniScan or ColorChart, etc. In those cases, it's most efficient to skip over all bars before the min required warmup period (and skip any bars after the desired bar). That's where the SMA+Periods*N "bounding" comes in. The magnitude of N determines whether the single-value FocusList 80-bar "bounded" EMA calc, with 5000 bars loaded, will MATCH the value seen at the HRE on the chart (using crosshairs and databox), which is based on all 5000 bars. N should be chosen to be large enough so that when that comparison is done, any differences are insignificant to the decision-making task (ie slope, stacking, crossover, etc). Conclusion: my "decay-method" MA calc's now all use bounded formulae. Side note: the "seed SMA" has marginal value, vs just starting with the raw increm calc process and using (N+1)*Periods. I use it mainly because that's how a lot of platforms do their calc's.

4. Ehler's DeCycled MA, which Mel Dickover has discussed a lot as a part of his "Rocket Science" theme, is an interesting member of the "infinite series decay rate" group of MA's. It's interesting since it arrives at its "alpha" decay coefficient by a totally different means than classic EMA 2/(Pds+1) or Wilder 1/Pds algebra ... Ehler uses a mix of Cosine and Sine trig values, along with the Periods, to define alpha for the decay formula. It can be graphically demonstrated that the trig-based alpha-calc for Ehler's boils down to 0.318*CutoffPeriods (greater precision has little impact on results) ... or 0.636*HalfCyclePds. This is a lot easier to conceptualize for most people than the trigonometric "alpha" calc that Ehler's uses ... though Ehlers' formula "means" something significant (as a highpass filter) to those who have physics/EE backgrounds. But after the dust settles, it's just 0.318.

5. Ehlers' iterative-decay (ie EMA-type) calc uses bar-price=(C+C[1])/2 instead of the standard "C" ... this adds a little lag and helps smooth out anomalous bars. SO, using that dataseries, one can plot a close approximation (hard to see the difference on a chart) of Ehler's DCMA using a standard EMA indicator, with a modified Periods input. If you plugin the previously-described graphically-equivalent 0.318*CutOffPds as the periods input for a standard EMA indicator, and specify the alternative dataseries instead of the C-default, you'll be very close to the Ehlers' DCMA curve. When using OLang or OScript, use the long-form EMA( (C+C[1])/2, 0.318*CutoffPds ) to see a close-equivalent of the DCMA curve.

6. Since there can be "flukey" bars with C-values that cause noise in virtually any MA calc, PARTICULARLY if the MA is fairly "fast/reactive" (ie 5, 10, 20 bars), I believe that the idea of offering alternative basis-prices as an option for MA calc's has a lot of merit. Clearly, C of the underlying bar is one of those options. Elsewhere I've described the Guts and Mop (Momentum) pricepoint-formulae in detail ... neither of those has any lag at all, since they are calculated from a weighted mix of OHLC for the current bar only. The logic that creates the Mop value actually seems to result in a somewhat "leading" price (approx 0.5-1.0 bars), in some circumstances. Furthermore, I believe it's useful for options to be provided regarding the bars themselves from which the prices are derived - Raw(underlying) and Heikin-Ashi bars are obvious choices. HAbars have some lag in them, if the pricepoint utilizes anything but the HAclose, since the HAopen itself is an infinite-series kind of calculation (albeit with rapid decay). The "reason" that people like to use HA is that the COLOR of HAbars (ie direction of HAclose versus HAopen) remains more consistent during a move/trend than underlying RawBar colors do. Testing suggests that HAbars tend to visually lag RawBars by about 1.5-2.5 bars, based on bar COLOR (ie "the trend" or "the move" or "the leg").

7. I've created an alternative to the HA bars, which uses a similar philosophy and goal (to reduce the color-chatter to clarify trends) ... I call it the GutsMop bar (GM bar). The GMbar Close is the Mop of the underlying RawBar (no lag, sometimes a little lead), and the GM Open is an average of RawGuts[1] and RawMop[2] of the underlying bars ... NOT an infinite series like HA calc's use. The reaction-time of GMbars is visually in-between underlying and HAbars ... less lag than HA, but enough "smoothing" to provide consistent "color-runs" similar to HA. During pullbacks, sometimes GMbars change color when HAbars don't, but not unless it's a meaningful distance, preceded usually by some deceleration of the trend. The fact that GMbars pricepoints (GMopen, and maybe GMhigh/GMlow occasionally) are derived only from the two prior bars rather than the infinite series used for HAbars, makes GMbars more stable and reliable to implement in trading rules of various sorts.

8. Since both HAbars and GMbars (as well as Guts or Mop of the underlying bar or HAguts/HAmop or GMguts/GMmop) are more "sophisticated" and "representative" than Ehlers' (C+C[1])/2 price series, I believe there is more merit to applying Ehlers' highpass alpha decay-calc method, rather than adding yet another pricepoint just to provide a "pure" Ehlers calc. As mentioned earlier, the distinction between (C+C[1])/2 and C in the Ehlers calcs is insignificant for the recommended CutoffPds range. So, my MA routines offer two input options: RawGMorHA bars, and GutsMopC prices for whichever bar-type is chosen ... those nine possibilities cover the spectrum very thoroughly. As mentioned earlier, differences between the nine are reduced in the MA calc, as the Periods input grows larger. But the choices make considerable difference for MA's with "reactive" periods like 3,5,8,13,21 (Fibonacci examples, for grins).

9. The other "kind" of MA's mentioned at first include the SMA (simple) and WMA (weighted) ... both used a fixed window of bars ... WMA is more reactive (in a good way) than SMA, but SMA provides a more legitimate statistical sample when that's the goal (such as for Bollinger Bands). There is a MISSING "hybrid" form that no one seems to talk about, but which I've found to be quite useful ... it's another form of weighted MA that uses algebraically-decreasing coefficients, but without requiring the lowest weighting to be =1. That is, WMA(5) weights = 5,4,3,2,1 moving backwards in time; WMA(3) = 3,2,1 and so on. I've created an MA that allows the user to SCALE BETWEEN the WMA and the SMA, by carefully altering the final-weight. For example, to get an MA that is visually about halfway between WMA(10) and SMA(10), you use the WMA algebraic weighting formula, but instead of HiWtg=10 and LoWtg=1 (pureWMA), the "halfway" values are HiWtg=15 and LoWtg=6 (with appropriately adjusted divisor). Other patterns with different LoWtg endpoints are used for other intermediate MA lines. The result is an indicator-function that can report a pure WMA value, a pure SMA value, or any of several equally-spaced increments in-between. I call it the StoWma ("Simple-to-Weighted" MA).

10. Following along those same conceptual lines, but working with the "bounded decay series" of MA-types, I've created a DEWma indicator (bounded "decay-calc" based) that moves in roughly-equal incremental steps from EhlersDCMA to ClassicEMA to WildersMA. Wilder's MA, btw, defines alpha to be 1/Periods, but the incremental calc's follow the same pattern as EMA and DCMA. Thus the DEWma provides three "known" MA's in one, PLUS multiple increments between them, for a given Periods input. Side-note: in order to make the magnitude of the periods-input be more usefully comparable on a chart, I treat the Pds-input as a HALF-cycle cutoff for DCMA calc's (formula adjusted accordingly) ... that is, to see a curve based on Full-cylce-cutoff of 60 bars, input 30 as the half-cycle. When that's done, the DCMA(HalfCyclePds) shows up as a bit "tighter" than the EMA ... as per Ehler's formula ... but you don't have to keep swapping the Pds input around when the scaling between DCMA-EMA-WldrMA takes place. The DEWma routine includes bounded-warmup control, and also offers the full set of nine bar+pricepoint options describe above.


... And ... there's a lot more to it when you start looking at the capabilities of the code itself, but the description above pretty well covers both the reasoning and the final results of what's been a much more time-consuming research project than I expected when I set out. But the results are worth it: TWO NEW MA FUNCTIONS, that model FIVE "standard" MA types, plus MANY intermediate types ... plus great versatility re basis bars+prices, and nifty output-range controls. And, behind and before and within that, two MAJOR bar-definition variants that improve on the HAbar starting point, which work great as stand-alone bars, or as "feeds" to functions like StoWma and DEWma . (I only described the GutsMop variant here ... the other is is the FuzzyDoji algorithm, discussed elsewhere).

I hope you felt that the time to wade through all that has been useful, simply to help get a better understanding of what differences and similarities there are in the various MA's ... and how they can be improved on. Later on, I'll publish more detailed info re "GMbars" and about the StoWma and DEWma routines. Thanks for your interest!


Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
WesSmith
Posted 4/4/2014 4:13 PM (#5748 - in reply to #5747)
Subject: Versatile New Composite Moving Averages



Veteran

Posts: 102
100
Location:
Canada: , London
I've 'Waded through' and am very interested in what you've come up with Jim.
Any screen shots?

Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
JimDean
Posted 4/4/2014 4:16 PM (#5749 - in reply to #5748)
Subject: Versatile New Composite Moving Averages



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
I'm putting together some overviews ... including no-cost videos. Just too long and too cool to explain solely in writing. I'll post something within a few days.

Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
DonSchuman
Posted 4/4/2014 7:38 PM (#5750 - in reply to #5747)
Subject: Versatile New Composite Moving Averages



Veteran

Posts: 212
100100
Location:
USA: TX, Mansfield
Got through it. Probably about 60% sank in.

Looking forward to the videos and follow-up to come.

Don

Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
JohnB
Posted 4/5/2014 5:58 AM (#5751 - in reply to #5747)
Subject: Versatile New Composite Moving Averages


Friend

Posts: 29
25
Location:
: ,
Jim That is very interesting stuff. I don't know that I got anything like 60% but will do my best with a coffee powered re read! I am completely convinced of Ehlers stuff and owe much thanks to Mel for his efforts. I have just received an ACT 2 update email so it looks as though Ehlers or your algorithms or similar may be deployed by Nirvana. It has struck me since first seeing HA bars from Lain's posts that they looked great but what about the lag and then you can look at Renko and think that's great but what about the stop go nature could there be another combination / compilation. Both have smoothing advantages which seem very nice but have a downside. So what about getting at the basics to see what could be adjusted to mitigate the downside and enhance the advantages into one? Well looks like you have accomplished that already and with great expertise! Can the new formulas perform in fast tick times say 10-20 ticks or less.. I am hoping they could. That would I suspect open a big door for me.
Once again many thanks for the information and I will be fascinated and eager to see the next instalment.
John B

Edited by JohnB 4/6/2014 6:56 AM


Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
RossKovacs
Posted 4/6/2014 8:19 AM (#5752 - in reply to #5747)
Subject: Versatile New Composite Moving Averages



Veteran

Posts: 131
10025
Location:
USA: GA, Snellville
The 'two different "kinds" of calculation methods' are not mutually exclusive.
The attached paper by Ehlers describes how to combine the methods.
'Ehlers' iterative-decay (ie EMA-type) calc uses bar-price=(C+C[1])/2 instead of the standard "C" ' is a recent application of the principles in the paper; older versions of Ehlers filters did not use the (C+C[1])/2 bar price.
The "bar-price=(C+C[1])/2" is used to cancel two period cycles, at a cost of 1/2 bar delay.
This is useful for short (<10 bar) calculations; it does not have much advantage for long period calculations.


Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages


Attachments
Attachments Hybrid FIR-IIR Filters.pdf (102KB - 13 downloads)
Top of the page Bottom of the page
JimDean
Posted 4/6/2014 9:13 AM (#5753 - in reply to #5752)
Subject: Versatile New Composite Moving Averages



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
The two methods that I described are different mathematical algorithms, based on different sets (windows) of data, and different means of weighting, which produce different shapes of curves. There is no "transform" that I know of by which a classic WMA can be *made to appear identical* (ie smoothly transition) to a classic EMA, because of these differences. The two "kinds" that I have discussed are separated simply because their is no clean mathematical "bridge" between them.

The PDF that Ross posted, with an indepth article by Ehlers, supports this idea. Ehlers says that the two methods of calculation are "fundamentally different" because the EMA is "recursive" while the WMA/SMA is not. My way of saying this is that they are two different "kinds" of calculations. Ehlers' article proposes a "hybrid" - which uses the (price+price[1])/2 substitute - and he provides an interesting discussion about its merits. However, that does not provide a bridge between the two "kinds", visually, when the parameters are manipulated. In my DEWma, the transition between DCma and classic MA is a gradual one.

I did do some testing on varying the weighting of the price data within an EMA (similar to what Ehlers article discussed). I tried several variations on combinations of Price, Price[1], and Price[2]. The unexpected conclusion I was faced with, when viewing the actual curves that showed the impact of those changes, is that it made no substantive difference, so I dropped it. I suppose that if there is any difference between Ehlers discussion and my conclusions, it would be that some conceptual theories don't actually work out in practice to make much difference. My older brother Ray Dean, with a genius-level IQ and a doctorate from Princeton in Electrical Engineering, was fond of saying: "one test is worth a thousand theories, and one theory can improve a thousand tests". Wise words.

Technically, I "pushed" things a bit in DEWma to incorporate the Ehlers MA with EMA and Wilders, since Ehlers uses a different data series (price + price[1])/2. But my testing showed that the difference is a fairly small one especially for the higher periods at which the Ehlers DeCylced MA is targetted. It's my understanding (from Mel) that Ehlers' SSF is intended for shorter timeframes - I have not included that in the DEWma spectrum - it's mathematical form is much different.

Summary: StoWma and DEWma each provide for and represent a "spectrum" of moving average calculations. The calc's within each of those routines follow similar paradigms and the curve shapes gradually transition from one mode to the other, within that same kind.

This may all seem sort of obscure when written out - but it's very obvious when you see it on the chart, and in the code. I'm putting together some videos to illustrate that.

Thread moved by JimDean on 8/6/2014 10:25 AM from Markets & Methods > Mood of the Market > Versatile New Composite Moving Averages

Top of the page Bottom of the page
Jump to page : 1
Now viewing page 1 [50 msgs/pg]
( E-mail a Link | Printer Version | Search Room )

Owner of site: Jim Dean -- Forum content is confidential, and may not be distributed without written permission.