10-18-2007
Welcome and hope you find these files of use to you
This zip files includes the following:
Development of systems 6/02/07 Fred Tonetti -Development of systems on it's own is a relative term ...
I think it highly doubtful that any time soon you'll be able to point at a
security or at a watchlist and provide some highly generalized criteria like Max
Trades Year less than X, Car greater than Y & MDD less than Z and push a button
and have AB ( or anything else ) generate a system and get decent results
without anything else ...
What I discussed briefly at the end of my presentation at the first conference
that I was at was the additional capabilities that IO allows because of the fact
that the number of variables that are being optimized has virtually no impact on
run time. This allows optimization to be used for other things that you might
not immediately think of ...
One of these things is what I referred to at the time as rule creation,
selection and combination ...
In a simple example let's assume we have a few potential indicators we might
want to use like a Stochastic, MACD, RSI and an ROC. Combining these in some way
into an effective system while seemingly straight forward might take a very long
time using hunt and peck and because of the limitations of exhaustive search
normal optimization processes won't help us much.
I won't code the whole thing and this is off the top of my head so it may not be
syntactically correct but the purpose here is to demonstrate the concept.
For the first component ( Stochastic ) we have the following basic parts ...
Len1 = Optimize("Len1", 1, 1, 100, 1);
Len2 = Optimize("Len2", 1, 1, 100, 1);
Len3 = Optimize("Len3", 1, 1, 100, 1);
RHHV = HHV(C, Len1);
RLLV = LLV(C, Len1);
StoX = IIf(RHHV == RLLV, 50, 100 * (C - RLLV) / (RHHV - RLLV));
StoEMA = EMA(StoX, Len2);
StoTrg = EMA(StoAMA, Len3);
StoBuy = StoEMA > StoTrg;
StoSell = StoEMA < StoTrg;
Let's assume that for the other components we have the appropriate code in place
that result in:
MACDBuy, MACDSell ... RSIBuy, RSISell ... ROCBuy, ROCSell.
There are of course lots of ways the results of these individual buy & sell
signals can be combined but for the purpose of this post lets assume that some
number of selected components will be used to generate buy and sell signals and
those may not be the same components on the buy side as on the sell side.
So ...
Lets add ...
UseStoBuy = Optimize("UseStoBuy", 1, 0, 1, 1);
UseStoSell = Optimize("UseStoSell", 1, 0, 1, 1);
... and we'll add other on/off (Use) flags for the other components ...
This will then allow us to write additional optimize statements and Buy / Sell
statements like what are below ( I Used GTEQ to represent greater than or equal
to in what's below becuase the forum s/w is sometimes "fussy" about how it
treats things like this ...
BuyTot = Optimize("BuyTot", 1, 1, 4, 1);
SellTot = Optimize("SellTot", 1, 1, 4, 1);
Buy = UseStoBuy * StoBuy + UseMACDBuy * MACDBuy + UseRSIBuy * RSIBuy + UseROCBuy
* ROCBuy GTEQ BuyTot;
Sell = UseStoSell * StoSell + UseMACDSell * MACDSell + UseRSISell * RSISell +
UseROCSell * ROCSell GTEQ SellTot;
When optimized this combination of statements then will find the best
combination of buy side and sell side components to use and how many of them
need to be in place to generate respective buy and sell signals with the best
results.
IO in this case allows a type of problem to be solved that can not really be
solved any other way ...
In sample results, sensitivity and out of sample results ... A tale of two
optimizations ...
Lets take the same system ( RuttrFT ) and optimize for RYOTX from 1/1/92 -
12/31/99 to get the best parameter values we can in terms of CAR / MDD and then
see how the system performed from 1/1/2000 forward ... In the first optimization
we won't take the sensitivity of those parameters into account at all, in the
second we will use parameter sensitivity as a means to influence where in the
solution space optimization looks to arrive at parameter values ...
In the results of the first
optimization we can see that the in sample numbers are a little better and in
terms of Fitness ( CAR / MDD ) are actually 45-50% better ...
However, in comparing the out of sample numbers we see that the second
optimization which was guided by parameter sensitivity has slightly less CAR but
significantly lower DD's and on fewer trades making the resulting OOS fitness
more than 60% better than our first run where we ignored the parameter
sensitivity ...
This is why as I stated earlier ... For any two systems or two sets of parameter
values I can not tell which is better or likely to perform better out of sample
simply by looking at the standard performance metrics ...
Detailed Screens ...
To finish my thoughts on the
question you asked about and my comments on rule creation, selection and
combination ... Here's some AFL along with the results from optimization
incuding an equity chart and trade list ... Not horrible ( 18 winners out of 19
trades ) when you consider how quickly this was slapped together and the fact
that optimization did all the decision making on how to combine things and how
heavily to weight each ...
Other areas that come to mind that IO can be used in besides traditional optimization and the kind of application shown here are data mining and pattern recognition ... It's capable of almost anything you throw at it ... But like with this example you have to at least give it a clue ...
A different version
ZZ.afl 6/03/07 Fred Tonetti -To back up for a moment ...
Any time I write trend
following type systems, I always want to know what the results of the best
possible solution is ...
Here's one way to get a feeling for that ...
... and here's the goal albeit unreachable but it's still useful to know what it
is ...
Buy and Hold
6/06/07
Robert Krishfield -Here's
a program for running B&H portfolios in AB and doing rebalancing. The solution
is not elegant - it sells everything and then buys on the next day at equal
portions. The sell/buy interval is set as a parameter from 0 (no rebalancing),
1= once a month, 2=every 2mo, 3=every 3 mo, etc. This will trigger on the first
trading day of the month (which is probably poor) and some tweaking might be
needed to improve it.
I made some runs with the list of funds Dave provided and ran them from 6/1/00
to 6/1/07 and the numbers are below. The top row is the FastTrack equivalent for
the average of these using the List Avg (which like FamAvg is equivalent to
daily rebalancing)
For the BuyHoldRebal program...
I forgot to mention the setup needed in AA.
1. Make a watchlist of the funds you want to evaluate
2. Set the AA filter to that watchlist
3. Set the parameter to the number of funds in the watchlist
4. Set the parameter for the rebal interval (0 - 12)
5. Set the date range from/to as desired
6. Input a run id to track results in the report list
Run Backtest using Portfolio mode (not individual)