If someone would like to summarize that paper on volatility and what's happening in these backtests, like, so a five-year-old can understand, my gratitude.
The latest first algo is nearly 200 percentage points higher in PvR than the original. Since this is not the easiest thing in the world to understand, lemme try to clarify for folks this way: Imagine you start out with $10 and buy a share of SPY each day for several years. The backtester will show you astronomical returns because it treats the negative cash as if it never happened, it says, wow, you spent just $10 and made a fortune so that's a great return.
The first algo appears to be 680%. However it spent 83,185 to make 137,506. So, whoever the reader might be, think to yourself, are the returns 680%? No that's 165%. Tim's revision is 350%, great job. Anyway ...
PnL per stock added to your latest first algo here in the custom chart so you can see what each one is up to. track_orders turned off for speed this time.
Second algo: If I'm not mistaken, with dropna(), any time one stock has a NaN, the day's data is dropped for all stocks, entire row. One possibility might be to use back fill and forward fill instead. Try replacing .dropna() with .bfill().ffill()