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
1 answer

Capture Trade into Variables inside a Strategy Script

I want to capture trade entry and exit into my script variable for future use. I am able to do so using a strategy.position_size. The way I am doing this is -> when position size becomes 1, I assume that entry has happened and when it changes to 0…
Reena Chauhan
  • 31
  • 1
  • 2
0
votes
1 answer

Why do I get divergence convergence testing in Python code error and crumb error?

This is the code: import numpy as np import pandas as pd import statsmodels from statsmodels.tsa.stattools import coint # just set the seed for the random number generator np.random.seed(107) import matplotlib.pyplot as plt Generate a fake…
0
votes
0 answers

Back testing momentum effect

I have a data frame with these values, 2006-01-01 -1.1913 -1.0560 2006-02-01 -2.1481 2.3750 2006-03-01 -0.8210 -2.0268 2006-04-01 -1.7912 …
Joy Shiro
  • 21
  • 1
  • 3
0
votes
1 answer

Ist there Something as a vectorized Backtesting Platform?

I got a pandas series of timevalues and 1s for a Trade and 0s for Not to Trade (plus different Takeprofit and stoploss values) and i am Planing to Backtest it. However the Last Time I used backtrader I manually had to search the current…
0
votes
1 answer

json decode issue backtesting with zipline

I'm running the test code below on ubuntu server. I'm trying to back test a simple buy and hold strategy with zipline. I'm just trying to make sure I've got everything installed correctly to back test. I'm pretty new to zipline. I'm getting the…
user3476463
  • 3,967
  • 22
  • 57
  • 117
0
votes
1 answer

How to slice sub-samples of data in the same way?

I work in Equity Research and just started transiting my Quantitative model of the market from Excel to Python code several weeks ago. My primary aim is to create a backtester of multi-factor model, and later evolve it into active quantitative…
0
votes
1 answer

How to identify a first occurence of a condition in python data frame and perform a calculation on it?

I am really struggling to get a logic for this . I have data set called Col as shown below . I am using Python and Pandas I want to set a new column called as "STATUS" . The logic is a. When Col==0 , i will Buy . But this Buy will happen only when…
vista
  • 13
  • 3
0
votes
1 answer

Backtesting: Which is better? Sliding Window or Expanding Window?

I know that there are two ways to do backtesting, sliding window and expanding window. In practice, which method is better? What are the pros and cons of each method? In my opinion, I guess if the time series pattern is more related to the current…
Luke
  • 15
  • 2
  • 7
0
votes
1 answer

How can I implement a dollar trailing stop for my back tester?

Right now my my backtester tests a strategy buy simply taking profits at 0.025% and stop loss at 0.048%. I am trying to implement it activating a take profit above only after $27 has been surpassed. struggling to structure the code on this, help…
0
votes
1 answer

Why does my strategy doesnt show any data?

I am writing a simple strategy in pine script for backtesting in TradingView. Logic is simple. If today's close is less than 52 weeks low then purchase INR 10000 worth of stocks. My code looks as follows: //@version=4 strategy("Darshan 52 week low",…
Darshan Puranik
  • 1,055
  • 3
  • 14
  • 36
0
votes
1 answer

How to build a loop function for out-of-sample backtesting?

Many statistical libraries in R offer the possibility to fit a model and then use the results of optimization to predict values some periods ahead. However, many do not have the possibility to backtest the results out-of-sample. Therefore, I want…
Vitomir
  • 295
  • 2
  • 14
0
votes
1 answer

PineScript: Buy at certain time above day's high so far

I'm writing a backtesting strategy to buy at certain time every day above that day's high so far. I've written a pinescript strategy. See below. I've restricted it to August month of this year. This is applied on a 5m…
supernova
  • 43
  • 5
0
votes
0 answers

How to add extra bars to the right of the chart in Backtrader Python3

I am trying to plot the Ichimoku indicator using Backtrader in Python3 It plots it well, however, I am not able to see the future Kumo cloud. That is the extra 26 bars to the right after the last price on the X-axis I have tried using different…
0
votes
1 answer

Tabulating Profit And Loss For Backtesting using Bigquery

I have this Bigquery dataframe where 1 in long_entry or short_entry represents entering the trade at that time with a long/short position corresponding. While a 1 in long_exit or short_exit means exiting a trade. I would like to have 2 new columns,…
atjw94
  • 529
  • 1
  • 6
  • 22
0
votes
1 answer

How to vectorize an operation that uses previous values?

I want to do something like this: df['indicator'] = df.at[x-1] + df.at[x-2] or df['indicator'] = df.at[x-1] > df.at[x-2] I guess edge cases would be taken care of automatically, e.g. skip the first few rows.
paperduck
  • 1,175
  • 1
  • 16
  • 26