-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
I tried to reproduce the results from the main page example using the unmodified SmaCross(Strategy), but I used the last 5 years of SPY data instead.
import yfinance as yf
ticker = yf.Ticker("SPY")
SPY = ticker.history(period="5y")
bt = Backtest(SPY, SmaCross, commission=.002,
exclusive_orders=True)
`
The result was Return [%]: -36.07
, which seems impossible — I’ve checked in other backtesters and got very different results.
After inspecting stats._trades, I noticed that losses are being shown even when ExitPrice > EntryPrice.

Where could the problem be?
backtesting 0.6.4
pandas 2.2.3
numpy 2.1.3
yfinance 0.2.65
Metadata
Metadata
Assignees
Labels
No labels