PureBytes Links
Trading Reference Links
|
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 amibroker@xxxxxxxxxxxxxxx, "tycanadian2003" <tyrules@xxx>
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
>
|