What definition of MC are we using here ? Linear results and mixing up the time continuum, or results that occur in backtesting that appear to occur simultaneously, however if one has choice or one does not know the actual order of trades being filled with open STPLMT orders, the paths could lead down to many different results ?
Cheers Dave On 31/07/10 12:01 AM, "Howard B" <[email protected]> wrote: > > > > > > Greetings -- > > MK wrote: > "I believe that is called Bootstrapping. In Monte Carlo you have to first > guess the distribution of trades - more assumptions. " > > --------------------- > > Be careful when using bootstrapping to sample financial time series data. > Successfully trading a system changes the subsequent data. This can cause > estimates made by testing / examining earlier data to overestimate > profitability. > > Thanks, > Howard > > > On Mon, Jul 26, 2010 at 11:26 PM, mkecera <[email protected]> wrote: >> >> >> >> >> >> Hello, >> >> I believe that is called Bootstrapping. In Monte Carlo you have to first >> guess the distribution of trades - more assumptions. >> >> Best regards, >> >> MK >> >> >> >> --- In [email protected] <mailto:amibroker%40yahoogroups.com> , >> "Mike" <sfclimb...@...> wrote: >>> > >>> > Books that you might be interested in: >>> > >>> > Ralph Vince >>> > - The Handbook of Portfolio Mathematics: Formulas for Optimal Allocation & >>> Leverage (Wiley Trading 2007) >>> > >>> > - The Leverage Space Trading Model: Reconciling Portfolio Management >>> Strategies and Economic Theory (Wiley Trading 2009) >>> > >>> > Your comments on Monte Carlo are incomplete. Monte Carlo is not just >>> changing the the order of trades. Monte Carlo can also be used to treat >>> existing trades as a pool of trades from which a greater number of trades >>> may be sampled in order to project a longer term equity curve. >>> > >>> > For example, if you have a collection of trades that you feel adequately >>> represent the range of trades that your system will generate, you can >>> randomly draw some number of trades (with replacement) from the pool to >>> generate thousands of equity curves (e.g. draw 100 trades from a pool of >>> 30). You may then analyze the resulting equity curves to get such >>> information as average performance, best performance, worst performance, >>> etc. >>> > >>> > Mike >>> > >>> > --- In [email protected] <mailto:amibroker%40yahoogroups.com> , >>> "Matthias K." <meridian202@> wrote: >>>> > > >>>> > > Hi, >>>> > > >>>> > > >>>> > > >>>> > > Indeed this is a very interesting topic. Many thanks go to Howard >>>> Bandy, it is literally a must read when working with Amibroker. >>>> I�m curiously waiting for the new one. >> >>>> > > >>>> > > >>>> > > >>>> > > Regarding System Design and Position Sizing: >>>> > > >>>> > > Well, I believe that there are a lot of books out there, but different >>>> authors really do mix up terminology, so this is how I interpret it: >>>> > > >>>> > > >>>> > > >>>> > > Position sizing >>>> > > >>>> > > Tells you how much, e.g. how many contracts or shares one should buy, >>>> Howard just mentioned 2 algos, fixed fraction and fixed ration. Ralph >>>> Vince�s book is a must read on this, however, >>>> it�s not quite easy going. Furthermore, >>>> there�s martingale and antimartingale, whereas martingale >>>> pretty much means: the more you lose, the more you bet. I believe >>>> it�s a sure-fire way to the poorhouse, >>>> that�s why I use ALWAYS anti-martingale. No black swans >>>> welcome in my trading. >>>> > > >>>> > > >>>> > > >>>> > > Risk management >>>> > > >>>> > > Obivously, there�s a clear overlap with position >>>> sizing, but still I believe it�s meant to be a little >>>> different. Say you have a system with a plugged in position sizing algo. >>>> You backtest it and you�ll have an estimate of the >>>> drawdown. Obviously, you will want to adjust position size so that you can >>>> stomach the drawdown. But as a safety measure, you might plug in another >>>> strategy. It might be an equity MA-Crossover, it might be something >>>> psychological (a divorce, an illness), it might also be a safety stop due >>>> to increased market volatility / markets crash. >>>> > > >>>> > > Remember to always measure drawdown in percentage terms, e.g. >>>> Tradestation Strategy Report is pretty useless, because it only shows >>>> drawdown as an absolute figure so it requires Excel to actually calculate >>>> drawdown in percentage terms. Also CAR is calculated correctly in AB, >>>> I�ve seen other software, costing 2k�, still >>>> calculating CAR wrong (10 times 10% per annum is NOT 100%) >>>> > > >>>> > > >>>> > > >>>> > > Portfolio Management >>>> > > >>>> > > Hahaa, I believe this is where a few gold bucks a buried. Portfolio in >>>> terms of which markets to trade has been discussed in the literature, still >>>> this is a very specialized topic already. There not many books found on >>>> this, that�s why I spend so much time thinking about it: >>>> Nothing to be found means a lot to be made and understanding it in great >>>> detail might give me/you a larger edge. Especially a scientific approach >>>> that is not based on gut-feel, is missing. This is what I am currently >>>> working on: Portfolio Management in terms of Trading Systems. So to say, >>>> have a trading systems farm, probably 3-5 systems on one underlying to have >>>> a very smooth equity curve. This includes diversification across a) >>>> methodology (Mean Reversion, Trendfollowing, Breakouts,etc.) and b) >>>> timeframe (day-trading, swing trading, position trading). Well, I have >>>> found 2-3 books on this topic, all of them sort of scratching the surface, >>>> mentioning the topic, but that�s it. So how can systems be >>>> combined wisely and when should systems be switched off, reoptimized, etc. >>>> If anybody knows some books on this, I�d be very happy to >>>> read up on it so if someone knows an author, please post! So far, having >>>> many systems with different logics is the direction I�m >>>> going right now. >>>> > > >>>> > > Something that�s worth having a look inside is this >>>> one: >> >>>> > > >>>> > > >>>> > > >>>> > > >>>> http://www.amazon.de/Trading-Systems-Development-Portfolio-Optimisation/dp/ >>>> 1905641796 >>>> > > >>>> > > again, it�s scratching the topic only. >>>> > > >>>> > > >>>> > > >>>> > > The way I develop systems is always the same (If anyone >>>> doesn�t agree with this approach, I�d like >>>> to know why) >> >>>> > > >>>> > > >>>> > > >>>> > > 1 contract, share, etc. >>>> > > >>>> > > Commissions excluded >>>> > > >>>> > > 3-5 (5max!) input parameters, such as indicators, ma�s: >>>> it�ll result in a raw system with in-built exits and >>>> entries but no stops. >> >>>> > > >>>> > > Optimize the inputs for STABILITY, a profitable set of parameters with >>>> a stable surrounding region >>>> > > >>>> > > Plug-In Commissions >>>> > > >>>> > > Add filters >>>> > > >>>> > > Add stops/targets according to Sweeney�s MAE MFE >>>> > > >>>> > > Plug-in the position sizing algo, �the >>>> compounder� >> >>>> > > >>>> > > Test out of sample >>>> > > >>>> > > >>>> > > >>>> > > Works fine for me. >>>> > > >>>> > > >>>> > > >>>> > > After this, I pretty much try to combine systems. Currently this is a >>>> bit troublesome in Ami, but I shall let you know when I have done enough >>>> research, unfortunately I believe it�s gonna take me some >>>> months. >>>> > > >>>> > > >>>> > > >>>> > > What I believe to be very controversial is the topic >>>> �adding noise� to data. I >>>> don�t think it reflects human emotion anymore. Same as >>>> dealing with a random sequence: a coin toss, e.g., can be displayed as a >>>> graph too, but it�s still a normal distribution. So: When >>>> doing quant-trading and believing in it, you make one big assumption: >>>> Markets behave logically, sometimes. I found out that markets contain a >>>> large amount of noise, random behavior. But there are occasions when people >>>> get hit on the wrong spot and start buying or selling aggressively . >>>> That�s the time when my systems jump in and make the kill >>>> - then I�m out. This behavior cannot be found in a random, >>>> probably noisy set of data. >>>> > > >>>> > > Monte Carlo pretty much changes the trade sequence only, right now I >>>> cannot really see why some people think it�s so useful. It >>>> might give you a better estimate of a historic drawdown, but I achieve the >>>> same by multiplying my non-monte-carlo-drawdown with say 1.5� >> >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > Greetings from Germany, >>>> > > >>>> > > >>>> > > >>>> > > Matthias >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > From: [email protected] <mailto:amibroker%40yahoogroups.com> >>>> [mailto:[email protected] <mailto:amibroker%40yahoogroups.com> ] On >>>> Behalf Of Howard B >>>> > > Sent: Montag, 26. Juli 2010 16:33 >>>> > > To: [email protected] <mailto:amibroker%40yahoogroups.com> >>>> > > Subject: Re: [amibroker] Trading Systems, Position Sizing and Monte >>>> Carlo Analysis >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > Hi Sohamdas -- >>>> > > >>>> > > In my opinion, this is definitely a topic that deserves discussion in >>>> the AmiBroker forum. >>>> > > >>>> > > What position sizing should be used during backtests? >>>> > > >>>> > > If you will be evaluating each trade for its characteristics -- entry >>>> efficiency, exit efficiency, and so forth, then each trade should be the >>>> same size. For stocks and ETFs that means the same dollar amount. For >>>> futures that means the same number of contracts. >>>> > > >>>> > > If you will be comparing equity growth over a period of time to other >>>> alternatives, then you will want position sizing and / or compounding to >>>> some degree. For example, if you want to compare the results of a trading >>>> system to buy and hold, you will want to take the same size position at the >>>> beginning if the test period for each alternative, then compare equity >>>> smoothness, growth, drawdown, etc. >>>> > > >>>> > > If you are planning to use aggressive position sizing, there are >>>> several things to consider. >>>> > > 1. I cannot state it too often -- your system must have a positive >>>> expectancy measured on strictly out-of-sample results. You absolutely >>>> cannot use in-sample results to estimate the likely future performance of a >>>> trading system in any event. And if aggressive position sizing is based on >>>> in-sample results, you will go bankrupt. >>>> > > 2. Traders should have a business plan in place. They should know >>>> when to quit -- either when they have enough that they no longer need to >>>> trade, or when they have lost so much that they can no longer trade or >>>> realize that they should pick another profession. >>>> > > 3. Aggressive position sizing depends on having: >>>> > > A. Positive expectancy. >>>> > > B. Understanding of risk. Both the risk that is acceptable for each >>>> trade from the account, and the risk associated with the trading system. >>>> Most trading systems have higher risk per trade than the account risk >>>> allows, so even taking a position that is everything you can afford to buy >>>> is aggressive. >>>> > > C. The ability to use leverage. Brokers allow use of margin, and some >>>> ETFs have leverage. By using these, it is possible to get 12 to 20 times >>>> leverage trading stocks and ETFs in an ordinary brokerage account. >>>> > > D. Frequent trading, because that provides frequent compounding. For >>>> most trading systems, the final equity of an account is a multiple of the >>>> initial equity that can be computed from: >>>> > > terminal_equity = (1 + expectancy) ^ number_of_trades >>>> > > where expectancy is the average percentage gain per trade. >>>> > > >>>> > > There are two general schemes for aggressive position sizing. As you >>>> dig into the math, you will see that they are closely related. >>>> > > The first is fixed fraction, popularized by Ralph Vince. >>>> > > The second is fixed ratio, popularized by Ryan Jones. >>>> > > Both men have written books and papers describing their methods, and >>>> you can do an Internet search on each phrase and get a lot of information. >>>> > > >>>> > > The essence of both methods is to increase position size when the >>>> system is operating profitably. In gambling terminology, you are "betting >>>> the run of the table". When winning, increase; when losing, pull back. >>>> Both of these are betting schemes called anti-martingale. >>>> > > >>>> > > Ralph Vince has also popularized the notion of "optimal f" -- that >>>> fixed fraction that should be bet on each play to maximize the terminal >>>> equity. The fraction of the account used for each play is determined by >>>> the largest anticipated drawdown or trade loss. He, and everyone else who >>>> is working with real money, shows that the fraction bet on each play Must >>>> be less than optimal f if the account is to remain solvent. In fact, the >>>> fraction must be much less than optimal f if the account is avoid large >>>> drawdowns. Trading at optimal f essentially guarantees drawdowns in the 80 >>>> percent range. >>>> > > >>>> > > Ryan Jones essentially creates two sub-accounts. One is the original >>>> stake, say $100,000. The other is the profits from trading. Ryan waits >>>> until there are some profits, then uses a high percentage of the profits >>>> for each trade. >>>> > > >>>> > > The two methods converge mathematically. Some traders prefer to begin >>>> using one method, then switch to the other as profits accumulate. >>>> > > >>>> > > Before you consider using an aggressive position sizing scheme, and >>>> buying all the stock you can afford is aggressive, please read my other >>>> comments in both this forum and Aussie Stock Forums related to trading >>>> system development and position sizing. And read both Vince's and Ryan's >>>> books, and other material you can find on the Internet. >>>> > > >>>> > > The input to the simulators that model either fixed fraction or fixed >>>> ratio need is a list of closed trade results. These are individual trades, >>>> each the same size. >>>> > > >>>> > > Monte Carlo Analysis is used to rearrange the sequence of trades many >>>> times. The position sizing rules are applied to each sequence and the >>>> equity curve computed and drawn. Typically many sequences are used -- 1000 >>>> or more -- each of many trades -- 100 or more. After all 1000 runs, all of >>>> the equity curves are draw on a single chart and statistics computed that >>>> will allow you to estimate the final equity and probability of both going >>>> broke and retiring wealthy. The plot looks like a straw broom with the >>>> straws angled upward to the right. >>>> > > >>>> > > There are two good programs for testing position sizing. >>>> > > Equity Monaco. A free position size calculator / simulator published by >>>> TickQuest. It accepts a file, in ASCII format, of closed trade results, and >>>> performs Monte Carlo analysis of reordering the closed trades. Highly >>>> recommended. >>>> > > http://www.tickquest.com/?page_id=70 >>>> > > Market Systems Analyzer. Costs about US$350, but sometimes available >>>> for a little less. Published by Adaptrade. Does everything Equity Monaco >>>> does, plus tests aggressive position sizing methods. I highly recommend >>>> this program -- provided you understand trading system development, trading >>>> system validation, account risk, trade risk, and aggressive position >>>> sizing, and you are not a novice trader. Again -- using aggressive position >>>> sizing with a trading system that has not passed tests of statistical >>>> validation will result in a swift trip to bankruptcy. >>>> > > http://www.adaptrade.com/ >>>> > > >>>> > > To use either of these programs, run your backtest using the parameters >>>> and settings that will be used during trading and that represent the >>>> out-of-sample runs from walk forward testing. Export the trade list to a >>>> csv file. Strip everything unnecessary out of the file and save it in the >>>> format the position sizing program needs. Then run the position sizing >>>> simulator. >>>> > > >>>> > > ---------------- >>>> > > >>>> > > There are two other areas where Monte Carlo Analysis is useful. >>>> > > >>>> > > One is adding noise to the input data. This can easily be done in >>>> AmiBroker now and is explained in my book Quantitative Trading Systems. >>>> > > >>>> > > The second is testing the sensitivity of parameter values. This can be >>>> also be done now, but requires some careful thought and planning to >>>> determine which parameters should be tested and over what range. >>>> > > >>>> > > ------------- >>>> > > >>>> > > Thanks for listening, >>>> > > Howard >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > On Sun, Jul 25, 2010 at 11:33 PM, sohamdas <sohamdas@> wrote: >>>> > > >>>> > > >>>> > > >>>> > > Hi Folks, >>>> > > >>>> > > Though, not exactly, Amibroker related but I guessed it might be a >>>> great place to ask. >>>> > > >>>> > > Can anybody of you, who have ample experience designing trading >>>> systems, can comment that when I am designing a trading system, say, >>>> entries and exits are to the extent possible frozen, what is the position >>>> sizing I should use to run my preliminary backtests. >>>> > > >>>> > > And what are the inputs I should pass onto the Monte Carlo routine. >>>> > > >>>> > > Is it possible to conduct MC Analysis in Amibroker? >>>> > > >>>> > > Soham >>>> > > >>>> > > P.S: Thoughts of Dr. Bandy will be much more than welcome >>>> > > >>> > >> >> >> >> > > > > >
