Of course, you don't need loops to do what Jerry's doing anyway
BUT!!!
"Buy" is an array of true/false values (ignoring scaling etc) NOT an array of High prices
so Jerry is still going to come unstuck.
 
 
----- Original Message -----
From: Terry
Sent: Sunday, 15 October 2006 11:47 AM
Subject: RE: [amibroker] Help understanding Arrays

The thing you are missing in the below is you have FORGOTTEN to use the subscript in your loop, thus you are setting the ENTIRE ARRAY to True. The last line of your loop should look like this and it will do what you are expecting.

 

            {

            Buy[i] = H[i];

}

 

Actually, this is technically incorrect because, as Fred said, Buy is a light switch, either 0 or 1. This sets Buy to the High. However it still works because Amibroker treats ANY NON-ZERO Number as true, even a negative one.

 

PS: I hope you are taking Fred's advice about not buying at the high ;-)

--

Terry

-----Original Message-----
From:
[EMAIL PROTECTED]ps.com [mailto:[EMAIL PROTECTED]ps.com] On Behalf Of laster
Sent: Saturday, October 14, 2006 11:21
To:
[EMAIL PROTECTED]ps.com
Subject: [amibroker] Help undestanding Arrays

 

Hi,

Still trying to figure out working with Arrays, and itÂ’s apparent there is something I am not getting.

My understanding of the following is: If in the i bar the cross of the MACD was true, then Buy at the High. However, Amibroker is buying in several circumstances (including when the condition is true).

Can somebody smarter than me please translate the following formula into English so I can finally get it?

Thanks a lot again,

Jerry

 

 

Reason= Cross( MACD(12,26), Signal(9) );

for( i = 0; i < BarCount; i++ )

{

if (Reason[i] == True)

            {

            Buy = H;

}

}



__________ NOD32 1.1803 (20061013) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

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






SPONSORED LINKS
Software support Small business finance Business finance online
Business finance training Business finance course

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

__,_._,___

Reply via email to