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

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



PureBytes Links

Trading Reference Links


Thank you kaveman,

this is perfect! 



--- In amibroker@xxxxxxxxxxxxxxx, kaveman perth <kavemanperth@xxxx> 
wrote:
> try this
> 
> BarAtSignal=ValueWhen( BuyCondition, BarIndex(),1);
> 
> 
> On Thu, 28 Oct 2004 10:53:48 -0000, enzo <herrfrechdax@xxxx> wrote:
> > 
> > 
> > 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
> > 
> > 
> > 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
> > 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Cheers
> Graham
> http://e-wire.net.au/~eb_kavan/





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/