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

[amibroker] Re: Nested Function



PureBytes Links

Trading Reference Links

Thanks Tomasz

So simple - mental blocks can be so frustrating.

Graham

>
> Should be: "You can NOT have function definition inside other 
function definition, but..."
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Tomasz Janeczko" <groups@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, October 07, 2008 7:00 PM
> Subject: Re: [amibroker] Nested Function
> 
> 
> > You can have function definition inside other function definition,
> > but you can have it both declared at global level and call one 
from the other.
> > 
> > function Function2(iiPrice, iiMAType, iiMAPer)
> > {
> > switch (iiMAType)
> > {
> > case 1:
> >    xaMA = DEMA(iiPrice, iiMAPer);
> >    break;
> > 
> > }
> > }
> > 
> > 
> > function Function1(iPrice, iMAType, iMaxPerMA)
> > {
> > xMAType = StrToNum( StrLeft( iMAType, 1 ) );
> > 
> >  Function2( iPrice, xMAType, iMaxPerMA );
> > 
> > }
> > 
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "Graham Johnson" <grahamj@xxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, October 07, 2008 3:48 PM
> > Subject: [amibroker] Nested Function
> > 
> > 
> >>I wish to nest Function2 inside Function1 so that Function2 can 
be 
> >> called multiple times to perform slightlt different calculations 
> >> within Function1.
> >> 
> >> The syntax checker highlights the line with Function2 and 
> >> displays "Error 32. Syntax Error, probably missing semicolon at 
the 
> >> end of the previous line".
> >> 
> >> If I insert } prior to the Function2 line the compile error goes.
> >> 
> >> Is there a way around this?  Or, do I have to rethink my 
approach.
> >> 
> >> A section of the code follows.
> >> 
> >> Thanks
> >> 
> >> Graham
> >> 
> >> pPrice = ParamField("Price field",-1);
> >> pMAType = ParamList("MA Type", "1 - DEMA|2 - EMA|3 - Linear 
> >> Regression|4 - SMA|5 - TEMA|6 - Wilders|7 - WMA", 4 - 1);
> >> // "defaultval" is Zero based, so need to subtract 1 to match 
> >> list
> >> pMaxPerMA = Param("Max MA Periods", 52, 26, 104, 1, 10);
> >> 
> >> function Function1(iPrice, iMAType, iMaxPerMA)
> >> {
> >> xMAType = StrToNum( StrLeft( iMAType, 1 ) );
> >> 
> >> function Function2(iiPrice, iiMAType, iiMAPer)
> >> {
> >> switch (iiMAType)
> >> {
> >> case 1:
> >>    xaMA = DEMA(iiPrice, iiMAPer);
> >>    break;
> >> }
> >> }
> >> }
> >> 
> >> 
> >> ------------------------------------
> >> 
> >> **** IMPORTANT ****
> >> This group is for the discussion between users only.
> >> This is *NOT* technical support channel.
> >> 
> >> *********************
> >> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail 
directly to 
> >> SUPPORT {at} amibroker.com
> >> *********************
> >> 
> >> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> >> http://www.amibroker.com/devlog/
> >> 
> >> For other support material please check also:
> >> http://www.amibroker.com/support.html
> >> 
> >> *********************************
> >> Yahoo! Groups Links
> >> 
> >> 
> >> 
> > 
> > ------------------------------------
> > 
> > **** IMPORTANT ****
> > This group is for the discussion between users only.
> > This is *NOT* technical support channel.
> > 
> > *********************
> > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail 
directly to 
> > SUPPORT {at} amibroker.com
> > *********************
> > 
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > *********************************
> > Yahoo! Groups Links
> > 
> > 
> >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/