PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Owen Davies" <owen5819@xxxx> wrote:
> 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.
Owen,
To count repetitions of eventB after any occurrence of eventA use the
difference of total sum of event B minus the sum when eventA was true.
An example for your IB
eventA=Cum(1)%20==0;Plot(eventA,"eventA",5,1);// every 20 bars
eventB=Cum(1)%9==0;Plot(2*eventB,"eventB",7,2);// every 9 bars
C1=ValueWhen(eventA,Cum(eventB));
Counter=Cum(eventB)-C1;
Plot(Counter,"Counter",4,8);
Dimitris Tsokakis
>
> 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/cjB9SD/od7FAA/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/
|