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

Re: [amibroker] Re: count bars since entry



PureBytes Links

Trading Reference Links

Hello,

Cross( array1, array2 ) generates only 1 signal when array1 crosses above array2,
while array1 > array2 will give you MULTIPLE signals for all the bars
since array1 crossed above array2 until the day when array1 drops below array2

Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com


----- Original Message ----- 
From: <bmx888@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, November 10, 2001 10:40 PM
Subject: [amibroker] Re: count bars since entry


> Thanks. It eliminated excess signal. Why there is such a big 
> difference between 
> Buy = Cross( BuyPrice, Low ); 
> and Buy = BuyPrice>Low; 
> 
> I also tested 
> Buy= BuyPrice>Low and Buyprice< High;
> and it seems to give yet another result. 
> 
> Thank you very much.
> 
> --- In amibroker@xxxx, "Tomasz Janeczko" <amibroker@xxxx> wrote:
> > Hello,
> > 
> > Why don't you use Cross function?
> > 
> > BuyPrice =Ref(LLV(L, 3), -1) ;
> > Buy = Cross( BuyPrice, Low ); 
> > sell= ref(buy, -5);
> > 
> > (You may also add this at the end:
> > 
> > Buy = ExRem( Buy, Sell );
> > Sell = ExRem( Sell, Buy );
> > )
> > 
> > Best regards,
> > Tomasz Janeczko
> > ===============
> > AmiBroker - the comprehensive share manager.
> > http://www.amibroker.com
> > 
> > ----- Original Message ----- 
> > From: <bmx888@xxxx>
> > To: <amibroker@xxxx>
> > Sent: Saturday, November 10, 2001 7:17 PM
> > Subject: [amibroker] Re: count bars since entry
> > 
> > 
> > > Hi Tomasz,
> > > 
> > > Thanks for the reply. It works better. The system is still 
> confused 
> > > when it sees several buy signal in a row. Here is my test system.
> > > 
> > > BuyPrice =Ref(LLV(L, 3), -1) ;
> > > Buy =Low<BuyPrice; 
> > > sell= ref(buy, -5);
> > > 
> > > It can geneate several signals in a row. When I test it on BA, I 
> got 
> > > 6/29/01 entry and 6/29/01 exit.
> > > 
> > > I guess my question is related to position management which is 
> very 
> > > tricky in writing the logic there. Would it be possible to add 
> > > a "position" function to describe current position (long, sort, 
> > > neutral). Then I can write
> > > Sell=barssince (position=1)>5;
> > > 
> > > Thank you,
> > > 
> > > Bai
> > > 
> > > Since it can generate several buy signal in a row so sometimes 
> the 
> > > system close when 
> > > --- In amibroker@xxxx, "Tomasz Janeczko" <amibroker@xxxx> wrote:
> > > > Hello,
> > > > 
> > > > First:
> > > > if you write buy=1 you ASSIGN 1 to buy variable.
> > > > To check if it is equal you have to use double = operator:
> > > > 
> > > > buy == 1
> > > > 
> > > > but it is not necessary because AFL works in a way
> > > > similar to C/C++: zero value are treated as "false" and
> > > > non-zero values are treated as "true", so you can write:
> > > > 
> > > > sell = barssince(buy)>5; // sell after 5 bars from the last buy 
> > > signal
> > > > 
> > > > For repeating buy signals it is better to use
> > > > 
> > > > sell = ref( buy, -5 ); // sell after 5 bars from the initial 
> buy 
> > > signal
> > > > 
> > > > 
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > ===============
> > > > AmiBroker - the comprehensive share manager.
> > > > http://www.amibroker.com
> > > > 
> > > > 
> > > > ----- Original Message ----- 
> > > > From: <bmx888@xxxx>
> > > > To: <amibroker@xxxx>
> > > > Sent: Saturday, November 10, 2001 6:17 PM
> > > > Subject: [amibroker] count bars since entry
> > > > 
> > > > 
> > > > > I use the following to count bars since entry and it did not 
> work.
> > > > > Is there any function in AFL that refers to position?
> > > > > 
> > > > > sell=barssince(buy=1)>5;
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to 
> > > http://docs.yahoo.com/info/terms/ 
> > > > > 
> > > > > 
> > > > >
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> > > 
> > > 
> > >
> 
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
>