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

[amibroker] Re: I need some loop-programming help



PureBytes Links

Trading Reference Links

Hi,
I need some loop-programming help.

I have already defined a function f(n) (n are integers 10,11,...) 
and now I want to define function g(n) such that

g(10) = f(10)
g(11) = f(10) + f(11)
g(12) = f(10) + f(11) + f(12)
...
etc. say up to g(30)

As a clumsy mathematician (not a programmer) I would write something 
like:

function g(n)
{
g(10) = f(10);
for (n=11;n<=30,n++)
{
g(n) = g(n-1) + f(n);
}
return g(n);
}

but this is obviously wrong, the first syntax error is the use of
"g(10)" within the code.

Can anyone help me get this code right? Thanks much in advance.

PS
Though this seems irrelevant to my question, the function f is 
defined as follows:

function f(n)
{
return  log(C/Ref(C,-n))/(StDev(log(C/Ref(C,-1)),n)*sqrt(n)) ;
}




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/