|
Good idea. When you figure out how to do that real-time, I would appreciate seeing the code ;-)
-- Terry -----Original Message-----
Buy High sell Low. Why not? J
From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Terry
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-----
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; } }
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
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 __,_._,___ |
- RE: [amibroker] Help understanding Arrays Terry
