Back to Community
Two questions about simple fundamentals algorithm

Learning the fundamentals API, here's a simple algorithm that buys companies with a high R&D to enterprise value ratio, and holds them for 70 trading days.

  1. I suspect the results aren't really real. (In general, research shows that high R&D spend results in under-performing stocks, at least in the short term.) Any reason to think otherwise?
  2. I'm having trouble understanding what's going on with the leverage. The algorithm both checks for open orders and tries to look at liquidity, only buying stocks that have traded at reasonable total dollar volumes in the days before the re-balancing. But the leverage rises to about 2, and never settles much below 1.5. (It should settle back to 1.) The reason is that there are some stocks that are never completely sold - the list of holdings keeps increasing. Why is this ... and how do I fix it?

Thanks for the help!

Alan

Clone Algorithm
7
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5510341f9d3a0d217cda6598
There was a runtime error.
1 response

I am not sure what is going on but I set

context.number_stocks = 1  

And it seemed to buy more than 100K on the very first transaction which certainly seems to be a bad sign.