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

Why my backtesting program didn't enter any position?

I am new to the field of programming, and recently I am trying to write a backtesting program by using backtrader. But it didn't enter into any position, can anyone tell me why? CSV doc to run this program The csv doc is attached for your reference.…
0
votes
1 answer

When are strategy.entry and strategy.exit executed?

I am trying to count the total number of trades done by a dummy strategy in backtesting but I have trouble counting the trades that enter and exit at the exact same time. This is the strategy: //@version=5 strategy("Super/MACD/RSI",…
Gett
  • 3
  • 1
0
votes
1 answer

Azure Data Explorer (Kusto/KQL) Financial Asset Backtesting Trail Stop Follow-Up

This is a follow-up question from Stack Overflow question 71501098 Original Question I have a data set of financial asset prices over time and I'd like to mimic a trail stop for back testing strategies against this data set. There is a modification…
0
votes
1 answer

How to plot Technical Analysis indicators in VectorBT

I am using the vectorbt library to run tests and visualize results. I want to use the KeltnerChannel indicator. KeltnerChannel is only available in the Technical Analysis Library (TA). I get a visual plotted when I…
timmy
  • 468
  • 1
  • 6
  • 21
0
votes
1 answer

How to backtest small time frame in longer than default?

I have a strategy in time frame 5m. I backtest my strategy but I can do only 2 - 3 months. My question is have any way to do the backtest longer than 2 - 3 months for a time frame of 5m.
Tee S
  • 13
  • 2
0
votes
1 answer

Rollapply for backtesting the value at risk

I want to backtest the empirical (unconditional) value at risk of a time series vector: x = rnorm(1000) xt = diff(x) quantile(xt,0.01) So I am thinking that rollapply function in R might be helpful, since I want to roll estimate the quantile a…
Homer Jay Simpson
  • 1,043
  • 6
  • 19
0
votes
1 answer

Backtesting in R for time series

I am new to the backtesting methodology - algorithm in order to assess if something works based on the historical data.Since I am new to that I am trying to keep things simple in order to understand it.So far I have understood that if let's say I…
Homer Jay Simpson
  • 1,043
  • 6
  • 19
0
votes
3 answers

`pd.DateTimeIndex` is advised in backtesting.py library

I am using the backtesting.py library https://kernc.github.io/backtesting.py/doc/backtesting/index.html What is this error? UserWarning: Data index is not datetime. Assuming simple periods, but 'pd.DateTimeIndex' is advised. bt = Backtest(data,…
0
votes
1 answer

Problem with backtrader live Gold (XAUUSD) data from IB (Interactive Brokers)

Backtrader works fine with live data of IB (Interactive Brokers) through TWS, but when I want to trade on gold commodity (XAUUSD), it cannot receive the data. the python code is: data = store.getdata(dataname='XAUUSD', sectype='CMDTY',…
0
votes
2 answers

Pine script - If ATR value equals

how can I check value of ATR with "if"? Let's say atr now eqauls 0.86. I need to check that (code below), but "if statement" does not work. Strategy Tester shows No Data. atr = ta.atr(14) if (atr == 0.86) strategy.entry("Long", strategy.long)
0
votes
1 answer

'numpy.int64' object has no attribute 'to_pydatetime' in backtrader feed

I am unable to fix the error - 'numpy.int64' object has no attribute 'to_pydatetime', I will be really grateful, if anyone could please help me out in this? I have already tried uninstalling pyfolio and itstalling it from git. Please see the…
0
votes
1 answer

All pyramiding trades close at the same time

I have TP and SL based on ATR value at entry moment. I have pyramiding option turned on, but then, all open at specific time trades (that are in the same direction: long or short) close at the same moment, all together. How to make every trade…
0
votes
1 answer

Conditionally set data frame values based on logic

I have a data frame that has price of an asset, a bunch of trigger prices and some price target parameters. target_A = +2 target_B = -1 price trigger 2017-08-17 04:00:00 1 True 2017-08-17 04:01:00 2 …
0
votes
1 answer

My strategy.entry() is not executing at all

I've just recently started pine scrip and I wrote this code backtest a strategy, however the strategy.entry() function seems not to be working. I've even changed it such that it has nothing to do with the rest of the code at all and it still doesn't…
0
votes
0 answers

I am trying to organise this code to test over multiple stocks

I am trying to formulate a code that tests for optimal MA's on a list of stocks. I have a working code for one stock that simply returns a one line DF with the best result, but I am struggling to try and create a code that runs for multiple socks. I…
Ben
  • 25
  • 2