I'm just getting started with AB and have been reading Kaufman's
Trading systems book. It came with a CD with a number of easylanguage
programs for use in tradestation. I'm not much at programming but I
was curious if it is very difficult to translate these programs to
AFL. Here is an example of a breakout program in easylanguage:
TSM N-Day Breakout 2
This system uses function(s) found in Chapter 5 to generate trading
signals. Two inputs are required: the type of data (interest rates are
converted to approximate yields if types 2 and 3 are used), and the
number of periods to determine the highest high and lowest low for the
breakout signal.
{ TSM N-Day Breakout 2
Copyright 1994-2004, P J Kaufman. All rights reserved. }
{ type = 0, default, use price
1, 3-month rate
2, long-term rates
period = length of calculation }
input: type(0), period(20);
vars: phigh(0), plow(0), pclose(0), nhigh(0), nlow(0);
phigh = high;
plow = low;
pclose = close;
if type = 1 then begin
phigh = 100 - low; { 3-month yield }
plow = 100 - high;
pclose = 100 - close;
end;
if type = 2 then begin
phigh = 800/low; { approx. bond yield }
plow = 800/high;
pclose = 800/close;
end;
nhigh = highest(phigh,period)[1];
nlow = lowest(plow,period)[1];
{ Buy and sell signals }
if phigh > nhigh and pclose > pclose[1] then begin
if type = 0 then buy on close else sell on close;
end;
if plow < nlow and pclose < pclose[1] then begin
if type = 0 then sell on close else buy on close;
end;
thanks, Ken