PureBytes Links
Trading Reference Links
|
A formula for the average is:
Ave = (Ave[1] * Length + Price - Price[Length]) / Length
Restating:
Ave * Length = Ave[1] * Length + Price - Price[Length]
solving for Price:
Price = Ave * Length - Ave[1] * Length + Price[Length]
So if Price = Ave for this bar:
Price = Price * Length - Ave[1] * Length + Price[Length]
Price * (1 - Length) = - Ave[1] * Length + Price[Length]
Price * (Length - 1) = + Ave[1] * Length - Price[Length]
So finally:
Price = (Ave[1] * Length - Price[Length]) / (Length - 1)
Check:
(30, 35, 40, 45 & 50) / 5 = 40 (your example)
Calculate from the formula:
Price = (40 * 5 - 30) / 4 = 42.5
Check:
(35, 40, 45, 50 & 42.5) / 5 = 42.5
Seems to work...
Bob Fulks
> I know this can't be that hard but I've got a brain cramp and
>just can't figure it out.
>
> What I need to do is find a moving average cross point.
>
> Essentially what price does the market need to move to for the
>average to and price to meet.
>
>
> For example: I keep an average of the last 5 numbers in a series. (30,
>35, 40, 45 & 50)/5 which gives a 5 period moving average - or in this case
>an average of 40 - as the data progresses.
>
> The issue at hand is to determine what the new number in the series
>needs to be so that it meets or crosses the new "average" number for the
>time series.
>
> Any help will be greatly appreciated.
>
>Thanks in advance,
>
>Joe
|