Why do you rank them before? I mean, you do the returns for each ETF (20d, 3m, 6m, 1yr), but you don't need to rank them yet. First, do the score, and then rank them.
I would delete this:
day20_rank=day20_ret.rank(ascending=False)
day3mo_rank=day3mo_ret.rank(ascending=False)
day6mo_rank=day6mo_ret.rank(ascending=False)
day1yr_rank=day1yr_ret.rank(ascending=False)
vol_rank=volatility.rank(ascending=True)

So just to clarify. I want to rank by the average of their returns, not the average of their ranks.
i.e. I was doing
average_ranks=(1+3+7+4+3)/5
but you say
average_returns = (0.01 +0.09 +0.15 +0.10+0.19)/5
then:
rank = average_returns rank

I think it has to do with the performance of emerging ETFs, I used sector ETFs. I took out everything but the 3 month returns and the volatility. It performed a lot better. There's a leverage problem though, so it's not perfectly accurate right now.

@Blue So are you saying it is not trading until 2009?
@Ro FG You are exiting every time it is below the 200 day SPY, and putting it in EDV. It doesn't work as well as a safety because after the recession you get those signals, and it still goes up also.

I normalized the returns by dividing them by their volatility . I am not sure if this is correct. I also combined all the etfs from both strategies. I am trying to lower the drawdown, because the returns seem way to high. I wouldn't want to just invest in emerging etfs. What comes up must come down!

@EB I was saying the start date field changed to 2009 automatically. Clicking on that calendar after the test, there was a message to the effect of first available date for securities being traded, surely you've seen that a few times eh. If there's a log message about it as well, I missed it.

Switching to the second-most recent backtest above with apparent returns of 197, its profit per dollar was just 60 due to margin. A common problem. This version has apparent returns of 233 and profit per dollar is 232, so almost no margin. So not only is 233 higher than 197 but also 232 is higher than 60. Using profit per dollar activated|invested is the only way I know for comparing two algorithms apples-to-apples and seeing more clearly what they are really doing by neutralizing, or adjusting for, their use of capital, i.e. amount of risk. Maybe people don't go that route because of the reduced speed.

There were evidently so many partial fills (the cause of all that margin along with the inherent unpredictability that goes with it hand-in-hand, unintended margin with order_target_percent when there are partial fills) that I took an unusually extreme approach in reactivating close() by running an entire day before balance and again the morning of that monthly balance, as this, the first try. @Ro FG, you might want to use similar and see what happens in your version.

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.

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.