[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

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


------------------------ 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/