Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
What can you say me about this result?

This look very simple to win money. I'd like know whats mistakes I'm making

6 responses

Hey Manuel,

Hope this comes off as constructive criticism :)

There are 3 main issues with this strategy:

  1. Over-leveraging
  2. Universe Selection Bias
  3. Parameter Overfitting

Over-leveraging:
This is a very common issue. Your algorithm has no guards against buying $10,000,000 worth of TSLA, when your starting capital is only $1000. To do this the algorithm, as a broker would, automatically takes out loans in your name. In real money trading loans have interest rates depending on your relationship with your broker and size of your trading account. Generally you want to limit your leverage to a constant multiple, in the contest we allow 3x. To do this you can use methods such as order_target_percent rather than order.

Universe Selection Bias:
It leads to inflated returns when you pick stocks that you know have behaved well or in an interesting way in the past. In this case, TSLA experienced massive swings which allowed the algorithm to capitalize. Going forward it is very difficult to determine which securities may be the big winners/losers, so you have to make sure your algorithm is robust to being run over many different universes. Try, for instance, running your algorithm on a security such as MSFT.

Parameter Overfitting:
In this case it looks like the parameters happen to work out well, but what drove you to select those exact values? Often people will try to optimize to determine what parameter values will make them the most money, but these parameters only work on the historical time period. They will often be overspecialized and cause you to lose money going forward. We discuss this in the Overfitting Lecture as part of the Quantopian Lecture series.

For further discussion I encourage you to explore the lecture series, read Alisa's tips for writing robust algorithms, or simply keep checking the forums.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

You are wellcome. I agree with all your comments. I continue reading about all. Than you.

Wow, Delaney, that is very well-written information! You should add those three tips to your FAQ.

Thanks, Tristan. We're definitely thinking about making some of this information available in one place.

Hi Delaney, this is great. Mind if I quote this on the quantapolis wiki?

Feel free to quote this, yes. Thanks for asking.