PureBytes Links
Trading Reference Links
|
you could always just use a simple flip if you want to determine if
you are in a trade
InLong = Flip(buy,sell);
InShort = Flip(Short,Cover);
returns 1 for when the trade is active
On Wed, 24 Nov 2004 00:29:11 -0000, hairy_mug <wschwarz@xxxxxxxxxxxxx> wrote:
>
>
> Try these:
>
> function LastPositionActive()
> {
> return (BarsSince(Buy)<BarsSince(Sell)
> or BarsSince(short)<BarsSince(cover));
> }
>
> function LastPositionLong()
> {
> return (BarsSince(Buy)<BarsSince(short);
> }
>
> Note: I am not sure if stops add entries to BUY, SELL, COVER, SHORT
> arrays, so be careful... Maybe someone else knows...
>
> Walt
>
> --- In amibroker@xxxxxxxxxxxxxxx, "bm_alp" <bm_alp@xxxx> wrote:
> >
> >
> > Hi all,
> >
> > you might have realized it, the title comes from a Wealthlab code.
> > Could anyone help me out to express the logic in Amibroker?
> >
> > Please have a look at the code below.
> > buyAtStop types can be implemented using BuyPrice and a Buy=..
> > statement. But what about about a condition like LastPositionActive?
> >
> > Your comments are much welcome.
> > bm_alp
> >
> > begin
> > if not LastPositionActive then
> > begin
> > if cond_A then
> > buyAtStop...
> > if cond_B then
> > shortAtStop...
> > end
> > else
> > begin
> > if PositionLong(LastPosition) then
> > if cond_B then
> > SellAtStop...
> > if PositionShort(LastPosition) then
> > if cond_A < priceOpen(bar)) then
> > CoverAtStop...
> > end;
> > end;
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
--
Cheers
Graham
http://e-wire.net.au/~eb_kavan/
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|