- ago
I'm trying to use Yahoo's ^GSPC ticker to run a very long term backtest (this is their SPX price timeseries more or less).

Unfortunately on 1/3/1962 for 20 years until 4/16/1982, it is passing through $0 as the Open price even though the High/Low/Close appears fine.

I have my Strategy settings Basis Price to be based on "Market Close this Bar" so I'm wondering why this erroneous $0 Open price data is even affecting the backtest? (It's basically having me sell at Exit Price of $0 when running the backtest).

FWIW when running the backtest at Daily scale it ends up just reporting NaN as the Profit % eventhough it appears have the actual Entry/Exit dates of the trades correct. However, when I try to run the backtest at Weekly scale it ends up actually using $0 Open price as the Exit Price and posting -100% as the Profit %.

Any one have any ideas?
0
443
Solved
6 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.53% )
- ago
#1
The "Market Close of this Bar" is only telling the backtester to use the closing price as the basis price for determining how many shares to size the position for a % of equity or fixed dollar position size. The actual simulated order occurs on the following bar at market open.
0
- ago
#2
Thank you for that description of the underlying engine.

Is there a way for me to "fix" the bad Open price bars myself in the UI? Or would I basically have to upload a static dataset myself?
0
- ago
#3
I figuerd out a good workaround by using the automated data cleaner in Data Manager by adding ^GSPC as the single ticker in a Dataset then cleaning based on the OHLC, spikes, etc.

Though in order to make use of this cleaned ^GSPC I had to specifically use this Dataset in Portfolio Backtest rather than just typing in ^GSPC in a Single Ticker backtest. Totally a reasonable workaround, just wasn't obvious to me to go the Portfolio Backtest route with the single ticker Dataset after a cleanup in Data Manager.

EDIT:
The Single Symbol backtest *does* work after the data cleanup but only at Date Scale=Daily. If I choose Data Scale=Weekly then it does not appear to use the cleaned data. If I do Data Scale=Weekly in the Portfolio Backtest with the single symbol Dataset then it works OK.
0
Cone8
 ( 6.17% )
- ago
#4
I know you're going for an extended backtest, but just for the exercise, you should compare results between "trading" an index like ^GSPC and using the actual tradable instrument - SPY. The results are likely to be worlds apart.
0
Best Answer
- ago
#5
Yep. Understood. Mostly just using ^GSPC as a "SPY proxy" to serve as "psedo-Out of Sample" using older S&P500 prices since SPY only has history starting in the 1990's. But thanks for the heads up to be aware of it - for at least the past 7 or 8 years of trades, they appear to line up very closely when switching between SPY and ^GSPC for what I'm doing in this longer timeframe holding period stuff.
0
- ago
#6
For stocks it's probably not $0 but rather a very small fraction (due to many splits) rounded for display.
0

Reply

Bookmark

Sort