Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [backtesting]

The process of evaluating a strategy, theory, or model by applying it to historical data.

-1
votes
0answers
24 views

Backtesting assumptions and implementation details

I've found several pieces of software that implement backtesting (e.g. Quantopian's ZipLine, various GitHub repositories, etc.) but I've been unable to find any set of backtesting assumptions written ...
-1
votes
0answers
19 views

Using quandl premium datasets with zipline

Im trying to use options data with zipline for backtesting. I noticed there are some premium datasets on quandl for options. Has anyone successfully managed to use any of those datasets with zipline?...
0
votes
1answer
88 views

R: backtesting with path dependencies

I have a historical PMwR journal of trades (one for each side of position open/close) in R. I wish to backtest trade sizing algorithms, one of the inputs to which calculation will be, on-the-day ...
2
votes
1answer
93 views

Cumulative Return on Futures

In my current backtesting, I am using log returns as a proxy for simple returns via the relationship $\ln(1 + r) \approx r$ for small enough r. This gives me wonderful properties like time additivity, ...
3
votes
1answer
163 views

Option Strategy: Python Implementation Advice

I've been tasked to create and backtest an option strategy. The strategy, in vague terms, is to essentially write call options on securities in a universe, i.e., selling insurance. I have an idea of ...
1
vote
0answers
26 views

forex backtesting spread cost modeling

For professional level forex trading, what is a reasonable estimate of roundtrip transaction costs (I am talking about major pairs, like EUR/USD).
1
vote
3answers
262 views

Is there a python library to generate performance metrics from returns of the strategy?

I am backtesting a strategy and have data generated from the returns of the strategy. Now I need performance metrics like maximum drawdown, Sharpe ratio, Treynor measure etc., I am writing functions ...
0
votes
0answers
32 views

Assessing goodness of a Technical Trading Rule using a ROC model

I am testing various technical trading rules (TTR) on the cryptocurrency market. I have already setup some significance tests, to compare the returns and volatilities. I would now like to test it ...
2
votes
2answers
196 views

Backtesting Fundamental Equity Strategies in Python

I am trying to run a local backtest using Python and Zipline seems to be the most popular package out there. Does any one have isnight on ingesting fundamental data for the backtest? The documentation ...
0
votes
0answers
74 views

Modelling VIX futures backwardation

I have VIX futures trading algorithm and would like to perform Monte-Carlo simulation of VIX and understand how my algorithm performs on each simulation. In this case, not only VIX should be modeled, ...
0
votes
0answers
88 views

Backtest Portfolio Analysis

I actually finished an algorithm that i can use to extract all the trades for each stock (each file for each stock). Essentially, i run this code on Excel where there are the input about one stock, ...
2
votes
0answers
35 views

LGD performing model - LGD estimate vs LGD observed

LGD (Loss Given Default) performing model is developed on through the cycle sample which consists of loans in default. What I want is to compare LGD estimate and LGD observed (realized). LGD observed ...
1
vote
0answers
54 views

Zipline issue with SPY data

I have written a strategy to backtest in zipline, and every time I ran the backtest, and error is showed with the line: IndexError: index 0 is out of bounds for axis 0 with size 0 After a bit of ...
0
votes
0answers
13 views

Listed Company's Filing Deadline

Where could I get historical record of listed company's filing deadline that announced by SEC of Asia country & US? I could get the latest deadline from respective SEC websites, but not changes ...
2
votes
2answers
157 views

Does using adjusted closing prices constitute a lookahead bias?

One of my machine learning project involves the use of adjusted close prices (from Yahoo Finance, for better or worse) to determine the label – if a stock's adjusted close price increases by more than ...
2
votes
1answer
381 views

Backtesting C++ Algorithms

What software is available for backtesting trading algorithms written in the C++ programming language? I would not like to use an online service such as Quantopian or Quantconnect (they don’t offer C+...
1
vote
1answer
92 views

Evaluate the significance of the relationship among VIX and the S&P 500

I have the weekly time series of returns for both VIX and S&P 500. For the VIX I'm looking at 1 week return period (e.g. this is a 5 day return series rolling weekly) For the S&P 500, ...
0
votes
0answers
39 views

Backtesting on rebalanced portfolio

I want to understand the backtesting mechanism. Assume I've designed an algorithm that evaluated the optimal distribution of asset based on 2-years historical data. Do I understand right that I ...
0
votes
0answers
139 views

What do you optimize for? Sharpe ratio, profit factor, profit/drawdown, etc

In my experience, strategies perform best on OS (OutOfSample) data, when I optimize them for maximum Sharpe ratio (on InSample data) at the opposite extreme, when I optimize strategies for ...
0
votes
0answers
67 views

Database for Historical data for backtesting [duplicate]

I have 1 min historical data for NSE futures and options. I want to backtest trading strategies using Python. Which are good databases to organise options and stocks data? How to structure data so ...
5
votes
2answers
581 views

Backtesting Market Making Strategy or Microstructure Strategy

How does one backtest either a market making strategy or microstructure-based strategy? I'd imagine that one way would be to record order book states over time and then insert the orders, but it seems ...
5
votes
1answer
90 views

Historical stock borrow fees

I am not sure if this is an appropriate question, but anyway: to properly backtest long/short strategy one must have data on what the short loan fees were/are. Is there any decent data source for that?...
1
vote
0answers
25 views

Dynamic counterpart for model tunneling/optimization using past data

When we tune a model to optimize parameters for a strategy using past data, even if controlling for overfitting (checking out of sample performance) and refreshing the analysis from time to time, we ...
0
votes
0answers
81 views

Backtesting VaR

I just started reading about Value at Risk and there were a few questions that were brought to me as I was fiddling with it in R. Suppose my time series that is ...
0
votes
1answer
255 views

How to properly set strategy parameters and select portfolio

I have the following strategy pipeline which is a function of several hyperparameters and execution parameters: ...
1
vote
0answers
167 views

Berkowitz test for CVaR backtesting

I want to test CVaR using the Berkowitz test (focus on the left tail). I have a couple of doubts: Do I need to transform only actual losses that are above CVaR; In the first transformation, whether ...
1
vote
3answers
270 views

Backtesting, how missing data points should be handled?

Assume a daily trading strategy. Obviously, there are weekends and holidays when the market is closed. Should those days be excluded completely or should the price be interpolated in some way to fill ...
3
votes
0answers
73 views

Backtesting: what happens to real-executed order if mine fills instead?

I'm writing a backtester and using an order-by-order Nasdaq ITCH feed whilst testing it. Let's say the bid-ask spread is 100 @ 9-11 @ 100 My strategy inserts an bid order for 100 @ 10 and this ...
3
votes
2answers
291 views

Backtrader doesn't display time when backtesting

I am trying to backtest a strategy with Backtrader (not the first time) and have a problem while printing date & time for each iteration (time stay on 23:59:59). Here are the first lines of my ...
0
votes
1answer
327 views

How to combine rolling window backtest result?

I have a strategy that buys a set of stocks and holds them for 6 months then rebalances. I would like to apply a rolling window backtest to the following strategy, but am wondering what is the ...
-1
votes
1answer
194 views

Doing opposite of what the model says

Is it considered a viable trading strategy to do the opposite of a consistently losing model? That is, whenever the model says short, you go long, and vice versa. Disclaimer: I would never do this. ...
0
votes
1answer
240 views

Python Library To Calculate Porfolio Statistics

I am working through some backtesting ideas and I would love to capture the basic statistics results for comparison, (cumulative returns, annual returns, sharpe, omega etc.) Is there a python library ...
0
votes
1answer
116 views

Unsupervised learning and in out of sample

Assume we are given $N$ samples, let's say small timeseries of 1 hour resolution daily exchange rates - for the sake of argument. Each sample is a $24$ element vector $x$. Then we proceed to do ...
-1
votes
1answer
362 views

quantstrat for backtesting vs. writing one's own code in R

I have invested a few years in learning R and have developed a number of Monte Carlo backtesting scripts. My question is this: In general, for a person with some experience writing R code who is ...
1
vote
1answer
99 views

Dual Settlement Market Backtesting and Analysis

An interesting problems I have been dealing with as a relatively new quant to the Electricity markets is the difficulty of back testing. The issues I have been having with backtesting are that the ...
3
votes
1answer
172 views

expected shortfall as unconditional expectation

Acerbi has several backtests for expected shortfall. The second backtest is based on this equality Does anybody know how to derive this equality? Can anybody explain, why it makes sense, especially ...
0
votes
1answer
131 views

VaR Backtesting. High frequency of exceedances

I'm preparing for thesis defense and I've got simple question connected with Value at Risk backtesting. Portfolio VaR was calculated using historical simulation approach (250 days and 500days) and ...
0
votes
0answers
59 views

How do I build an EQ Options backtesting system?

I have a current problem on hand. I've been building my backtests in excel, using basic logic formulas and loading huge historical data sets going back from 1990s. Although this has been rather ...
1
vote
0answers
313 views

Extracting continuous futures prices on different dates with the ratio adjustment

I extract continuous prices for a set of futures contracts using Bloomberg. I select the Ratio as adjustment with the Bloomberg default settings. For instance, to extract the first/forward generic ...
1
vote
0answers
112 views

Multi objective optimization Swaption/Caplets joint Calibration

People suppose that we have a two asset type portfolio optimization (as Intrument Type 1 and 2). In the each portfolio refered by the instrument type there are 2 asset so we have four asset in total. ...
0
votes
1answer
468 views

Backtesting Value at Risk. With kupiec test

I have a certain problem with backtesting calculated earlier Value at Risk. I've got calculated daily VaR with historical simulation method for stocks. I've used two values of alpha 0.05 and 0.1. Now,...
0
votes
1answer
420 views

Margin modelling to backtest futures investment strategy

Let say that I have access to continuous daily time series for 20+ years of data for E-mini S&P 500 Index Futures. I have a long/short strategy to backtest that places orders either on open or ...
4
votes
0answers
152 views

reference for portfolio / margin calculations in backtesting tool

I have been tasked with writing a backtesting tool from scratch. I understand a lot of trading operations, but I am primarily a researcher. I need to support futures and equities trading. I need to ...
1
vote
0answers
282 views

How to backtest a factor by building a factor-tilting portfolio

A recent research paper from Wolfe Research suggests an alternative to the traditional "long top quintile, short bottom quintile " approach to backtesting a factor. It says to construct a factor ...
0
votes
0answers
188 views

Traffic Light Approach

I recently came across this term "Traffic Light Approach" in the parlance of Back testing and Model Validation. I don't understand it very clearly. I googled a bit, dint find anything very ...
1
vote
1answer
156 views

Where is the bias in this simple backtesting framework?

I usually write my backtests in Python or a dedicated backtesting environment, but I wanted to experiment with some of R's predictive analytics functionality. I wrote an extremely simple backtester ...
2
votes
2answers
164 views

Backtest Results needed to Model Validate my Modern Portfolio Theory model

this is my 1st post, and I hope someone can help me! I have been searching for a week now without any luck I have built a Portfolio Allocation model based on Modern Portfolio Theory (MPT). I now need ...
2
votes
1answer
207 views

strategy for backtesting

Short version: How do I evaluate models that predict stock performance? Back story: I'm working for a stock analyst, writing an application to sort through stocks and find candidates that fit the ...
1
vote
1answer
213 views

Backtesting of value and technical analysis

I am an economic last year student trying to figure out how to backtest my model. It consist on several requirements imposed to the stocks before buying them and a very simple exit strategy. I ...
1
vote
0answers
64 views

Combine future contracts into time series [duplicate]

I have future contracts from 10 years back that are combined in one file. There is a gap in the data every month due to rolling of the contracts. How do I remove this gap ad get a smooth time series ...