Back to Community
Confused about backtest: returns, benchmark, cash and leverage

I am a little lost when it comes to backtesting.
Quantopian gives you a nice overview of a backtest your algorithm against the benchmark (SPY in my case).
In this overview it shows returns, benchmark, cash and leverage. I used a simple MACD crossover algorithm and for me this raises a few questions.

When I run the algorithm against the US_EQUITIES over 2019 then I get a huge return of over 10.000% in a year which seems (and is) to good to be true. I thought the algorithm would use the cash available but this is not the case because the leverage is also huge (also on a sidenote if you set order_target_procent() to 1. Does it try to invest the whole worth of the portfolio again in the new security? Initially I accidently did this).

For me this raises a couple of questions:
- Are the returns compared to the original amount of cash. So if you have a leverage of 100 and you make 1%. Is this shown as 100% returns? (it seems so at least). In the backtest I can make or lose 10.000% in a year but this is not something that would happen in real life.

  • Are the backtests in the forum comparably with each other at all? Because if you have a leverage of 100 this cannot be compared to someone keeping the leverage <1. Is there a way to unify this and have a level playing field for comparison of algo's?

  • How does the benchmark comparison work? For the benchmark is 100% of the cash invested in SPY from startdate to enddate or is the amount of money invested in your portfolio exactly matched by an investment in SPY? In the case of my huge return of 10.000%, the SPY rose by a normal percentage of around 30%. These seem to be units that cannot be compared on the same scale.

  • Also: how does buying and selling work. Is it done for the current market price + slippage (for all the stock)? Why is it that some orders are not fulfilled or only partly fulfilled in simulation? Is there some kind of algorithm responsible for that?

-What difference does the initial cash position make for the outcome in percentages?