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

How to set the number of unit to buy based on 1% of current capital in pine editor tradingview?

I'm creating a strategy in Tradingview where it will enter a long position when EMA 25 crossover EMA50. This is my script: strategy("MyStrategy", overlay=true, initial_capital = 10000, default_qty_value = 100, default_qty_type =…
weizer
  • 1,009
  • 3
  • 16
  • 39
0
votes
0 answers

Loop iterating through a dataframe is not running after the first iteration

I have a trade history in a dataframe called trades. I have options data for the past years, and I wanted to check if I had taken those trades in options instead of futures. What would be my return? I have used the following code: Create a dataframe…
0
votes
0 answers

Copied the dataFrame but: "Cannot get right slice bound for non-unique label: Timestamp"

To execute a rebalance backtesting I've setup the following codes. The aim is to get a backtesting on two stratgies (bonds and equities), where the rebalancing is executed quarterly. Rebalancing means bring the alloction back to 20% Bonds and 80%…
0
votes
0 answers

Backtesting an algorithm from universe of stocks

I am using python to develop a algorithm that identifies certain patterns in time series from 500 stocks between 2010-01-01 and 2020-12-31. When I have identified a patterns a want to long(speculate that the stock will go up) or short(speculate that…
bjorks
  • 1
0
votes
1 answer

Close a position if a condition is not reach in "X" bars

I am new to this, I have developed a trading strategy and I am unable to code the following idea: I want to use to indicators. The first one is my main signal (RSI) and I want to close the trade if a second signal (cross under) is not reached in…
peferu
  • 1
  • 1
0
votes
3 answers

TradingView Strategy Entry on close price

How can one make a strategy entry order immediately after all conditions were satisfied? E.g. if(open_price > _some_condition) strategy.entry(...) I used "strategy(...process_orders_on_close=true)”, but I would like to make an order not on this…
Nikita Sydorenko
  • 11
  • 1
  • 2
  • 3
0
votes
1 answer

Naive portfolio selection rule

I have a xts file with monthly returns for 17 industry portfolios. The data looks as follows: Cars Chems Clths Cnstr Cnsum Durbl FabPr Finan Food Machn Mines Oil Other Rtail Steel Trans 1926-07-31 4.77 1.20 -0.09 4.20 2.05 1.33…
0
votes
1 answer

Running backtest on backtrader I get many BUY ORDERS CANCELLED/MARGIN/REJECTED when they should not

Many buy orders are cancelled in the backtests and I cannot find why. Looking at the Writefile log it seems the buy orders are created at the next day's close. In most cases the buy price is in the day's range but still not executed. I have tried…
Miguel_D
  • 11
  • 2
0
votes
1 answer

How to create on R a portfolio of 300 equally weighted stocks from a price time series and backtest the portfolio?

I have 300 stocks (here for example i show you 5), how can i create an equally weighted portfolio and then backtest it ? Book1 # A tibble: 3,385 x 6 ...1 AAA BBB CCC DDD EEE
0
votes
1 answer

Pine Editor backtesting not working on lower time frame charts

I am trying to backtest a simple strategy on trading view with pine editor. I want my strategy to run on the 15M time frame for a specific period in time (the back testing period). I have inserted the following time-related code into my…
0
votes
1 answer

How to create fixed new numpy array values based on conditions - stock prices

input_array = ([[13, 93, 47, 857], [16, 91, 55, 800], [18, 105, 85, 821], [17, 106, 89, 890], [19, 105, 60, 961], [20, 106, 41, 988], [21, 107, 45, 999],]) take_profit = …
blueorchid
  • 99
  • 6
0
votes
1 answer

How can I architecture my application to backtest data in Rails?

I want to backtest some data, I would like the output of my backtest and analysis to be an input into the decisions of my application. I thought about duplicating a model/table and for the purposes of performing my backtest and analysis, but then I…
Will
  • 521
  • 1
  • 6
  • 18
0
votes
1 answer

How to replace a pandas column row with the previous row if a condition is met

I'm trying to speed up my trading strategy backtesting. Right now, I have for i in trange(1, len(real_choice), disable=not backtesting, desc="Converting HOLDs and calculating backtest correct/incorrect... [3/3]"): if (advice[i] == "HOLD"): …
jangles
  • 303
  • 1
  • 6
  • 22
0
votes
1 answer

How to Order a fraction of a Crypto (like Bitcoin) in zipline?

Basically as you all know we can backtest our strategies in Zipline, the problem is that Zipline is developed for stock markets and the minimum order of an asset that can be ordered is 1 in those markets but in crypto markets we are able to order a…