Questions tagged [backtesting]

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

Filter by
Sorted by
Tagged with
4 votes
1 answer
604 views

Historical stock borrow fees

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?
Igor Rivin's user avatar
1 vote
0 answers
38 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 ...
LuaLua's user avatar
  • 13
0 votes
1 answer
546 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: ...
tmakino's user avatar
  • 101
1 vote
0 answers
310 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 ...
user31388's user avatar
1 vote
3 answers
1k 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 ...
Arthur's user avatar
  • 113
4 votes
0 answers
106 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 ...
user997112's user avatar
3 votes
2 answers
909 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 ...
AlexM's user avatar
  • 334
0 votes
1 answer
1k 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 ...
harinsa's user avatar
  • 111
3 votes
1 answer
388 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. ...
Moataz Elmasry's user avatar
1 vote
1 answer
2k 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 ...
Avagut's user avatar
  • 161
0 votes
1 answer
213 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 ...
Dionysios Georgiadis's user avatar
0 votes
1 answer
660 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 ...
Ernie's user avatar
  • 11
1 vote
1 answer
146 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 ...
rgalbo's user avatar
  • 153
2 votes
1 answer
234 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 ...
PalimPalim's user avatar
0 votes
1 answer
292 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 ...
Rafał's user avatar
  • 5
1 vote
2 answers
2k 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 ...
WJA's user avatar
  • 217
1 vote
0 answers
150 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. ...
Bond007's user avatar
  • 83
0 votes
1 answer
2k 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,...
Rafał's user avatar
  • 5
0 votes
1 answer
724 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 ...
MLguy's user avatar
  • 340
3 votes
0 answers
230 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 ...
quantresearcher_lambda's user avatar
1 vote
0 answers
424 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 ...
lebelinoz's user avatar
  • 274
1 vote
1 answer
242 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 ...
ManChild's user avatar
1 vote
2 answers
455 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 ...
Enox's user avatar
  • 11
1 vote
1 answer
403 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 ...
BWhite's user avatar
  • 113
1 vote
1 answer
284 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 ...
Polo's user avatar
  • 11
1 vote
0 answers
102 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 ...
user2300940's user avatar
0 votes
1 answer
554 views

ML classification algorithms give random profit [closed]

I use backtrader python framework to backtest ML classification algorithms to make decision ...
Maxim Korobov's user avatar
2 votes
1 answer
319 views

How to identify a change in market dynamics?

As a beginner, I'm learning how to make good trading strategies. One of the things to consider for reliable backtesting is the Minimum Backtest Length, whose selection is basically a tradeoff: Too ...
user9343456's user avatar
0 votes
1 answer
617 views

Trouble understanding lookahead bias

I understand lookahead bias is pretty common industry knowledge. But I cannot wrap my head around how I am introducing it and could use a nice and easy explanation. Here's my thought process. I have $...
user avatar
1 vote
1 answer
793 views

Computing the profits for a simple trading strategy (Backtest)

I have developed a trading algorithm, surprisingly simple in nature (I did start off with grand plans of applying Machine Learning to this problem as I am a data scientist by trade). I would place ...
Chinny84's user avatar
  • 274
2 votes
0 answers
160 views

How to reset indicators in quantstrat / quantmod?

I am currently trying to back test a strategy on a file which contains minutely data for the whole month. I would like to reset my indicators at 3:30 PM . Is there a way I can reset the indicators ...
Yatharth Narang's user avatar
0 votes
1 answer
764 views

when calculating sharpe ratio of a backtest, do you use the historical risk-free rate or the current one?

Say I'm running a few backtests, say 1980-now, 2000-now and 2010-2015. When I'm calculating the Sharpe ratio of these backtests, do I use the risk-free rates associated with those time periods? or ...
Spencer Smolen's user avatar
1 vote
0 answers
301 views

Backtesting with option

More of a general question: is there anything there like a software to have any meaningful backtesting done on US equities with options in portfolios. Looking more of an off shelf product or open ...
Kate K's user avatar
  • 11
7 votes
1 answer
979 views

Python Backtesting Framework Similar to Quantstrat

I use Quantstrat heavily for strategy research and optimisation. I have two Python developers about to join my team and would like to use it as an opportunity to diversify our research tools so we are ...
Ed Wilson's user avatar
2 votes
4 answers
5k views

Close or Adjusted Prices when Backtesting

I've been doing this for some years now, but recently, since I started fiddling around with an old pairs trading strat of mine again, when updating the databases before running the tests, I was ...
Eduardo Gonzatti's user avatar
3 votes
2 answers
2k views

Does QuantConnect use both bid and ask data for backtesting?

Or Quantopian? How about Python libraries like ultrafinance and PyAlgoTrader?
Dark Knight's user avatar
0 votes
1 answer
163 views

I want to publish my research framework for quantitative finance

I have spent numerous months writing a framework for testing and researching for strategies, I now want to publish this framework with hopes of possibly marketing myself. It includes quandl data as ...
FX_NINJA's user avatar
  • 500
1 vote
0 answers
62 views

A priori selection of acceptable backtesting errors (type I and II)

Is it possible to a priori select an acceptable values of type I and II errors in backtesting (f.e. in case of the unconditional coverage test)? Type I error is directly connected to the significance ...
abu's user avatar
  • 229
0 votes
1 answer
96 views

How do option traders choose the strikes and maturities?

How do option traders choose their strikes and maturities ? Like why would one roll XX% puts in their protection leg instead of YY% puts, or why choose specifically XX%/YY% as the strikes in a ...
BS.'s user avatar
  • 165
1 vote
1 answer
431 views

Do we need to lag values for backtesting?

I am using R moving average crossover backtest script from eickonomics. But I have a question about this section. ...
Eka's user avatar
  • 647
3 votes
2 answers
2k views

How to organize historical data including delisted

Working with delisted or bought-out companies poses some difficulties in how to organize price data for backtesting. I've been backtesting some investment algorithms on free data from Yahoo! where I ...
Marshall Farrier's user avatar
1 vote
1 answer
356 views

What is wrong in this python backtester? [closed]

I am trying to write a simple backtester using python and pandas. I have reused the code of Michael halls moore's pandas backtester. I rewrote the programme because first I want to understand how ...
Eka's user avatar
  • 647
3 votes
1 answer
424 views

Should a backtester have ability to run multiple strategies simultaneously?

At the moment the backtester has a portfolio; a portfolio is associated with one strategy. The backtester is used to test different strategies one at a time, giving their return, Sharpe, drawdown. But ...
A.L. Verminburger's user avatar
2 votes
1 answer
128 views

Can I split my backtesting into multiple consecutive sub-periods?

I'm testing a model to estimate the VaR of a portfolio with different stocks. I used 1500 data to estimate some parameters, and now I have other 1500 data for backtesting purposes (for a total of 3000 ...
Kondo's user avatar
  • 449
6 votes
5 answers
7k views

Writing an Options Strategy Backtester

I've been doing some digging, and this question has been asked many times in various forms over the years - Backtesting Options Strategies in R Are there any good tools for backtesting options ...
user avatar
1 vote
0 answers
294 views

Relationship between in-sample and out-sample periods length

I have two general questions regarding "in-sample fitting vs. out-of-sample backtesting" kind of analyses. Is there any relationship between the length of the data collected for in-sample fitting ($a$)...
Kondo's user avatar
  • 449
4 votes
1 answer
1k views

How to backtest strategy in portfolio of stocks using SIT R?

I am creating and testing strategies in R code and using systemic investor toolbox(SIT) package as the backtesting tool. I copied a SIT backtesting code from a website and made small changes to make ...
Eka's user avatar
  • 647
3 votes
0 answers
1k views

'GARCH - extreme value theory - copula' approach to estimate risk measures in R

I'm reading about this approach of using GARCH-EVT-copula methodology to separate univariate and joint estimation and then estimate for example VaR and ES. I wanted to try something similar, but my ...
Kondo's user avatar
  • 449
2 votes
0 answers
701 views

Backtesting Long/Short Market Neutral Z-Score Strategy with Custom Factors and Custom Stock Universe

So I've managed to backtest simple strategies, like MA, RSI and some fundamental ones (P/E ratios etc) but Im stuck at my last strategy. Here is some information: Tools: Excel and Python (also a ...
mortenhaga's user avatar
1 vote
0 answers
158 views

Should the number of Markowitz Optimization steps be counted as backtest trials?

I'm backtesting a strategy that involves monthly investments in a few stocks out of a given set, that is, each month some of the stocks are shortlisted from an index and a long position is taken in ...
user9343456's user avatar

1 2 3
4
5
8