PureBytes Links
Trading Reference Links
|
Tyr this, also which log do you want to use?
Natural log is LOG, base 10 is LOG10
function f( n )
{
fn = StDev(Log(C/Ref(C,-1)),n);
return fn;
}
Cheers,
Graham
http://e-wire.net.au/~eb_kavan/
-----Original Message-----
From: treliff [mailto:treliff@xxxxxxxxx]
Sent: Saturday, 28 February 2004 1:31 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] need some help on user-definable functions
Hopefully a scripting xpert can help me get a handle on this.
I'm not familiar with scripting but was delighted to find the new
AFL do-while, for etc. statements could help me realize some new
analysis.
I'd like to define a function f that calculates statistical
historical volatility:
f(n) = StDev(Log(C/Ref(C,-1),n)
(this formula mixes traditional math notation "f(n) =" with
AFL)
The variable n determines the lookback period and of course, further
down the indicator, I'd like to be able to call say f(3) (3-period hist.
volatility) when n is 3 etc.
Now how do I code this? I better not bore you with the countless
messy codes I tried so far, but they all lead to some error message,
mostly re. mismatches in numbers and arrays.
Just getting this one straight will probably open the door for me.
Thanks in advance for any help.
Treliff
------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy
Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer
at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|