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

[amibroker] if PositionLong(LastPosition) then



PureBytes Links

Trading Reference Links



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/