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

[amibroker] Re: Perfect Profit and DOF



PureBytes Links

Trading Reference Links

Paul,

I believe that your degrees of freedom math is not in agreement with 
that of Pardo. 

In "The Evaluation and Optimization of Trading Strategies", pages 
292 - 295, Pardo states that data containing O/H/L/C will represent 4 
available degrees of freedom per bar, whether you use them or not.

Further, Pardo writes that each data point used in the calculation of 
a rule counts as 1 degree of freedom, but is not double counted. The 
rule itself counts as an additional degree of freedom.

So, using your example below;

pds = optimize("pds", 30, 10, 100, 1);
c > ema(c, pds);

If I understand Pardo correctly, then:

- You will have used up 100 degrees of freedom as a result of using 
100 Close values when the optimize statement caused pds to be set to 
its maximum value of 100.

- You would not count the Close values used for the lesser pds (i.e. 
for 10, 11, ... 99) since the max of 100 already accounted for all 
those Close values. 

- It is not clear to me whether Pardo considers each of the 
variations of the C > EMA(C, pds) rule as being a degree of freedom 
(i.e. 91 variations = 91 degrees of freedom) or just the variation 
ultimately selected (i.e. 1 degree of freedom). I suspect that he 
means all 91. David Aronson in "Evidence Based Technical Analysis" is 
clear that he believes that each variation must be counted as a rule.

So, continuing with your example, and taking the conservative 
approach of assuming all 91 rule variations each count for 1 degree 
of freedom, Pardo would say that we have used 100 closes + 91 rules = 
191 used degrees of freedom out of 2000 bars x 4 data points = 8000 
available degrees of freedom.

In other words, you will have used up 191/8000 = 2.4% of the 
available degrees of freedom, leaving 97.6% remaining. As a rule of 
thumb, Pardo advises having not less than 90% degrees of freedom 
remaining.

I believe that it is irrelevant how many symbols the strategy is run 
on, the math is constant per symbol.

I have not yet got around to trying to automate this calculation, 
since it is relatively easy to count by hand.

I do plan to eventually have a look at automating the calculation of 
perfect profit though. So if and when I do it, I'll try to remember 
to update this thread with my conclusions. Unless of course someone 
beats me to it ;)

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxx> wrote:
>
> I didnt see the Degree of freedom question
> Suppose we have one rule set buy = c > ema(c, pds);
> we put this through our dataset of 200 symbols each with 2000 bars
> So there is 200 * 2000 = 400000 Dof in terms of the Closing price. 
> Note that Dof in h, l, o and volume is irrelevant because we dont 
use 
> them.
> if pds is a single no. then we have used up only 1 dof, but if 
> pds = optimize("pds", 30, 10, 100, 1);
> then we effectively have 91 rules, just that we only choose one of 
> them after looking at the results of 91 rules. 
> So I believe the Used dof is the no of possible permutations 
> expressed in your optimization statement + other fixed rules, 
implied 
> or otherwise.
> Hope that helps
> /Paul.
> --- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/