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

[amibroker] Determining the bar where a signal occurs - one step further



PureBytes Links

Trading Reference Links


Hello,

I know you guys are very helpful, so I guess when no-one answers, no-
one as a clue. Maybe no-one has a clue what I am asking :-)) 

condition1 is based on MACD and Open
condition2 is based on MA and Open

Buy=condition1 and condition2; will deliver many buying-signals in 
exploration and backtest. To calculate trendlines for every Buy-
signal I got to know the number of the bar where it occurs.

Since I asked the forum the first time I found out by myself that:

BuyCondition=condition1 AND condition2;
OpenAtSignal=ValueWhen( BuyCondition, Open,1);

results in an array "OpenAtSignal" with the relevant price-
infomation. Now I can loop through the array and calculate 
trendlines based on the row-numbers of the array. 
But, this is time consuming, is there a faster way to determine the 
barnumber where signals occurred?

ty,
enzo




--- In amibroker@xxxxxxxxxxxxxxx, "enzo" <herrfrechdax@xxxx> wrote:
> 
> Hi,
> 
> I am coding a strategie where buy-signals are depending on a 
certain 
> condition based on MACD(), a condition based on MA() and if a 
> calculated trendline has been crossed.
> 
> The trendline I calculate is based on the number of the bar, where 
> the other conditions will be true. There of 100s of signals.
> 
> The code looks like that (where DownTrendLine is a function):
> 
> CrossDownTrend=IIf(BuyMACDCond AND BuyMACond,DownTrendline
> (flag),False);
> Buy=BuyMACDCond AND BuyMACond AND CrossDownTrend;
> 
> This is to prevent the calculation of a trendline when one of the 
> other conditions is false.
> 
> My question is: how can I determine the number of the bar where 
the 
> first two conditions become true?
> 
> After some hours of checking AFL-examples and studying many AFL-
> functions I cannot figure out how to handle this.
> 
> Thank you in advance,
> enzo





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

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