Just realise that there is a flaw in this method that I outlined in that it is based on the assumption that MAE occurs before MFE which is not always the case
--- In [email protected], "Paul Ho" <[EMAIL PROTECTED]> wrote: > > Thomas > I think the model efficency can be calculated in the CBT without > directly getting PP, This can be done by obtaining the Theoretical > buy point (tbp) around the actual buy point, and obtaining tsp around > the sell point. > The tbp can happen either before or just after the buy point. > first look at the before scenario, you can either use trough or LLV > function. the problem with the trough function is that the low > obtained from Trough() could be quite far away. Lets say we use LLV > (L, pds) where pds is half the average bars held obtained directly > from CBT metrics > so tbp_before = LLV(L, bars/2) > To find tbp_after we can use the mae metrics from backtest directly > tbp_after = (1 + mae)*buyprice; > tbp = min(tbp_before, tbp_after); > The cbt code for tbp could be as follows: > .... > bo = GetBacktesterObject(); > bo.Backtest(); > st.bo.GetPerformanceStats(0); > bars = st.GetValue("AllavgBarsHeld"); > me = 0; //stores the sum of model eff per trade > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade () ) > { > sym = trade.Symbol; > mae = trade.GetMAE(); > lp = foregin(sym, "L"); > tbp_before = lastvalue(valuewhen(datetime()== trade.EntryDateTime, > LLV(lp,bars/2))); > tbp_after = (1+mae)*trade.EntryPrice; > tbp = min(tbp_before, tbp_after); > ........ > tsp = max(tsp_before, tsp_after); > theoreticProfitratio = tsp/tbp; > realprofitratio = trade.ExitPrice/trade.EntryPrice; > me += realprofitratio/theoreticProfitratio; > } > .... // do the same with open position > mean_me = me/st.GetValue("AllQty"); > There are a number of variations depending on your perference > 1. You can use trough and peak instead of LLV and HHV > 2. instead of average ME, you can go for accumulated ME by dividing > real profit / theoretical profit. Not sure the figure would be too > small to make a lot of sense. > 3. you can use geometric average instead of arithmetic average > > Now a few questions to both Thomas and Dennis > What kind of insights can one obtain with this comparsion? and How do > you intend to use it? And would you mind post some of your findings? > > Cheers > Paul. > --- In [email protected], Dennis Brown <see3d@> wrote: > > > > Thomas, > > > > That is what I do. Though I also add all the trading overhead as > if > > it were real trades, then adjust the % change to the maximum total > > profit which gives you a lot more insights. > > > > BR, > > Dennis > > > > On May 16, 2008, at 1:35 PM, Thomas Ludwig wrote: > > > > > Hi all, > > > > > > Rober Pardo suggests in his book "The Evaluation and Optimization > of > > > Trading Strategies" the calculation of "Perfect Profit" (PP) > which "is > > > the sum total of all of the potential profit that could be > realized by > > > buying every bottom and selling every top". By comparing Net > Profit of > > > your trading system with PP you can calculate the "Model > Efficiency" > > > (ME). > > > > > > I think PP can be easily calculated as a stand-alone code by > > > applying a, > > > say, 1% Zigzag. But how can it be done if I want to add ME as an > > > additional metric in the Custom Backtester? The Equity() function > is > > > used for your trading system and cannot be used for the Zigzag > system > > > at the same time in order to compare both, IMHO. So the only > > > solution I > > > can think of is to loop through all Zigzag signals and calculate > the > > > profit programmatically. Or am I overlooking something? > > > > > > Pardo also suggests to calculate the Remaining Percentage of > Degrees > > > of > > > Freedom (through Used Dgrees of Freedom and Original Degrees of > > > Freedom). Any idea if and how they can be counted in AFL? > > > > > > Regards, > > > > > > Thomas > > > > > > ------------------------------------ > > > > > > Please note that this group is for discussion between users only. > > > > > > To get support from AmiBroker please send an e-mail directly to > > > SUPPORT {at} amibroker.com > > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > > http://www.amibroker.com/devlog/ > > > > > > For other support material please check also: > > > http://www.amibroker.com/support.html > > > Yahoo! Groups Links > > > > > > > > > > > >
