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

zipline : change input data for built in factors

I'm trying to use Zipline API in my local environment. I have successfully ingested my custom csv data and the backtesting works fine without using the Pipeline API. However, I am lost on how I should make use of built in factors when using the…
0
votes
1 answer

Backtesting a Universe of Stocks

I would like to develop a trend following strategy via back-testing a universe of stocks; lets just say all NYSE or S&P500 equities. I am asking this question today because I am unsure how to handle the storage/organization of the massive amounts of…
Brandon G
  • 47
  • 7
0
votes
1 answer

Pyalgotrade - how to get average fill price for all open position

i need average fill price for shares when using pyalgotrade on each bar... i am unable to figure out a way to get the same using callout for getAvgFillPrice function. this would help me to decide to enter next trade or not. any help will be…
0
votes
1 answer

Minute data not working zipline

I wanted to get some minute history data by using the following: hist_minutes = data.history(context.aapl,'price',50,'1m') This gave me the following error: NoDataForSid:No minute data for sid 2509. This is strange because when I used 1d instead…
Ade Bijon
  • 85
  • 1
  • 1
  • 4
0
votes
1 answer

Rank Analysis of Stocks in Python for back-testing

I would like to perform some factor backtesting in python using a rank analysis, i.e. rank all of the stocks in a certain month based on some factor (say P/E ratio, attractiveness of CEO etc.) and then report an aggregate percentile performance (as…
Niccola Tartaglia
  • 1,537
  • 2
  • 26
  • 40
0
votes
1 answer

Quantstrat: Ordersize function

I'm new to R and I'm trying to figure out how to get quantstrat to work with a custom ordersize function. The idea is to always invest all available equity in Bitcoin so that it will be comparable to a B&H strategy. I have provided reproducible…
0
votes
1 answer

backtest package R extracting returns from object

I would like to extract the returns from the backtest package which are according the to the manual stored within a 5 dimensional array called 'results') This is the backtest package: https://cran.r-project.org/web/packages/backtest/backtest.pdf A…
Niccola Tartaglia
  • 1,537
  • 2
  • 26
  • 40
0
votes
0 answers

Quantstrat: applySignals error message

I would like to check a strategy using the quantstrat. The strategy will use a custom indicator as a signal. After the initial setup, signals and rules definitions then I called the function 'applySignals' that returned the following error (last…
0
votes
1 answer

Backtesting open position counter for trading in R

Getting started on backtesting some trading data, in particular a very basic mean reversion idea and can't get my head around how to approach this concept. How would I go about having a running 'posy' increase by 1 once DifFromFv (the deviation…
Kevin Chen
  • 23
  • 3
0
votes
2 answers

Zipline Error: AttributeError: 'NoneType' object has no attribute 'index'

I'd like to automate my manual trading strategies. However, for the beginning, I tried to reproduce Zipline's simple example of buying Apple stocks. I struggled running the algorithm with run_algorithm(). When I was trying to run the 'dual moving…
user8619348
0
votes
1 answer

Fitting Weibull distribution to the censored data

I would like to estimate Maximum Likelihood parameters of the Weibull distribution by applying to the following data with a given censoring vector in R: data= 9 2 11 49 7 5 3 36 30 6 62 5 3 29 29 1 13 1 24 11 9 4 7 15 11 15 1 1 1 …
0
votes
1 answer

Backtesting SMA crossover in quanstrat using CSV files

I have backtested a strategy using getSymbols() before, but the docs are not clear how to use CSVs. I am trying to test SMA crossover on some intraday data. Having searched online I did find that you have to give quantstrat an xts object to work…
eliquinox
  • 33
  • 5
0
votes
1 answer

How to populate regime in Z-Score backtest?

I am currently trying implement a single asset backtest, where buy signal is generated when zscore goes below a certain threshold and sell when it goes above the threshold. df1 = pd.read_csv('XBT.csv', index_col = 0) df1 =…
eliquinox
  • 33
  • 5
0
votes
2 answers

Backtesting stock returns for Moving Average rule in r

I am trying to backtest stock returns given a 10 month moving average rule. The rule being, if the price is above the 10mnth average - buy, if it is below the 10mnth average - hold the value constant. I know how to do this in excel very easily, but…
santorch
  • 151
  • 1
  • 14
0
votes
1 answer

Amibroker: Daily Loss Limit

I want to implement an afl code to find Daily Loss Limit in intraday trading. I will use the code for backtesting around 200 days. I have the following code but it is with mistakes. // identify new day dn = DateNum(); newDay = dn != Ref( dn,-1); //…
1 2 3
16
17