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

Re: [amibroker] Buy / Sell commands / ASX imports



PureBytes Links

Trading Reference Links

Hello,

> Hi all,
> I'm a new user. (Win98, V3.30) Can anyone help with these questions:
> 
> 1. When the buy/sell criteria are satisfied, at what price does 
> Amibroker buy/sell and on what day?
> I'd like to set up a buy/sell simulation along the lines of:
> Find when the close has been over the moving average for 2 days in a 
> row, then buy at the high (or the low or the close) on the 3rd day.

Currently, when performing system back-test, AmiBroker buys/sells at close
price on day when signal occurred. Please keep in mind the fact that most
signals appear AFTER the fact. For example cross() function returns "true"
*after* two lines have crossed (it needs one day more to determine that cross 
occured). 
To test that given signal appears two days in a row use ref() function,
for example following code will check if close price crossed above moving average
yesterday and it is still above today:

movavg = ma( close, 15 );
signal = ref( cross( close, movavg ), -1 ) AND close > movavg;

You can also use hold() function for "holding" given condition over specified period:
signal = hold( cross( close, movavg ), 3 ) AND close > movavg;
(this will return true if close price is above moving average AND during last three days
close price crossed above moving average).

To move buy/sell signals back/forward in time you can use ref() function;

buy = ref( buysignal, 1 ); // this will move buy signal one day forward

> 2. The ASX files discussed in earlier posts have multiple lines of 
> data for the same stock ticker eg for ANZ:
> 
> "ANZ","XXY","AUSTRALIA & NZ BANK",05-Apr-
> 2000,4630.000,4630.000,4630.000,4630.000,8
> 
> "ANZ","XXZ","AUSTRALIA & NZ BANK",03-Feb-
> 2000,4755.000,4755.000,4755.000,4755.000,5
> 
> "ANZ",,"AUSTRALIA & NZ BANK",23-Jun-
> 2000,12.180,12.285,12.170,12.290,2843681

You can replace DATE_DMY in $FORMAT command by SKIP.
This will ignore date field in the file.
But then you have to add by hand $DATE_DMY 23-Jun-2000 at the beginning
of the file, so all quotes will be stored with that date.

> 
> I only want the last one, but I can't see how AMIBROKER's ascii 
> import can distinguish between all other other ANZ data?
> If you have mulyiple data with the same date for one ticker, what 
> happens then
Yes, this is exactly the case of what will happen if you do
what I wrote above. AmiBroker simply will overwrite the quotation
data over and over again, so the LAST one will "survive".


Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
Web site: http://www.amibroker.w.pl
Mailing list: amibroker@xxxx