PureBytes Links
Trading Reference Links
|
Thanks - that's much nicer!
Steve
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> wrote:
> Steve,
>
> "Latch" in AmiBroker is built-in function called Flip
> http://www.amibroker.com/f?flip
>
> tr = Flip( entry, exit );
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "steve_roweau" <affrica@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, September 30, 2005 11:17 AM
> Subject: [amibroker] Re: Bitten the bullet on loops
>
>
> >I use something that I learnt (in the old days with MS) called a
> > latch that
> > can be useful. I tend to avoid loops if there is another way;
> >
> > // Entry & Exit criteria
> > entry = Entryconditions...;
> > exit = ExitConditions...;
> >
> > // Roy Larsen's latch
> > I = Cum(entry + exit > -1)==1;
> > tr = BarsSince( I OR entry) < BarsSince(I OR exit);
> >
> > // Target set when buy triggered
> > targetloss = ValueWhen( Cross(tr, 0.5), Loss, 1);
> > targetProfit = ValueWhen( Cross( tr, 0.5), profit, 1);
> >
> > Buy = entry AND Ref(tr, -1) == 0;
> > Sell = exit OR ((C > targetprofit OR C < targetloss) AND Ref(tr, -1))
> > ;
> >
> > In the above code there are a few variables that need to be specified
> > (ie
> > Loss, Profit etc) but it does work to set these targets without
> > loops. My
> > translation from MS is probably a bit rough but it does the job for
> > me.
> >
> > Steve
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Charles Stangor"
> > <cstangor232@xxxx>
> > wrote:
> >> Graham.
> >>
> >> I think your last comment about loops makes some sense to me and is
> > in
> > fact
> >> exactly the issue I have been working on. Sometimes you need
> > variable x
> > to
> >> define variable y, but you can't define x until you define y !!
> >>
> >> For instance:
> >>
> >> Buy = Buycond and NumberofPriorBuys < 3;
> >> NumberofPriorBuys = sum(buy, barssince(daystart));
> >>
> >> But how can I use a loop to solve this mess?
> >>
> >> Thanks in advance...
> >> ----- Original Message -----
> >> From: "Graham" <kavemanperth@xxxx>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Thursday, September 29, 2005 7:23 PM
> >> Subject: Re: [amibroker] Bitten the bullet on loops
> >>
> >>
> >> > Loops are best used when you need to refer to a previous value of
> > a
> >> > variable in calculating the current value of that same variable.
> >> > There are other cases where loops are preferable, but I first try
> >> > "normal" AFL functions and methods first. If at first they don't
> >> > succeed get loopy
> >> >
> >> > --
> >> > Cheers
> >> > Graham
> >> > AB-Write >< Professional AFL Writing Service
> >> > Yes, I write AFL code to your requirements
> >> > http://e-wire.net.au/~eb_kavan/ab_write.htm
> >> >
> >> >
> >> > On 9/30/05, Charles Stangor <cstangor232@xxxx> wrote:
> >> >> Are you guys writing loops because you just can't do what you
> > want
> > using
> >> >> the
> >> >> regular ++ code? I'm getting convinced it's the way to go.
> > Thanks
> > for
> >> >> the
> >> >> great code.
> >> >
> >> >
> >> >
> >> > Please note that this group is for discussion between users only.
> >> >
> >> > To get support from AmiBroker please send an e-mail directly to
> >> > SUPPORT {at} amibroker.com
> >> >
> >> > For other support material please check also:
> >> > http://www.amibroker.com/support.html
> >> >
> >> >
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|