- 金币:
-
- 奖励:
-
- 热心:
-
- 注册时间:
- 2004-2-6
|
|

楼主 |
发表于 2004-8-31 17:09
|
显示全部楼层
Many successful money managers trade systems that do take the same trades without trying to measure 'market environment'. The size of the trade is determined by the money management parameters which again are systemized rules. They do not change from trade to trade. One could also build rules to react differently to different 'market environments'. That would be part of the system. System or mechanical trading is not limited to anything but a set of rules that govern each and every trading decision. These rules are decided before hand.
This example also assumes that one has a system that provides a market edge. This also assumes that the trader has the ability to correctly follow the system. Both of these are large assumptions.
A system will have winning trades and losing trades, but the winning trades either from their number or their size, will make up for the losers and leave a profit. From this scenario the trader MUST trade the exact same way for every trade/environment. He/she has an edge. If the edge is used the same way every time over a large enough set, a profit will be made. The trader acts as the HOUSE in a casino. The edge works for him. You apply the edge the same way over and over. While you know certain market action will produce losing trades, you also know that the winning trades will overcome that. You do NOT want your judgment getting in the way. If someone was paying you 7-5 every time you correctly guessed heads but only 4-5 every time you correctly guessed tails, you would not sit out flips or throw in some tails guesses. You would sit and guess heads until you had all the money you wanted. IF you can correctly determine 'market environment', then you should work that into your system.
Most good systems have fewer than three parameters, filters etc. They are very simple which adds to their 'robustness'.
Scot Billington
- emotions can be managed but not controlled
- view each trade merely one in a series of probabilities
- know why you take a trade and what must happen for you to remain in it (!!!).
If it fails to happen - get out even if your stop has not been triggered.
- You cannot have one without the other. It is not the 'system' (and I despise that word when it comes to trading) that makes the trader, it is the
trader that makes the 'system'.
- important: the ability to trade WITHOUT a BIAS or OPINION as to market direction (NO EGO), and realize that there is no such thing as
overbought/oversold, and no price is too high to buy or too low to sell. You also need to learn to like your losses as they just put you one step closer to a winning Trade(s) and are nothing more than the cost of doing business.
- I take the same trades each day, but how I manage each trade is dependent upon my read of the environment (discretion). You cannot trade
the exact same size and exit the exact same way for every trade/environment. For example, a trending market requires a different approach than a range bound market. In the end it boils down to your ability to read the PRICE action and adopt your game plan to the current conditions - AND THEN EXECUTE. And all you 1-lot traders out there better re-think your approach as trading 1-lots is a fool's game (***!!!***). You are far better off trading 3 ES/NQ than you are trading 1 SP/ND. I'll make the same challenge to the 1-lot traders that my mentor made to me when I was a 1-lot trader - I'll trade 3 NQ/ES to your 1 ND/SP and we'll see who wins. I took him up on that and he cleaned my clock... I have not traded 1-lots since and never will again.
Trading is all about management - yourself, your money, your attitude and your position. It is NOT
about predictions, forecasts or OPINIONS. You cannot learn how to drive a car without being behind the wheel - and you can't learn
how to trade by just reading a book, attending a class or buying a 'system'.
Bob Heisler bheisler@swbell.net http://www.rjhtrading.com
System trading is only good if the computer automatically enters the orders, the stops and the exits. If not, if the individual decides to not take a trade the system is flawed. I only know of one person that is set up this way. He uses a break out system and it produces approximately 37% winning trades. His profit picture is about a 22% annualized return. I did not see his sheets or look at his numbers. But the computers do put in all the trades.
Any system where an individual trader puts in the order is discretionary to a degree. The party that says he is trading totally system may be using the system as a crutch to blame for the losing trades.
The system I use is 80% mechanical and 20% discretionary. If I lose it is my mistake, the system has a 20% losing factor, but I have to look at it as my error. I am not blaming myself for the lose, I am saying that the lose is part of the system. I developed the system, therefore the lose is mine. If I did everything the system said to do, and took every trade the system gave me, then I could blame the system if my percentage of winners to losers changes. If my profit per trade goes down, or if the graph of my profits has lower highs and lower lows, I look for a problem, not in the system, but in me.
If you did what the system said and you lost money, it was still a good trade. It is good only because you had the discipline to follow the system. Did you bother to analyze the trade after the close to see why the trade lost? Was there something that you didn't see? Was it something that you over looked? With me, I usually find that I got lazy and didn't do my homework. I assumed that because I was successful that I was bullet proof. Not so. No one is bullet proof. Self, ego, and the psychological need to be right are the discretionary traders worst nightmare. The other problem is ones belief system.
Taking everything into consideration, I still believe that the human brain is the best computer ever developed. The thing that people forget is that the brain sees in pictures and not in numbers. The first thing most traders want to know is to were do I get in and how much will I make. This is overbought or oversold. Volume is up or volume is down. They start seeing numbers and figuring. They start back testing, they start using indicators that they don't understand. They look at the past rather then the future. Wrong, look at the picture and it will tell you the whole story. Like a road map.
A good trader can take almost any system, astro, volume, eliot, Gann, even some of Larry Williams stuff and make a good living. He does it because outside of the system he is looking at the chart and that picture is what triggers his final decision. Like everything in life, you have to visualize what you want to accomplish before you can get there. Trading is a business. You need a plan for everyday that will take care of the contingencies that might arise. With the proper planning there are very few surprises. You won't get rich over night, but you will be able to get there. Many have done it. Ira.
Learn to trade the leading edge of the market, by following the price action. Furthermore, it means only using the very liquid markets with a daily range and movement that is consistent with their ability to withstand drawdowns that their account will allow. Not easy!
Now, clever people with sophisticated computer programs and all the other factors necessary to trade a system, with all its implications, have to have a bank account or other people's money of sufficient size to trade. Most on this list are individual traders who don't have the money or systems. If they cannot trade with discretion, they cannot trade at all.
Therefore, it follows that effective means of day trading is for the little guy and systems, indicators et al, are for those who, shall we say, live to play, rather than play to live.
Bill Eykyn www.t-bondtrader.com
______________________________________________________________________________________________________________
- Which money management strategy best fits your risk profile?
In general terms, the more stable your equity curve, the more aggressive you can be in your money management strategy. It should come as no surprise to those who have studied Optimal f, that it can be aggressive in its position size. Therefore, to properly implement this strategy it should be applied to systems with very stable trading results. Systems with Sharp Ratios above 2, Return Retracement Ratios above 8 and K-ratios above 2.5, will (in general terms) satisfy our stable trading condition. Now in real world trading it is very rare that systems will generate these results. To help focus on the appropriate money management strategies that will fit most trading systems, consider the least aggressive strategy before moving onto the most aggressive strategy. In general terms begin with the Fixed Fractional and Secure f strategies before moving onto Diluted f and the ultra aggressive Optimal f money management strategy. This will save you a great deal of time and effort when testing some of the more popular money management strategies.
______________________________________________________________________________________________________________
Trading Metaphor:
Trading is like driving. Where you want to go etc., the "how much do you want to make" metaphor, depends on me. How fast do I want to go? Well, how much risk do I want to take, e.g., tickets, accidents, etc., or in trading, how quickly do I want to achieve my goals.
How much wear on my car (me and everyone around me) do I want to incurr? I could wear my breaks and tires out by starting and stopping at every stop light - i.e., entering the market by choosing too tight of stops or exits. What if I never get where I'm going? Have I prepared a road map (trading plan) with check points.
______________________________________________________________________________________________________________
A low risk idea is an idea with a positive expectancy that is traded in such a way to allow for the worst possible conditions in the short run
so that you can achieve the long term expectancy.
Q:
Percent Risk Model (using e.g. 2.0% of you capital for position sizing):
if a trade moves in your favor you add additional contracts in different or the same markets?
A:
You might simply decide to keep a constant risk. In that case, you adjust your stop according to your system and peel off (=reduce) contracts when the risk got above the level you wanted to maintain.
Q:
Which is "better" mathematically, a 20% chance of winning a dollar or a 10% chance of winning two? In each case the expectancy is 20
cents but they are clearly not the same. - Why are they not the same?
A:
Question including full background:
In an interview in Stocks & Commodities you described a simple position size game (60% win, 40% loss and expectancy 1.2).
The expectancy is 0.6*1 - 0.4*1 = 0.2 or 20 cents per dollar risked.
I immediately started trying to derive the optimal bet size. In consultation with my colleagues we broke the problem up a little, derived
some intermediate goals and came away with a few results:
1. The first problem was to define "optimal".
We decided that optimal meant "highest risk / reward ratio". Well "reward" was obvious but...
2. So the second problem was "define risk". Do you define risk as the probability that a certain outcome will occur or do you define
risk as the variance of possible outcomes aka standard deviation or do you use something different again?
We found this problem intractable and decided to approach from a different angle.
3. There must be some kind of function which will define optimal betsize - but what are the independent variables? We assumed that the system would have to work regardless of how much money was involved so the betsize couldn't be fixed, it had to be some sort of percentage. Secondly it couldn't only be based on the expectancy of the underlying system. Consider the following two games:
A game with a 50% chance of a 3:1 win and a 50% chance of a 1:1 loss has an expectancy of 0.5*4 + 0.5*0 = 2
No, the expectancy is 0.5*3 - 0.5*1 = 1.50 or $1.50 per dollar risked.
A game with a 100% chance of a 1:1 win and 0% chance of a loss has an expectancy of 1*2 = 2
No, the expectancy is 1.0*1 - 0 = $1.0
Same expectancy but vastly different optimal betsizes.
In each of those cases the Kelly criterion defines the optimal bet size--(i.e., for maximum return only).
We were back to being stumped but at least now we could clearly state the core problem: Which is "better" mathematically, a 20% chance of winning a dollar or a 10% chance of winning two? In each case the expectancy is 20 cents but they are clearly not the same.
How would you define "better"?
Here your opportunity factor would make the key difference. If you only had one chance, I'd want the 20% opportunity. If you have unlimited chances and there was no cost to playing, it wouldn't make any difference unless you like more rewards in which case you'd still want the 20% opportunity.
We are currently refining some software that will answer the question of optimal bet size for you and help you determine what optimal means for you. It will be included with a new money management report that we are planning to offer soon.
Q:
Suppose you have a $10,000 account and wish to trade using volatility. Using an example similar to Van's book, say you want to purchase a $50 stock with an ATR of $4. You elect to set a stop at 3x volatility and you will risk 2% or $200.00. If I understand your logic, this means you could only purchase 200/12 or 16 shares and stay within the guidelines.
Now here is my real question. If you set the stop at 3x volatility, but find statistically that Van is correct, and on average you stop out at 1.5x volatility, then could you increase your risk to 4% and achieve the same results. Somehow this seems mathematically equivalent, but logically I think the overall risk increases.
A:
Volatility has nothing to do with the stop. If the ATR is $4 and your 2% allocation is $200, then you would purchase $50 shares. If you are using a 2% risk allocation (i.e., $200), and your stop is a three times volatility stop, then you would purchase 16 shares. Risk and volatility are not the same thing for position sizing allocations. Since that is the case, your logic is wrong. You would probably only use a volatility allocation when you were using a very tight stop like a dollar. In that case, you would by 200 shares, so a 2% volatility allocation of $50 is safer.
In a nutshell, volatility position sizing is totally independent of your stop. You keep you same stop, you just size your positions based upon volatility.
If you are using stock data, then I wouldn't recommend a volatility stop. I'd trail a 45 day moving average.
You have stated that a good money management plan should involve risking a percentage of total equity and that the volatility should also be
a percentage of total equity. How would one measure volatility so that it is a percentage of total equity?
Answer:
You would measure volatility according to a 10 day exponential moving average of the ATR. Let's say that's $3.00 Thus, for 100 shares of stock it is $300. If you have $100,000 and wanted to trade a 1% volatility algorithm, you could expose $1000 to volatility. Since volatility is $300 per hundred shares, you could have 333 shares.
---------
80% - 90% of traders lose - 10%-20% are consistent winners.
----------
Van Tharp:
3 MM algorithms (Minimum will be taken):
1) 1% of core capital:
a) (core capital - Total outstanding risk)*0,01 = x
b) x / $ value of initial stop = Nr. Contracts I
2) new risk limited (total risk <=25% of equity): before execution: equity * 25% - total risk= y
if y >0, y / $ value of initial stop = Nr. Contracts II
3) ongoing volatility (10 day M.A. of ATR): max 2% of equity
----------
My initial stop I place very close sometimes to close but statistically it works and I always limit my losses to very small amounts when I am wrong. My initial stop is placed 1 tick below the previous days low. As the stock goes up I move my stops up to continually protect my profit.
I will loosen my stops some as the stock moves so as not to get stopped out by general fluctuations, but I generally keep stops with in 10 - 15% of where the stock closes.
----------
!!! Use expectancy + know what it means to be wrong ten times in a row in a good system !!!
Trading Program/Software is difficult because most vendors cater to the model of predicting the market and they give people what they want.
------------------------------------------------------------------------------------------------------------------------------------------------
Market Wizard System -- here's a candidate
Mark Johnson
mjohnson@netcom17.netcom.com
1997/04/21
misc.invest.futures
Here's my test results of a Market Wizard System. It is profitable,
averaging a compound growth rate of 65% per year for twelve years
(net gain 420X in 12 years). It traded an initial stake of $100K
and ran the equity up to $42 million after twelve years.
The system is found on page 60 of LeBeau and Lucas's book,
_Computer_Analysis_of_the_Futures_Market_. Unfortunately that means
the system is unacceptable to Andrew St. John Goodwin, the originator
of this news thread. Ah well, he no doubt has accumulated better
systems anyway. Still, this one might perhaps be useful for
"diversication across a number of different systems," which itself
is a Market Wizard principle.
A few details about my tests:
* I used commissions = $50 per contract per round trip
* I used slippage = 4 ticks per contract per round trip
(for example in the Deutschemark, 1 tick = $12.50 so the
commissions+slippage in DM is $100.00/contract)
* I tested from 01 January 1985 to 18 April 1997 (last Friday)
* I tested the system on the 25 markets that I myself happen
to trade in my own real-money futures account. These
are the markets for which I always have continuous,
up-to-date data files ready for testing:
BP C CD CL CT DM DX ED FY
HG HO HU JO JY KC LB MB MP
NG SB SF TB TU TY US
* I used a Market Wizard "money management" rule: always risk
exactly 2.6% of total (closed + open) account equity on
every trade.
* I used the software package "Trading Recipes" by RW Systems
to perform the tests
* I started the historical test account at $100K. You may
dispute whether this is too much (or too little) to
start simultaneously trading 25 futures markets. But
that's what I did.
File: LEBEAU.GO
Date: 21 Apr 97
----------------------------- Performance Summary ---------------------------
Net Win Loss 42,053,156 Capital Required 36,143
Percent Wins 41.6% Date of Requirement 850404
Trades, Trades Rejected 1427 0
Wins 594 153.3M Total Slpg + Commssn 24,733,183
Losses 833 111.2M Start Up Capital 100,000
Long Wins 346 94,867,737 Margin Calls, Max 0 0
Long Losses 427 52,638,274 Max Items Held 13,617 970404
Short Wins 248 58,478,932 Days Winning, Losing 1630 1424
Short Losses 406 58,655,237 Expectation, Kelly 22.1% 11.4%
Max Consecutive Wins 8 15,950 Comp. Anul. ROI, ROI 65.0% 42053.2%
Max Consecutive Losses 14 9,202,127
Largest Winning Trade 5,325,899 Start Date, End Date 850326 970418
Largest Losing Trade 1,183,200 Total Items Traded 217623
Average Winning Trade 258,159 MAR Ratio 1.38
Average Losing Trade 133,606 New Highs, Percent 269 8.8%
Avg $Win to Avg $Loss 1.93
Max Drawdown by %, $ 46.95% $15.76M % on 891101 $ on 960304
Longest Drawdown 1.39 years 950707 to 961125
Here's the "equity curve". For brevity I've only included 6 equity
readings per year; this keeps the message length manageably small.
There's nothing sinister here; I'm just "saving bandwidth" as the
Usenet expression goes.
850201 100000.00
850401 97830.15
850603 114061.95
850801 128820.94
851001 138293.08
851202 169813.23
860203 216806.97
860401 288582.59
860602 285737.25
860801 254516.64
861001 230563.89
861201 243111.95
870202 327757.22
870401 328005.34
870601 416479.59
870701 400805.09
870803 471144.72
871001 498039.31
871201 678973.75
880201 755799.69
880401 714359.19
880601 688729.88
880801 1067212.50
881003 1039365.00
881201 1201548.50
890201 1363686.00
890403 1484712.38
890601 1684390.50
890801 1887812.75
891002 1256556.75
891201 1103038.00
900201 1820179.38
900402 1966021.63
900601 1868241.38
900801 2269144.75
901001 3050966.25
901203 3390288.25
910201 2887254.25
910401 2751789.75
910603 2450820.50
910801 2247085.50
911001 3246755.00
911202 4257608.50
920203 6582033.00
920401 5058539.50
920601 5094387.50
920803 8523964.00
921001 10232035.00
921201 8946255.00
930201 8634425.00
930401 10871372.00
930601 10686823.00
930802 11951045.00
931001 11933584.00
931201 10493555.00
940201 10365359.00
940401 11514206.00
940601 12596234.00
940801 17350238.00
941003 14743892.00
941201 17446028.00
950201 15582884.00
950403 24957432.00
950601 30482370.00
950801 28926444.00
951002 23099142.00
951201 25886892.00
960201 27243478.00
960401 27255586.00
960603 31130510.00
960801 29642532.00
961001 27338004.00
961202 37941076.00
970203 36292488.00
970401 43538832.00
970418 42153156.00
In article <19970421040600.AAA21992@ladder01.news.aol.com> ubchi2@aol.com (UBCHI2) writes:
> I am a professional hedge fund trader looking for some new
> technical systems. If you know the rules of a Wizard system,
> email a description and statistical summary of results. If it
> checks out, I will make you a cash offer on it. If you need
> privacy, just leave a phone number or email for mine.
> Publicly available systems not acceptable.
> --Please no day of week, volatility expansion, channel breakout,
> oscillator, bar chart pattern or other common methodologies.
> Only a totally mechanical method will be purchased.
> Andrew St. John Goodwin
------------------------------------------------------------------------------------------------------------------------------------------------
Re: Turtle Trading Seminars
Mark Johnson
mjohnson@netcom17.netcom.com
1995/08/09
misc.invest.futures
In article <4096gf$60h@everest.pinn.net> kskaggs@pinn.net (Ken Skaggs) writes:
# I just received a direct mail peice telling me that
# for $2500 I can learn from one of the Turtles, Russell
# Sands. With all the usual caveats, like why is a successful
# Tutle going public, does anyone know anything about
# this seminar?
> Subject: Simulation of the Turtle system (Re: What's the best system?)
> Date: Fri, 14 Apr 1995 18:12:14 GMT
> Here's a copy of an email I placed on the omega mailing list
> in November 1994.
> Despite Dave Chamness's provocative subject line
> "What's the best system", I don't mean to state, imply, or
> suggest that the Turtle system is in any way "best". It's
> a system, a long term trend following system. That's all.
> >
> > A while back I used Omega Research's System Writer Plus
> > (abbreviated SWP) to analyze the Turtle System as
> > propounded and sold by Russell Sands, one of the original
> > "Turtles" trained by R. Dennis and W. Eckhardt. See
> > the book _Market_Wizards_ by Schwager for more of the
> > Turtle story if you're interested in the history.
> > Anyway, because of limitations in the System Writer
> > Plus software, I deviated from Russell's teaching in two
> > ways that _might_ be important.
> > 1. Russell adds more contracts onto trades that show
> > a profit, under control of a table of what-to-do
> > contingency instructions created by Richard Dennis.
> > (Adding more contracts onto existing positions
> > is called "pyramiding".) SWP doesn't do
> > pyramiding, so I left it out. In Russell's terms,
> > I always traded "single, 1N units".
> >
> > 2. Russell provides a specific formula for determining
> > how many contracts to trade (one aspect of "money
> > management") which is a function of the equity level
> > in your account on the day you initiate the trade.
> > I didn't do that. I made constant-size bets
> > throughout the year, and I only adjusted my betsize
> > once per year, on December 31, based on the equity
> > in the account on that day. I found it a whole lot
> > easier to program SWP this way; it's difficult to
> > continuously compute the total equity in an account
> > that's trading multiple commodities simultaneously.
> > Difficult in SWP, that is.
> >
> > With those two deviations, I programmed up the Turtle
> > System in SWP. I used system parameters found
> > on the diskette that Russell provides (Initiation
> > parameter = 40, Liquidation parameter = 15). I ran a
> > SWP historical simulation of ten years of trading, from
> > 3/31/84 to 3/31/94. (I was using Omega's "20 year"
> > historical data package, which stops at 3/31/94. They
> > promise an update Real Soon Now :-)
> >
> > I charged myself an outrageously high $125 per round
> > trip trade, PER CONTRACT, for commission and slippage.
> > Even at full commission brokerage houses, commission
> > per contract drops quite low when you trade more than
> > one contract at a time. Still, I felt that if the
> > system could show a profit under these difficult testing
> > conditions, it would be a very good sign.
> >
> > I ran the simulation on eight commodity markets.
> > Russell's data indicates the Turtle System is weak
> > in the grains and the meats, so I left them out.
> > The markets I used were
> > Crude Oil
> > Japanese Yen
> > Coffee (Note that the monster coffee
> > Deutsche Mark trend of 1994 took place AFTER
> > Orange Juice 3/31/94 and so was not included
> > Swiss Franc in the simulated trading)
> > 30 Year T Bonds
> > British Pound
> >
> > I staked myself to 100 grand and started the historical
> > simulation of trading. What were the results? Here's
> > the yearly equity statement:
> >
> > DATE TOTAL EQUITY OPEN TRADES CLOSED TRADES
> >
> > 03/31/84 100000.00 0.00 100000.00
> > 12/31/84 151390.00 25990.00 125400.00
> > 12/31/85 414672.50 200176.25 214496.25
> > 12/31/86 542322.50 143495.00 450117.50
> > 12/31/87 1320185.00 422156.25 898028.75
> > 12/30/88 1882528.75 202292.50 1680236.25
> > 12/29/89 2608198.75 646685.00 1961513.75
> > 12/31/90 5127685.00 -35650.00 5163335.00
> > 12/31/91 8101231.25 2370407.50 5730823.75
> > 12/31/92 10941421.25 166010.00 10775411.25
> > 12/31/93 14214740.00 1428970.00 12785770.00
> > 03/31/94 12901833.75 0.00 12901833.75
> >
> > The worst drawdown period in percentage terms was December
> > 1990 through August 1991, when total equity dropped from
> > $5,712,182.50 to $3,953,901.25. (A decline of 31%).
> > There was also a decline of 24% from July 1993 to February
> > 1994. In the ten year period I simulated, the system made
> > a total of 500 trades. (6 trades per year in each
> > market). The winning percentage was 40%: 198 winning
> > trades, 302 losing. Overall, I was pretty pleased with
> > the results.
> >
> In what is probably a futile attempt, I will _try_ to answer the
> two most commonly asked questions here, in the naive hope it
> may reduce the number of repeated replies/followups:
>
>Q1. Tell me the trading rules of the Turtle system.
>A1. Buy them from the vendor. He advertises in Futures
>magazine and Technical Analysis of Stocks and Commodities
>magazine.
>
>Q2. Why didn't you compute Statistic X? If you had a brain
>you would know that Statistic X is vitally crucial for
>a proper scientific evaluation of a trading system.
>Your failure to include Statistic X means either that
>you're hiding something, or you're a nitwit, or both.
>
>A2. I typed in what System Writer Plus prints out; there's
>no intent to deceive or mislead. I'll be glad to email
>you the sequence of trades and the equity stream from
>the SWP simulation so that YOU can compute Statistic X.
>Best regards, Mark Johnson
------------------------------------------------------------------------------------------------------------------------------------------------
HERE IS: Source code for Option Pricing, binomial model
Mark Johnson
mjohnson@netcom17.netcom.com
1995/05/20
misc.invest.technical, misc.invest.futures
Here's the Binomial model, used to compute options
prices for both American and European style expirations.
You can test and cross-check the answers by comparing the
program's prices for European options, with a Black-Scholes
subroutine.
You get what you pay for. You paid zero for this code.
Think about it.
--------BEGIN--------BEGIN--------BEGIN--------BEGIN--------BEGIN--------
#include
#include
void option_val(x, k, r, v, dx, days, n, european, cval, pval, cd, pd)
double x ; /* current index price */
double k ; /* option strike price */
double r ; /* annual T-bill interest rate */
/* NOTE: r<1.0 is an UNcompounded rate */
double v ; /* annual volatility; 0 double dx ; /* dividends (fraction); 0 int days ; /* how many days to expiration */
int n ; /* how many iterations of the algorithm */
int european ; /* if 1 then European, otherwise American */
double *cval, *pval ; /* call value, put value */
double *cd, *pd ; /* call delta, put delta */
{
double s[200] ;
double c[200] ;
double p[200] ;
double doubl_n ;
double nd ;
double time, tn ;
double divt, div ;
double v0, r0 ;
double u, d, du, ur, a ;
double q1, q2 ;
double rkm, pdm ;
double y, t0 ;
int i ;
if(x <= 0.0) fprintf(stderr, "Hey bozo, index price must be >0, not %.4f\n", x);
if(k <= 0.0) fprintf(stderr, "Hey bozo, strike price must be >0, not %.4f\n", k);
if((r <= 0.0) || (r >= 0.25))
fprintf(stderr, "suspicious interest rate %.4f\n", r);
if((v <= 0.0) || (v >= 0.5))
fprintf(stderr, "suspicious volatility %.4f\n", v);
if((dx < 0.0) || (dx >= 0.3))
fprintf(stderr, "suspicious fractional dividend %.4f\n", dx);
if(days <= 0) fprintf(stderr, "Hey bozo, days must be >0, not %4d\n", days);
if((n <= 0) || (n>195))
fprintf(stderr, "suspicious number of iterations %4d\n", n);
doubl_n = (double) n ;
nd = (double) days ;
time = nd / 365.00 ;
tn = time / doubl_n ;
divt = 1.0 - (dx * time) ;
div = 1.0 / pow(divt, (1.0/doubl_n)) ;
v0 = v * sqrt(tn) ;
r0 = 1.0 + (tn * log(1.0 + r)) ;
u = exp( (r0 - 1.0) + v0 );
d = exp( (r0 - 1.0) - v0 );
du = d / u ;
ur = 1.0 / u ;
a = (r0 - d) / (u - d) ;
q1 = a / r0 ;
q2 = (1.0 - a) / r0 ;
/* set expiration values for index, call, and put */
s[n] = x * pow(u, doubl_n) * divt ;
for(i=n; i>=0; i--)
{
a = s - k ;
c = 0.0 ;
if(c < a) c = a ;
p = 0.0 ;
if(p < (0.0 - a)) p = 0.0 - a ;
if(i > 0) s[i-1] = s * du ;
}
/* initialize values for present value of dividend */
y = dx / time ;
t0 = 0.0 ;
rkm = 1.0 ;
pdm = 1.0 ;
/* do n iterations of the model */
while(n >= 1)
{
if((dx = 0.0) || (european == 1)) goto do_iteration;
/* adjust for dividend payment */
for(i=0; i<=n; i++)
{
s = s * div ;
a = s - k ;
if(c < a) c = a ;
a = (k * rkm) - (s * pdm) ;
if(p < a) p = a ;
}
/* compute new present value of dividend */
t0 = t0 + tn ;
rkm = 1.0 - pow((1.0 + r), t0) ;
pdm = 1.0 - (y * t0);
do_iteration:
for(i=0; i<=(n-1); i++)
{
c = (q1 * c[i+1]) + (q2 * c) ;
p = (q1 * p[i+1]) + (q2 * p) ;
s = s[i+1] * ur ;
if(european != 1)
{
a = s - k ;
if(c < a) c = a ;
a = (k * rkm) - (s * pdm) ;
if(p < a) p = a;
}
}
/* if n=2, use values to compute deltas */
if(n == 2) {
a = x * (u - d);
*cd = (c[1] - c[0])/a ;
*pd = (p[1] - p[0])/a ;
}
n--;
} /* next n */
*cval = c[0] ;
*pval = p[0] ;
}
/* a little stub to test out the options valuation subroutine */
main()
{
int n, number_of_iterations ;
double number_of_days ;
int days ;
double dx, dividend_dollars_through_expiration ;
double v, index_annual_percent_volatility ;
double x, current_index_price ;
double r, interest_rate ;
double k, option_strike_price ;
int european ;
double cd, pd, cval, pval ;
number_of_iterations = 50 ;
number_of_days = 95.0 ;
current_index_price = 351.25 ;
index_annual_percent_volatility = 0.16 ;
dividend_dollars_through_expiration = 3.00 ;
interest_rate = 0.075 ;
option_strike_price = 345.00 ;
european = 0;
n = number_of_iterations ;
days = (int) number_of_days ; /* (expiration_date - today) */
dx = dividend_dollars_through_expiration / current_index_price ;
v = index_annual_percent_volatility ;
x = current_index_price ;
r = interest_rate ;
k = option_strike_price ;
option_val(x, k, r, v, dx, days, n, european, &cval, &pval, &cd, &pd) ;
printf(" Call Value %11.4f Call Delta %11.4f\n", cval, cd);
printf(" Put Value %11.4f Put Delta %11.4f\n", pval, pd);
}
------END------END------END------END------END------END------END------ |
|
|