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

Re: [amibroker] Consistent coding structure problem



PureBytes Links

Trading Reference Links

Title: Re: [amibroker] Consistent coding structure problem

You can replace the error causing array with either LastValue() or SelectedValue() whichever is more suitable for you.


Next you may want to use a Switch statement for more efficient coding. Something like this:


HLRange = abs( H - L );

ABC = HLRange > Ref( HLRange, -1 ) AND HLRange > Ref( HLRange, -2 ) AND HLRange > Ref( HLRange, -3 );

XYZ_Check = SelectedValue( IIf( Ref( ABC, -1 ), 1, IIf( Ref( ABC, -2 ), 2, IIf( Ref( ABC, -3 ), 3, 0 ) ) ) );


switch ( XYZ_Check )

{

case 0:

    printf( "XYZ_Check = " + XYZ_Check );

    break;

case 1:

    printf( "XYZ_Check = " + XYZ_Check );

    break;

case 2:

    printf( "XYZ_Check = " + XYZ_Check );

    break;

case 3:

    printf( "XYZ_Check = " + XYZ_Check );

    break;

}



Thursday, November 6, 2008, 12:40:40 PM, you wrote:


> Hi All,


> I keep running into a consistent coding structure problem,


> HLRange = abs( H - L );

ABC = HLRange >> Ref( HLRange, -1 ) AND HLRange > Ref( HLRange, -2 )

AND HLRange >> Ref( HLRange, -3 );

> XYZ_Check=IIf(Ref(ABC,-1),1,IIf(Ref(ABC,-2),2,IIf(Ref(ABC,-3),3,0)));


> if(ABC_Check==0)

> {

>         printf("ABC_Check = " + ABC_Check);

> }

> if(ABC_Check==1)

> {

>         printf("ABC_Check = " + ABC_Check);

> }

> if(ABC_Check==2)

> {

>         printf("ABC_Check = " + ABC_Check);

> }

> if(ABC_Check==3)

> {

>         printf("ABC_Check = " + ABC_Check);

> }


> Obviously I keep getting Error 6 stating that in the 'if(_expression_)'

> statements _expression_ cannot be an array.

> This raises a more generic question... is there a way of programming

> structures like these WITHOUT having to resort to using loops....?


> Any ideas appreciated.


> TIA



> ------------------------------------


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



__._,_.___

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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___