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

Re: Please help extend function of condition counter (Was Re: [amibroker] Re: Resetting counter)



PureBytes Links

Trading Reference Links

UM kindly wrote:


> Hi, try the barssince() function:
>   cr  = Cross(C,MA(C,20));
>   bs = barssince(cr);

Thanks, UM.

The problem comes up when we look at a Buy (or Sell) condition that can
happen repeatedly.  For example, look at the Larry Williams volatility
breakout:

Buy = H > O + N * (Ref(H,-1) - Ref(L - 1));
BuyPrice = O + N * (Ref(H,-1) - Ref(L,-1)) + Tick;

Every time another bar meets the Buy condition, "bs" gets reset.

No doubt I should have made it clear that this was half the problem I wanted
to solve.

The other half is that it's not the bars I need, but the number of times an
event has occurred since the first occurrence of some other condition.

Let's say that you want to exit after the second close in the wrong
direction appears at random in a string of with-trade closes.  How would you
do it?

Or any variation on that theme:  Count repetitions of event B after the Nth
occurrence of event A.

ExRem helps in dealing with trade entries but does not seem to be a
universal solution to repetitions of event A.

Thanks again.

Owen Davies


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/