This might be more of a math question than a stock market or C# question.
I've been running a lot of back tests with various combinations of parameters to try to find the best configuration such as Moving Average periods. Well, I'm finding the back tests with the highest balances in the end aren't always the ones that perform best in live trading. When reviewing the differences between the ones that do best in back testing (Sample A) versus the ones that do better in live trading (Sample B), I'm starting to see a trend.
Sample A tests have fewer trades with high up and down spikes, whereas Sample B tests have many more trades with much smaller spikes. Sample A tests have higher balances because of a few really good trades but it seems more like luck than accuracy.
So, lets say I have these result sets, where the numbers represent the balance for each period:
Set 1: [ 10, 8, 22, 22, 22, 12, 42, 42, 42, 38, 55 ] (Few big spikes up and down)
Set 2: [ 10, 10, 10, 10, 53, 53, 53, 53, 53, 53, 53 ] (Single huge spike up)
Set 3: [ 10, 13, 14, 13, 16, 19, 22, 20, 23, 25, 28 ] (gradual and more or less consistent incline)
Set 4: [ 10, 12, 14, 17, 21, 25, 30, 35, 41, 46, 52 ] (growing but consistent incline)
How can I statistically determine Sets 3 and 4 to be better than Sets 1 and 2? An Average doesn't work well because it doesn't factor in consistency.
JP B
Stefano Raggi
var x = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; var y1 = new double[] { 10, 8, 22, 22, 22, 12, 42, 42, 42, 38, 55 }; var y2 = new double[] { 10, 10, 10, 10, 53, 53, 53, 53, 53, 53, 53 }; var y3 = new double[] { 10, 13, 14, 13, 16, 19, 22, 20, 23, 25, 28 }; var y4 = new double[] { 10, 12, 14, 17, 21, 25, 30, 35, 41, 46, 52 }; var coefficient1 = Correlation.Pearson(x, y1); // 0.88662349071097846 var coefficient2 = Correlation.Pearson(x, y2); // 0.83666002653407545 var coefficient3 = Correlation.Pearson(x, y3); // 0.97584915863661914 var coefficient4 = Correlation.Pearson(x, y4); // 0.98801866282984707
To use the Correlation class you will need to add a reference to the Math.NET Numerics library (available on NuGet).Jared Broad
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
JP B
Steven Heiser
^+1 for picking good lines... I like them lines
Levitikon
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!