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

[amibroker] Re: Comments on Van Tharp courses please



PureBytes Links

Trading Reference Links

Thanks Graham,

I tried your suggestion but changing "g" to "gr" within the code is 
not the solution since now it returns a syntax error re. "gr(10)". 
The problem is in the brackets I think but I wouldn't know how to 
code without brackets to initiate the loop.

Possibly indeed the use one function within another is a problem, 
though I suspect this should be possible.

Treliff
 

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> I think the problem comes that you are using the functioning you 
are trying
> to define within the function itself. Try changing that g() inside 
the
> function. Also I am not sure if you can use another function 
within a
> function ie f(n) within g(n) ?
> 
> function g(n)
> {
> gr(10) = f(10);
> for (n=11;n<=30,n++)
> {
> gr(n) = gr(n-1) + f(n);
> }
> return gr(n);
> }
> 
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
> 
> -----Original Message-----
> From: treliff [mailto:treliff@x...] 
> Sent: Tuesday, March 09, 2004 4:04 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] I need some loop-programming help
> 
> 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@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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/