Questions tagged [backtesting]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

Walk-Forward Analysis: Sensitivity of Result w.r.t. shift in train/testing windows

I currently test numerous Trend-Following/Momentum and Mean Reversion trading strategies for cryptographic assets with granularities ranging from daily to 3 hourly spaced data points. The general set-...
0
votes
0answers
29 views

How to backtest a sample of trades to optimize stop loss on losing trades and profit targets on winning trades?

I have a history of hundreds of executed trades. Given those trades, I want to know if there's a tool or framework that can help me figuring out: What would have been the most cost efficient stop ...
2
votes
2answers
69 views

How does duplicate data affect backtesting?

Before developing a trading strategy, one should clean and preprocess his data set. It is very common that a data set contains huge number of duplicates. Question: How does duplicate data affect ...
0
votes
0answers
47 views

Calculating a trading profit rate

I wanted to chek my backtester engine, so I opened a tradingview account and I ran the same test. All buy and sell numbers, prices, dates, indicator calculation, etc were exactly same, but profit ...
0
votes
0answers
28 views

Entry price to consider while doing a forward/backtest test?

1 min timeframe signal generation. Thing I have considered: 1 - Close price can be predictive in nature Counter: shifted the ...
0
votes
0answers
45 views

What are your favourite benchmarks for signal (pre-trading strategy) backtesting?

In some situations, e.g testing the value of individual signals to be built into an ensemble method, it can be a bit too early to implement trading logic for the strategy needed to do a standard ...
1
vote
2answers
110 views

Why do we need event-driven backtesters?

I am reading this article at quantstart regarding event-driven backtesters. It seems to me that the main advantage of using an event-driven backtesters is that it avoids look-ahead bias. Usually I ...
1
vote
1answer
65 views

In-sample and out-sample backtest performance, how to do this?

I have a strategy in development that I am backtesting to optimize for parameters, a total of N combinations. Trying my best not to overfit. I run the first backtest for the in-sample period and I ...
2
votes
0answers
31 views

Mean directional accuracy and zero

I'm trying to use mean directional accuracy to evaluate my directional predictions in back-test, but it can't deal with realised directions which are 0, due to the comparison of the signs of ...
1
vote
0answers
92 views

In sample and out of sample in Mean Variance Optimization

Hello to everyone and thanks again for your help, i have find this forum really helpful while working on my final dissertation. However I'm here again because I have loads of doubts regarding the in-...
2
votes
0answers
100 views

how to avoid building a strategy that depends on very long trends

When I construct a strategy, it is easy to make subtle dependencies on trends that have existed for a long time. Sometimes it is legit to explicitly take advantage of the trends. For example, it has ...
1
vote
2answers
73 views

Lower MSE results in less profit when using Machine Learning

When using Machine Learning for predicting stocks, can a lower Mean Squared Error result in less profit after Backtesting or is there a mistake in the experiment?
0
votes
1answer
60 views

DATA for Backtest [duplicate]

I am a retail trader and i am looking for a data set that comprehends all us equities, ETF's, ADR's and indices going back at least to January 1st 2007. Data would need to be split + dividend ...
1
vote
1answer
51 views

Backtesting model results, but backtesting output sampled at different frequency than model output

So, I'm trying to backtest a model that computes P&L. This model pulls sensitivities on a weekly basis and applies market shocks to these sensitivities to project quarterly P&L. I want to ...
0
votes
1answer
150 views

stress testing zero coupon yield curve

i'm currently trying to stress test the zero coupon yield curve using daily observations from 2003 to 2019. Each Zero coupon yield curve originate from an actuarial curve with 37 tenors that range ...
3
votes
2answers
97 views

Compare two distributions for forecasting returns

Let's imagine that we have two separate models, both used to forecast the return for the next period. Both models are estimated everyday, and both models outputs a probability distribution. How can we ...
1
vote
1answer
113 views

Which data provider do you recommend? [duplicate]

i need to run optimization models and backtests on developed market equities. I have access to Refinitivs Eikon, but it doesnt have a backtest tool and downloading the data is a challenge on his own. ...
1
vote
1answer
116 views

How to take back-tested code and convert it to forward-testing code? (in Python)

How do you take back-tested code written using the zipline API and convert that into forward-testing code using the IB API (or better yet ib-insync API)? It seems like you would have to completely re-...
1
vote
1answer
210 views

Is studying R quantstrat worth the effort for an individual trader? [closed]

I see at least two problems. The R package quantstrat is poorly documented. And one must have dividends adjusted data. Otherwise the test results will be irrelevant.
1
vote
0answers
120 views

Why “profit factor” is used to compare trading strategies?

A lot of books/articles/trading forums mention that "profit factor" is probably the most important measure and should be used to compare different trading strategies. They define profit factor as ...
0
votes
0answers
47 views

Historical intraday data [duplicate]

I have been researching on the current APIs that I can request for the most detailed historical end of day intraday quote and trade data available in an easy to use format for research, backtesting ...
0
votes
1answer
186 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
2answers
164 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
311 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
34 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
909 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 ...
2
votes
1answer
84 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
4answers
413 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 ...
1
vote
0answers
108 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, ...
1
vote
0answers
123 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
81 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
94 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 ...
1
vote
0answers
14 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 ...
3
votes
2answers
252 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
935 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
100 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, ...
6
votes
2answers
1k 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 ...
4
votes
1answer
135 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
26 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
1answer
347 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
216 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
387 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
91 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
470 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
521 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 ...
3
votes
1answer
297 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
394 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
124 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
469 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
112 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 ...