Questions tagged [back-testing]

( in Quantitative Finance, AI, ML, ... ) A systematic approach to put a System-under-Test [ SuT ] into a state, where historical data ( a known part of both the evolution of inputs and the eco-system responses ) are used & fed into a SuT so as to review it's behaviour in-vitro ( as opposed to a forward-testing )

( in Quantitative Finance, AI, ML, Technical Cybernetics, Modelling ... )

Back-testing

is a systematic approach to put a System-under-Test [ SuT ] into a state, where historical data ( as a known part of both the evolution of inputs and the eco-system responses ) are used & fed into a SuT so as to review it's behaviour in-vitro ( as opposed to a forward-testing ).


Strengths & Weaknesses

The concept of back-testing relies on an a-priori belief ( a proof of which is left on the reader ) that the SuT does not intervene with the environment's generalised dynamics.

In other words, back-testing assumes that the SuT does not influence the future evolution moves ( the very steps that were recorded in the Historical Data, that are being fed into the SuT during the flow of back-testing ) that the outer ecosystem, surrounding the SuT, actually undertook in the past.


Tools

Strategy Tester, Quantopian, Quant Modeller, Quant Strat, AmiBroker, TradingView, MultiCharts
and many more


Historical Data

Quandl, Olsen Data, Dukas Copy, Yahoo! Finance, Google
and many more

255 questions
0
votes
0 answers

Building a basic backesting app to backtest trading signals using javascript

I have historical timeseries data that has a datetime and a closing price that looks like this: 2022-09-01 00:00, 142.3770000 2022-09-01 00:01, 142.3660000 2022-09-01 00:02, 142.350000 2022-09-01 00:03, 142.3470000 2022-09-01 00:04, …
Hazza
  • 1
  • 2
0
votes
1 answer

R riskParityPortfolio / portfolioBacktest library backtesting fail

belows are example of riskParityPortfolio and portfolioBacktest library the result of sample is empty. anyone know why? I'm suspicious about data type of input list 'list(faang_data)'. but fail to find…
Jae Hoon
  • 59
  • 8
0
votes
1 answer

Pinescript Problem with Calc after order filled and calc on every tick for backtest. there are a lot of entries on same bar which destroy the backtest

I would like to know if someone has found a solution to counter this horrible calculation from tradingview: when Calc on every tick is selected only, the numbers of trades in backtesting seems correct, BUT because it doesn't calculate a…
0
votes
0 answers

Make Pandas Dataframe with lists of different length

Im trying to backtest a trading strategy and therefore I have split my data with TimeSeriesSplit. This creates 5 different pandas series for all columns with different lengths. I've managed to hardcode the first list with length = 16 into a pandas…
gks
  • 1
0
votes
0 answers

How to iterate through index + loop

I'm trying to backtest a sports betting model that calculates probabilities based on last 5 games. Here I have all the games from last season, but I'm having problems wrapping my mind around how I should approach this. Each team is given a…
0
votes
0 answers

Does vectorbt support for pairs trading

I'd like to use vectorbt to backtest pairs trading strategies and need a way for an Indicator/Signal to go long on one pair and short on the other when the Indicator/Signal is true. From what I've seen the portfolio opens up a position for both…
Garth
  • 533
  • 1
  • 4
  • 15
0
votes
1 answer

Order limit backtesting

I started to study "backtesting" and during testing I encountered one incomprehensible situation. class MyCandlesStrat(Strategy): def init(self): super().init() self.signal1 = self.I(SIGNAL) def next(self): …
xxxHEKETOSxxx
  • 57
  • 1
  • 9
0
votes
1 answer

Is there any difference between Random Walk with Walk Forward?

Usually when we are looking for a continuous way to backtest our own strategy we see how to generate data using Random Walk and using Brownian Motion, but the question is not clear to me since for me both Random Walk and Walk Forward sound the same…
phxz
  • 68
  • 8
0
votes
1 answer

Either repainting (because calc_on_order_fills=true) or my trailing stop loss in the strategy.exit is not working, Pine, Tradingview

Good Morning all! I've written a strategy in the Pine Editor, but unfortunately it doesn't quite work the way I want it to. Either it comes to repainting (because calc_on_order_fills=true) or my trailing stop loss in the strategy.exit function does…
0
votes
1 answer

backtesting.py finding the best values for Annual Return, SQN, Win Rate, Final Equity or other

Backtesting.py produces an object of the following type:backtesting._stats._Stats. I'm using three different methods (RSI, 4 moving averages, skopt) to determine Annual Return, SQN, Win Rate, Final Equity in three different instances of stats.…
Zen4ttitude
  • 143
  • 10
0
votes
0 answers

How to avoid removing values from dataframes when backtesting

I use the backtesting.py library. Example: https://colab.research.google.com/github/kernc/backtesting.py/blob/master/doc/examples/Multiple%20Time%20Frames.ipynb#scrollTo=Hj2hR-sidDhZ If I run a backtest using moving averages with n1 periods, the…
0
votes
2 answers

What does "context" in "def myFunc(context)" mean in python

I read a book named Trading Evolved and saw this code, where there are context variables in all 3 functions. I'm a newbie in Python and don't have a thorough Python knowledge. After searching on Google, Stackoverflow and in Zipline documentation…
David H. J.
  • 340
  • 2
  • 12
0
votes
3 answers

Backtesting problem with Pandas and vectorization

I have this DataFrame: df = pd.DataFrame({"val": [1, 2, 3, 5], "signal": [0, 1, 0, 0]}) df val signal 0 1 0 1 2 1 2 3 0 3 5 0 Then I do: df["target"] = np.where(df.signal, df.val + 3, np.nan) df["target"] =…
965311532
  • 506
  • 3
  • 14
0
votes
1 answer

How can I get a dataframe of Moving Averages in VectorBT?

I was trying to build a code which can manipulate Moving Averages from a closing price data. There is a method in VectorBT that allows to do that, which is : Moving_Average = vectorbt.MA.run(price, window = 14) print(Moving_Average) And this is…
0
votes
1 answer

Is there a way I can add rows of values to a dataframe in new columns, based on existing values in the dataframe?

I'm trying to backtest a trading strategy. Columns that I already have saved as a dataframe: 'Date', 'A', 'B', 'C' I am trying to create columns D, E, F, and G to the existing dataframe by performing operations row by row. I'm trying to: Start with…
jy2da
  • 45
  • 5