[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,

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@xxxxxxxxxxxxxxx>
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/ 
> 
> 
>