PureBytes Links
Trading Reference Links
|
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;
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/
|