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

Re: [amibroker] Simple Question : How do I specify the previous day's price



PureBytes Links

Trading Reference Links

Hello,
 
There is a simpler way:
go to AA, Settings, "Trades" tab and set all trading prices to OPEN and and trade delay to 1.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Tuesday, April 04, 2006 12:48 PM
Subject: Re: [amibroker] Simple Question : How do I specify the previous day's price

On Tuesday 04 April 2006 05:31 am, emp62 wrote:
> you can code that like:
>
> condition = BarsSince( C > Ref(C,-1)) == 3 AND MA(V,3) < MA(V,50);
>
> Buy = Ref(condition,-1); BuyPrice = O;


Ah ha!  This is the proper way to buy at the Open price (O).   This is what
you want to do to simulate putting in an order to buy before the market
opens.   I don't believe I have seen this described anywhere in the docs, but
I may have missed it since I hadnt been looking for it. 

Note that the Buy expression is checking the previous bar's condition (i.e.
Ref(condition, -1)).   You should not buy at the open price based on any
other information for that time (i.e. H, L, C, V), because that would require
time travel, but AmiBroker lets you do it without warning.

Most code examples assume Buy at the Close based on any information during
that time bar.

Thanks emp!

dan


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