Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have a feeling that my idea has already been done on here (but I can't seem to find it), so i'm hoping someone
can link me too it (assuming i'm correct)
I want a moving average indicator where I choose what bar the the indicator begins from.
So, if I was to take Fridays' CL chart, and decide I wanted my ema to begin from, 3pm, or 84 bars away, it
would look something like this:
cheers
Can you help answer these questions from other members on NexusFi?
@subterfuge: Funny you selected an EMA to start with. The EMA is an infinite impulse response (IIR) filter, and it is therefore influenced by all of its prior values. In general IIR filters have training periods during which they do not show accurate results. The EMA is an exception as it only uses its value one bar ago. You can therefore create a specific anchored EMA for any bar on your chart.
Your concept can be implemented, you can also use a volume-weighted EMA with a large period. This would create a MIDAS variation that lets drop out part of the old information.
If you wish to take the MIDAS idea and use it with other moving averages this is also possible, as long as you apply it to finite impulse response (FIR) filters. You can recognize a FIR filter, as it does not use any recursive formulae, or explained in a different way, it does not use any of its prior value in the calculation for the current values. The SMA is a FIR filter and your idea would promote it to a TWAP on a time-based chart.
I'm not sure I quite understand what you're looking for.
In your example are you looking to plot an EMA with a period of 84, and only show the EMA starting from the first bar in the series? Or, is it an EMA with a period of X to start plotting Y bars back, where X does not equal Y? And, do you want the starting bar to be a certain number of bars back or based on a starting time, like 3pm?
I have thought about that as well. There are in fact several options.
(1) The first one is to use a fixed period for the EMA. Let us take the example of an EMA(15).
You would start with the close of the anchor point (high bar or low bar) and then calculate the following values by using the smoothing constant alpha = 2/(n+1) = 1/8. For the anchor bar the EMA would show the close of the anchor bar, the second and all consecutive values can be calculated as 0.875*Close[1] + 0.125*Close[0]. After some time this EMA would converge to the regular EMA(15).
The inconvenience of this approach is that the outcome depends on the selected period. There is not one such EMA that can be constructed from a high point or low point, but there is a whole collection of EMAs that can be built by using this method.
(2) You could also use a second concept and increase the period of the EMA with each bar. If we take Wilder's smoothing we obtain alpha = 1/n. For the first value we would get the Close[0], for the second bar 1/2*(Close[0] + Close[1]), for the third bar 2/3 * 1/2 (Close[2] + Close[1]) + 1/3 * Close[0] = 1/3(Close[2] + Close[1] + Close[0]) etc. This would be in fact the same result that we get, if we use a SMA with an increasing period. Used on minute bars we obtain our anchored time-weighted average price (TWAP).
(3) If we do not use Wilder's smoothing, but use the habitual smoothing alpha = 2/(n+1), then the result would look slightly different. Starting again with Close[0]., the value for the second bar would be 1/3 * Close[1] + 2/3 * Close[0], the value for the third bar would be 1/6 * Close[2] + 1/3 * Close[1] + 1/2 * Close[0], the fourth bar 1/10 * Close[3] + 1/5 * Close[2] + 3/10 * Close[1] + 2/5 * Close[0] etc. This is an average that tracks price closer than the TWAP like moving average explained under (2).
However, the logic of the original MIDAS concept is more appealing to me, as it relies on the volume-weighted average price, which I think is a better choice as a benchmark than the simple TWAP or a fantasy EMA.
No. Although I can see how my example might have made things more confusing!
Yes. I think that is what I am talking about. The period isn't that important. Ideally is would be customizable, but a 20 ema for example would be fine.
I want to choose what bar I want as the starting bar. It would be different every day.
It's almost like drawing a trendline. I want to look back at the chart and pick out a bar to begin my 'ema line'.
In your example of a 20 ema there are two questions:
1) Are you saying you want to start calculating the 20 period ema beginning with a bar you specify (Understanding that it would not actually plot until 20 bars later)?
2) Or do you want the 20 ema to be plotted starting on a bar you specify (understanding that the 20 ema would actually begin calculating 20 bars before that point)?
Be yourself; everyone else is already taken. Oscar Wilde