an FYI - QuantConnect Seems TO CLAULCATE INDICATOR/S differently !
* Long story short - been fucking around with a leveraged-ETF rotation strategy for the last few days.*
The strategy holds one leveraged ETF at a time, flipping between positions when RSI hits hard thresholds - for example:
RSI_SPY > 80 → rotate into UVXY.
The strategy produced 186 trades in my standalone Python replica.
QuantConnect?
136 trades.
Both Cloud and local LEAN.
Same strategy.
Same period.
Same data.
So I started digging.
It wasn't the data.
It wasn't the margin model.
It wasn't the strategy logic.
It was RSI.
More specifically, a subtle difference in how QuantConnect seeds Wilder's RSI compared with the formula used in my Python implementation.
And because the strategy uses hard thresholds, that tiny difference was enough to fuck everything up.
A day where my RSI was 80.1 could be 79.8 in QuantConnect.
That's enough to miss the rotation.
Then the next position is different.
Then the next signal is different.
And suddenly the entire trade sequence is out of sync.
What made this especially annoying was that the numbers weren't wildly wrong. They were close enough to look completely normal.
The final way I isolated it was to calculate the RSI by hand using QuantConnect's own stored price data, then compare that against the RSI QuantConnect was reporting.
That's where the difference finally showed up.
The fix was to stop using QuantConnect's built-in RSI and implement the Wilder calculation manually.
After that:
>!TADA - (=^ェ^=)!<
Python: 186
QuantConnect: 186
Debugging took around 16 hours across the data audit, margin investigation and asking AI wHaT the Shit is this - and bam ----> indicator forensics.
>All that because *“Wilder's RSI”* apparently doesn't necessarily mean the same fucking thing everywhere.
Lesson learned:
If you're trying to get multiple backtesting engines to produce the same result, don't just compare the strategy logic. Compare the actual numbers coming out of every indicator.