10-19-2007
Welcome and hope you find these files of use to you
This zip files includes the following:
ReBal 1 6/07/07 Fred Tonetti -As Robert originally stated ... The code as written sold everything today and repurchased it tomorrow ergo the difference in price which could be seen in the BackTest Results ( and also below ) ...
The changing of the Buy Price to be yesterdays close by modifying the statement in the AFL resolves the problem ...
This should work for all situations except daily rebalancing but then who is really going to rebalance that frequently
The resulting ( oversimplified
) code then could look like this ...
While still "not pretty", with some additional intelligence it could determine
how many items are in the WatchList on its own and/or use some sort of
PositionScoring methodology to decide which issues in the WatchList to buy at
any given reblance point etc. thereby making in essence a rotational system with
so specifying it in the AFL.
Notice how I used a FILTER and
two AddColumn statements to make sure the results I got from the added code were
doing what I expected. These will be shown in AB / AA simply by clicking the
EXPLORE or EXPLORATION button. These don't need to be there for the system to
run ...
The added code is probably beyond AB 101 but I thought I'd toss it in for those
who might be interested ...
Another way to do this using the CBT ...
Warning ... All ye non programmers who enter here ... Abandon all hope of ever
returning ... i.e. a "Programmer's Tool" ...
Not only that ... While not all
that friendly to write code for ... The results while correct are also not all
that friendly either as scale in/out doesn't show individual trades except in
the detailed view ...
However, this does allow daily rebalancing and doesn't require "fudging" of the
BuyPrice array ...
Here's a different, simpler way
to do this using the CBT w/o sigScaleIn/Out that will show all the Trades on the
correct day at the correct price ...
This is a decent framework for a rotational type system with rebalancing that
does not use AB's EnableRotationalMode ... It could be used as the basis for a
variety of other things as well ...
Calendar Base System
6/15/07
Fred Tonetti -
For those wanting to investigate
calendar based systems ...
Because market data is in essence market open based it is somewhat of a PITA to
write generalized CALENDAR based stuff in AFL or most other languages for that
matter.
Here is some AFL to test and/or optimize on a variety of calendar based
occurances i.e.
- End of Month ...
- General Holidays i.e. New Years Day, MLK Day, Presidents Day, Good Friday (
More of a PITA because of the calcs needed to determine where it occurs ... This
may not be a full implementation but is probably correct over the lifespan of
the FT database ), Memorial Day, Independence Day, Labor Day
- Potentially Special Holidays i.e. Thanks Giving & Christmas
With some minor mods this could be used to fully test Mark's post elsewhere
regarding calendar systems once he determines what the exceptions actually mean
... My initial "toying" with my interpretation of what the exceptions that Mark
mentioned meant seemed to indicate they didn't improve things much over the last
20 years. Those interpretations are not in the rules ... However I did leave in
hooks for First and Last session of the week i.e. FSOW & LSOW respectively.