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

[amibroker] Re: Help undestanding Arrays



PureBytes Links

Trading Reference Links

That is correct ...

Open your intrepatation window and try this code ... it will show all 
bar numbers where a cross buy.

BI = BarIndex();

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

for( i = 0; i < BarCount; i++ ) 
{
    if (Reason[i] == True)
        printf(NumToStr(BI[i]) + "\n");
}

--- In amibroker@xxxxxxxxxxxxxxx, "laster" <laster@xxx> wrote:
>
> I stand corrected. It does produce a signal every high.
> 
> My concern though is not with that, it with this part of the code:
> 
>  
> 
> Reason= Cross( MACD(12,26), Signal(9) );
> 
> for( i = 0; i < BarCount; i++ ) 
> 
> {
> 
> if (Reason[i] == True)
> 
>             {
> 
> My understanding is that I should only have a signal if there is a 
cross of
> the MACD and the Signal at the i bar. However, I am producing a 
signal at
> every bar regardless of the cross. That's why I was telling you the 
issue is
> not with the buy statement, but with the if section.
> 
> Thanks,
> 
> Jerry
> 
>  
> 
>   _____  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On Behalf
> Of Fred
> Sent: Saturday, October 14, 2006 14:45
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Help undestanding Arrays
> 
>  
> 
> Buy is like a light switch ... On or Off, it is NOT a methodology 
to 
> take action at a price ...
> 
> Buy = H ... Tells AB to Buy on EVERY BAR at the HIGH of that 
Bar ... 
> Why ? ... because BUY and H are arrays ...
> 
> Although incorrect ... If you had said ... Buy[i] = H[i]; ... The 
buy 
> would probably have occured on the bar you wanted it to i.e. the 
same 
> one where the cross occured ... but NOT at the High ... For Buys to 
> occur at specific points you need to use the BuyPrice Array ... 
> 
> PS ... Buying at the H or L price of the current bar is never a 
good 
> idea because these are unknown until the bar is no longer current.
> 
> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> 
ps.com,
> "laster" <laster@> wrote:
> >
> > 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