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

RE: [amibroker] Help understanding Arrays



PureBytes Links

Trading Reference Links

Good idea. When you figure out how to do that real-time, I would
appreciate seeing the code ;-)

 

--

Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of laster
Sent: Sunday, October 15, 2006 07:08
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Help understanding Arrays

 

Buy High sell Low. Why not? :-)

 

  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Terry
Sent: Saturday, October 14, 2006 23:47
To: amibroker@xxxxxxxxxxxxxxx
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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of laster
Sent: Saturday, October 14, 2006 11:21
To: amibroker@xxxxxxxxxxxxxxx
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;

}

}

 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006