New version 18 available now

Subscription & data-feed pricing Class schedule

Margin rates Stock & option commissions

 Lag Efficient Moving Average Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
 Posted : Monday, January 17, 2005 5:41:02 PM
Registered User
Joined: 12/5/2004
Posts: 2
How could the following be implemented as a custom indicator in TC2000. It's basically a Lag Efficient Moving Average.

XAVGC10+XAVG((C-XAVGC10),10)
Craig_S
 Posted : Monday, January 17, 2005 5:46:55 PM

Worden Trainer

Joined: 10/1/2004
Posts: 18,819
The inability to do an average of an average prevents this from being possible. Try this for me and see if it is close to what you want:

XAVGC10+(XAVGC10-XAVGC20)

It should be pretty darn close to the plot you would get from your formula if the language was capable.

- Craig
Here to Help!
bustermu
 Posted : Tuesday, January 18, 2005 5:48:41 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Your moving average can be implimented as a custom indicator using:

2*XAVGC10-XAVG(XAVGC10,10)

Be sure to check "Plot using price scale".

There are easier ways, but they can lead to trouble.

Thanks,
Jim Murphy

 Posted : Tuesday, January 18, 2005 8:11:22 AM
Registered User
Joined: 12/5/2004
Posts: 2
Thank you very much, Jim. My next step was to post this at the Auxiliarytc2000usergroup forum but no need to do that now. Again Thanks!
Craig_S
 Posted : Tuesday, January 18, 2005 8:24:38 AM

Worden Trainer

Joined: 10/1/2004
Posts: 18,819
I found out you are correct. Thanks so much!

- Craig
Here to Help!
bustermu
 Posted : Saturday, January 22, 2005 11:17:04 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Three Zero-Lag Moving Averages are:

1) LRMA10
2) 2*XAVGC10-XAVG(XAVGC10,10)
3) 2*XAVGC10-XAVGC20

The first is the linear regression moving average available in TC2K. The second is given by sseneadza above. The third is given by Craig_S above.

The three should probably be compared after adjusting the parameters (10) so that the Noise Bandwidths are the same. As they are, they seem to provide about the same amount of smoothing with their good and bad chacteristics in the order listed. For example, response time is the fastest and overshoot is the worst for 1).

Maybe sseneadza, or someone else, can give us a reference for 2).

Thanks,
Jim Murphy
bustermu
 Posted : Thursday, June 30, 2005 5:04:18 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
My statement above that:

3) 2*XAVGC10-XAVGC20

is a Zero-Lag Moving Average is incorrect. The MA has lag -1/2.

The intended Zero-Lag Moving Average is:

3) 2*XAVGC10-XAVGC19

The lag of XAVGCP is (P-1)/2, so the lag of 2*XAVGCP-XAVGCQ is 2*(P-1)/2-(Q-1)/2.

Sorry,
Jim Murphy
Tanstaafl
 Posted : Tuesday, July 05, 2005 10:22:09 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Hi, JimM:

I know that you have discussed this before somewhere, but I cannot find it on this forum.

Would you mind providing a simple cookbook method (if there is one) for determining the "lag" of a given indicator?

Also, could you please define "lag" in terms that would help the average trader understand what the referent basis is?

Thanks very much!

Jim Dean

bustermu
 Posted : Tuesday, July 05, 2005 2:57:51 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Jim D.,

Let's confine ourselves to Linear Time Invariant (LTI) Moving Averages. Examples of these are Simple Moving Averages (SMA), Exponential Moving Averages (EMA), Linear Regression Moving Averages (LRMA), and any of their cascades. They are Moving Averages so that their output is all 1's when their input is all 1's.

The Lag is how far, in bars, the output is behind the input when the input is a straight line of unit slope.

We can illustrate this with MA's on a Custom Cumulative Indicator (CC) of unit slope. Please do the following setup:

Top Window

Costom Cumulatative Indicator
Up Condition
ABS(V)>=0.0
Down Condition
ABS(V)<0.0
1+0.0

Put any of the MA's mentioned above on the CC and measure the horizontal distance from the MA output back to the CC using the pointer with the horizontal bar fixed. This is the Lag.

You will find that if the Period of the MA is P, then LRMA Lag = 0, SMA Lag = (P-1)/2, and EMA Lag = (P-1)/2. You will find that Lags of cascades of MA's add. You can also discover that the Lag of an MA which is a linear combination of MA's is the same linear combination of the Lags of the components.

All of the above is proved using the equation for Lag. The equation for Lag can be found at the Yahoo Auxiliary TC200 User Group, Message 1583.

Thanks,
Jim Murphy
Tanstaafl
 Posted : Tuesday, July 05, 2005 3:49:07 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Thanks very much, Jim!

I am copying the text from your Yahoo Aux group posting here, for completeness.

=====================

Consider the filter

y = a(0)*x(n-0)+a(1)*x(n-1)+a(2)*x(n-2)+...

If

a = 1/P, 0<=k<=P-1
a = 0, P<=k

the filter is a Simple Moving Average (SMA) of period P.

If

a = (1-a)*a^k, 0<a<1

the filter is an Exponential Moving Average (EMA) with parameter a.
If

1-a = 2/(P+1)

the EMA is of period P. Why is this? We will give two answers.

For the SMA:
The DC Gain is

a(0)+a(1)+a(2)+... = 1

The Lag is

a(0)*0+a(1)*1+a(2)*2+... = (P-1)/2

The Noise Bandwidth is

a(0)^2+a(1)^2+a(2)^2+... = 1/P

For the EMA:
The DC Gain is

a(0)+a(1)+a(2)+... = 1

The Lag is

a(0)*0+a(1)*1+a(2)*2+... = a/(1-a)

The Noise Bandwidth is

a(0)^2+a(1)^2+a(2)^2+... = (1-a)/(1+a)

1) If we require the SMA and the EMA to have equal Lag, then

1-a = 2/(P+1)

2) If we require the SMA and the EMA to have equal Noise Bandwidth,
then

1-a = 2/(P+1)

These are the only two reasons I am aware of for assigning the period P to the EMA. Does anyone know of other reasons for the assignment?

Thanks,
Jim Murphy

=====================

Tanstaafl
 Posted : Tuesday, July 05, 2005 3:52:11 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Gaak!

The Y funky thing above is "Y ( n )" without the spaces.

The a funky thing above is "a ( k )" without the spaces.

WORDEN ... PLEASE provide a checkbox next to the "Preserve HTML" to TURN OFF SMILIES!

Jim Dean

Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot delete your posts in this forum. You cannot edit your posts in this forum. You cannot create polls in this forum. You cannot vote in polls in this forum.