[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indicator lag



PureBytes Links

Trading Reference Links

At 11:56 AM -0400 10/14/98, Peter Gibson wrote:

>Bob - in your formula why is is Log(Price / Price[Offset]); rather than
>simply Price / Price[Offset]?



It have been a while since I did this but this seems to be it:

The exact formula (including the effects of compounding) is;

    Rate = 100 * ((Price / Price[1])^^Factor - 1)

but this is hard to calculate using the "Power" function in TradeStation
since it can easily give overflows with errors in the price data.

The equation can be calculated with logarithms as:

    Rate = 100 * (ExpValue(Factor * Log(Price / Price[1])) - 1)

But since (Price/Price[1] - 1 is << 1) most of the time for small changes,
and since

   ExpValue(x) = 1 + x + x^^2/2! + X^^3/3! + ...

then

   ExpValue(x) = 1 + x     if x << 1

so

   ExpValue(x) - 1 = x     if x << 1

so I left out the ExpValue calculation to save calculations.

Bob