[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimal f code for Tradestation Part I



PureBytes Links

Trading Reference Links

>(I'll send this just to you since your post hasn't made it to the
>list yet.  You can forward the response to the list if you like.)

OK

> > Economists have long used the concept of "utility curves" to show
>> investment preferences.
>
>Let me see if I understand how you derive these things.
>
>The black curve describes the system results.  This will be different
>for each system.  I'm tired so I may be a bit dense right now, but
>how do you derive this -- by calculating the std dev of returns for a
>series of trades with various leverage levels, or is there a more
>straight-forward way to do it? 

Using TradeStation, for a given value of Leverage (an input parameter
in the "trading system") I calculate both annualized return and
annualized standard deviation of returns using real price data on the
S&P 500 index as data1. I print a line in the print log containing
Leverage(input), Return, and Standard Deviation. I then "optimize"
this over all values of Leverage from 0 to 15 and this gives me 16
lines in the print log. I then import the print log into Excel and
plot the Return vs. Standard Deviation black curve.

>I think this could be a useful visual tool for evaluating a system. 
>I'd love to see a spreadsheet that could accept a series of trades
>(like an optf spreadsheet) and generate this curve.

The above process works well and is pretty easy.

>The red curves, which I think are the utility curves, are more of a
>mystery to me.  How did you derive those?  Is that the curve where
>risk * return is a constant?  (Except the curve crosses the StdDev=0
>axis, going into negative territory, which I don't quite understand.)
> You said they had "constant utility" but I'm not certain how
>"utility" is defined.

Utility curves are subjectively determined, usually by interviewing
the person. "Which would you prefer A vs. B?"  After a series of
questions, the interviewer can usually determine the shape of the
curve for that person at that point in his or her life. The
particular curve I drew is called an "Indifference Curve" indicating
that the person is "indifferent" to choices represented by all points
on the curve. The use of the concept dates back at least to 1738 with
Daniel Bernoulli and the "St. Peterburg Paradox".

Utility tends to be proportional to the logarithm of wealth;

     Utility = K * Log(Wealth)

The richer you are, the less interesting one additional dollar of
wealth will become. Therefore, if you have $100,000, and are given
the opportunity to win or lose $50,000 on a fair coin toss, most
people will not take the bet since the utility of increasing your
wealth to $150,000 is much less than the utility of decreasing your
wealth to $50,000.

It is more of a "concept", illustrating how people make decisions
involving risk and reward in their daily lives. The two people I used
in my example are pretty easy for most people to identify with which
makes it easy to illustrate the concept.

>The granny lady who wants 8% has the curve A, but I don't see how you
>get that.  Is it just a happy accident that the "system" intersects
>8% at the same place curve A touches it?  (I suspect not!)

There are a family of indifference curves, all with the same general
shape. The Utility is the same at all points on each curve of the
family. The Utility is greater on indifference curves located toward
the upper left corner on the chart. The point where one of the curves
just touches the black line (representing the available investment
opportunity) is the optimum point for that person with that
investment opportunity since operating at that point results in the
highest Utility for that person trading that "system" in that "market".

This wasn't intended as a lesson in economics theory. I was just
trying to point out that for any person to want to operate at the
Optimal_f point, their Indifference Curve would have to be a flat
horizontal line touching the black curve exactly at the peak. No
reasonable person would have an indifference curve that totally
disregards risk so no reasonable person would ever want to operate at
Optimal_f.

This does not mean that we should not understand the concept. The
concept is important and we should be obligated to Vince for pointing
it out. It is also obvious that we should never operate to the right
of Optimal_f which is easy to do accidentally. For example, assume
that you are trading one S&P big contract with the trading system of
my example (not recommended). Assume you start out with an account of
$70,000. At that point your effective leverage is 5 (=
350,000/70,000). Now assume you lose money to where your account is
only $35,000 but you still trade one contract. The effective leverage
is now 10 (=350,000/35,000) and you are operating to the right of the
Optimal_f point.

Vince discusses Utility Theory in his most recent book (page 81-94).
He says he "is not a great proponent of utility theory, [but]
accept[s] it for lack of a better explanation for investor
preferences." He has a section on "Finding Your Utility Preference
Curve" on page 86.

Bob Fulks