https://www.amibroker.com/guide/afl/log.html
https://www.amibroker.com/guide/afl/log10.html
Also: Properties of Logarithms(for any common base)
Log(x/y) = Log(x) - Log(y)
Log(x*y) = Log(x) + Log(y)
Log(x^y) = y*Log(x)
https://people.richland.edu/james/lecture/m116/logs/properties.html
On 3/14/2016 12:52 AM, 'U.Mutlu' um4711@mutluit.com [amibroker] wrote:
I think you have a bug in the code: you have "ln(APriceArr)" ...
It should be:
StDev(ln(APriceArr / Ref(APriceArr, -1)), APeriod)
/ sqrt(1 / ADaysInYear) * 100;
And: log is different from ln, eventhough in C/C++ log(x) means ln(x)...
I already wrote the following in my previous posting:
"
And the following relation is also true:
ln(y / x) == ln(y) - ln(x)
"
Thomas Ludwig Thomas.Ludwig@gmx.de [amibroker] wrote on 03/12/2016 03:00 PM:
> You can also write the formula as
>
> return StDev(ln(APriceArr) / Ref(APriceArr, -1)), APeriod)/ sqrt(1 /
> ADaysInYear) * 100;
>
> It's equivalent as
>
> log x - log y = log (x/y)
>
> Greetings
>
> Thomas
>
>
> On 12.03.2016 14:57 'U.Mutlu' um4711@mutluit.com wrote:
>
>> I think of all the presented functions here (btw many thx to all),
>> the function in the original posting seems to be the most accurate one
>> as sometimes the difference can be about a whoppy 1%...
>> Here's an extended and optimized version of it:
>>
>> function my_vola(APriceArr, APeriod, ADaysInYear)
>> { // DaysInYear should be 252 for stocks
>> return StDev(ln(APriceArr) - ln(Ref(APriceArr, -1)), APeriod)
>> / sqrt(1 / ADaysInYear) * 100;
>> }
Posted by: Alan <alan@thenorthams.us>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (18) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon