This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:

We work extremely hard to keep things positive on our forums.

We do not tolerate rude behavior, trolling, or vendor advertising in posts.

We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

Often, I found that I'd rather modify the NT strategy analyzer optimizer type rather than my strategy that I developed. This is one such strategy optimizer type that I wrote. It is similar to the linear rsquared trendline function in MS excel. This optimization will maximize the linearity of the equity curve.

Enjoy,
eleven

The following 10 users say Thank You to eleven for this post:

Cool - for those of us who are math challenged, can you give some more details as to how this is being accomplished?

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.

If you want to support our community, become an Elite Member.

The optimization performs simple linear regression of the equity curve by the least squares method to determine slope of a linear line. This linear regression line is then correlated with the equity curve by trade # to calculate r-squared. The closer to 1 the better the fit. I have wrote the code to only return result with positive net income. I have provided an updated attachment that removes some redundant code.

I have pulled the following definition from Investopedia which provides a very good explanation.

What Does Coefficient of Determination Mean?
A measure used in statistical model analysis to assess how well a model explains and predicts future outcomes. It is indicative of the level of explained variablity in the model. The coefficient, also commonly known as R-square, is used as a guideline to measure the accuracy of the model.
Investopedia explains Coefficient of Determination
One use of the coefficient of determination is to test the goodness of fit of the model. It is expressed as a value between zero and one. A value of one indicates a perfect fit, and therefore, a very reliable model for future forecasts. A value of zero, on the other hand, would indicate that the model fails to accurately model the dataset.

Last edited by eleven; November 8th, 2011 at 08:05 PM.

The following 4 users say Thank You to eleven for this post:

Platform: NinjaTrader, TWS (IB), TDA -Strategy Desk & TOS

Favorite Futures: ES

Posts: 7 since Jun 2013

Thanks: 5 given,
0
received

checking

Thanks for sharing this. I was looking for something like this on the Ninja board and Bertrand suggested I look at this. I would like to optimize based on the profit curve being as close as possible to a straight line. I assume that is what your download in the previous post with R2 does -- correct? What is the difference with the next download? Does it still look at the equity curve or only at Sharp and Net Profit?

Such a newby question, but how do I incorporate this into my optimisation? Currently I can only see the 'default' and 'Genetic', and the default options for 'optimize on'.

Be great to be able to incorporate this into some of my strategies!

Thanks!

Edit: I just had the option show up in 'optimize on' list. Awesome, thank you.

Last edited by adrianjm; April 22nd, 2014 at 09:13 AM.
Reason: Found it!

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.

If you want to support our community, become an Elite Member.

The following user says Thank You to Big Mike for this post: