Backtesting - Bars referenced

Questions about MultiCharts and user contributed studies.
bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Backtesting - Bars referenced

Postby bluefightingcat » 20 Jan 2016

I am trying to figure out the logic of how backtests are done with regard to referencing. I have an indicator that references 100 bars back.

I use daily bars and I want to run a backtest from 01Jan2015 to 31Dec2015. Does MC automatically reference 100 days before 01Jan2015 so that the indicator shows the proper value from the start of the test at 01Jan2015?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Backtesting - Bars referenced

Postby JoshM » 20 Jan 2016

I am trying to figure out the logic of how backtests are done with regard to referencing. I have an indicator that references 100 bars back.

I use daily bars and I want to run a backtest from 01Jan2015 to 31Dec2015. Does MC automatically reference 100 days before 01Jan2015 so that the indicator shows the proper value from the start of the test at 01Jan2015?
I think there are two things to keep in mind:

* An indicator script cannot be backtested, so you'll need to convert it to a strategy.
* And the MaxBarsBack setting of a trading strategy cannot be set automatically, but needs to be manually specified.

So the question of 'Does MC automatically reference 100 days...' seems misplaced here because the strategy doesn't automatically reference 100 days.

However, let's say you've set your strategy to a MaxBarsBack of 100, then the strategy waits till calculating for the first time until MultiCharts processes bar number 101. So if you want to run a backtest over 2015, you'll need to make sure there are at least 100 bars prior to January 1 so that the strategy can start calculating on the first day of the year.

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Backtesting - Bars referenced

Postby bluefightingcat » 20 Jan 2016

Yes exactly. (I am indeed using a signal not an indicator in backtesting).

The problem is that to compare two different backtests using two different indicators say one that uses 100 days and one uses 40 days, I would have to manually count the bars backwards to make sure that bar 101 and 41 are on the 1/Jan/2015. This is somewhat tedious. I would imagine this would not be too difficult to code into the portfolio manager.


Return to “MultiCharts”