Hi there, Thanks for the reply, it does provide some insight for me. I am familiar with the Buy/Sell/Short/Cover and BuyPrice/Shortprice...arrays, and you were correct in that the hard part seems to be making it remotely efficient :). Ideally I'd like to read every ticker, trade type (long/short), date, and entryprice into arrays within AmiBroker and then as the backtester iterates over each symbol, it would check these arrays for any occurrence of the symbol, and for each occurrence it finds it will look at the corresponding dates and append a "1" in the "Buy" array for that date as well as the proper BuyPrice.
Any further suggestions on how to accomplish this or make it faster are most welcome! Thanks again for the reply. --- In [email protected], "Metasan" <[EMAIL PROTECTED]> wrote: > > That can be implemented by writing code to modify > Buy/Sell/Short/Cover and BuyPrice/SellPrice/ShortPrice/CoverPrice > arrays. > > The difficult part is converting date to bar index number. > The code below will be very very slow since you have to loop through > all bars for all trades in your file for all symbols, but may give > your some ideas: > > // loop through every line of the file: > // assume that ticker, month1, day1, year1, buyprice1 are the fields > from the file > > if(ticker == Name()) > { > m = month(); > y = year(); > d = day(); > for(i=0; i<BarCount; i++) > { > if(m[i] == month1 and d[i] == days and y[i] == year1) > { Buy[i] = 1; BuyPrice[i] = buyprice1; } > } > } > > --- In [email protected], "tycanadian2003" <tyrules@> > wrote: > > > > Hi, > > > > I'm trying to read in trades from a CSV file, whose format is : > > > > TICKER,(LONG OR SHORT),DATE,ENTRY PRICE,EXIT PRICE > > > > This part I can kind of do (I know how to read and write to > files). > > However, I'd like to use this data in backtests for a few thousand > > symbols with intraday data. My confusion comes when I'm trying to > > figure out how to read in all the data from the CSV file and then > use > > it to generate buy and sort signals in the backtester. For > example, > > if a line in my CSV file is: > > > > INTC,Long,08/08/2006,17.40,17.45 > > > > I want to be able to extract that information in my AFL code, and > as > > I'm backtesting through many symbols, when the backtester gets to > > INTC, I want it to have a BUY signal for INTC on 08/08/2006 with a > buy > > price of 17.40. In case you're interested, I'm backtesting to try > to > > optimize the best time of day to exit my trades since I recently > > subscribed to an intraday data service. > > > > Efficiency may also be an issue, but for now I'd just love for it > to > > work. Can anyone help me get started? I know how to open the file > > and grab the strings, but that's about it. > > > > Thank you very much! > > > > Tyler > > > 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: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
