# Clarifying "Maximum Bars Back" Setting W/Multiple Data Sets

Questions about MultiCharts and user contributed studies.
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 215 times

### Clarifying "Maximum Bars Back" Setting W/Multiple Data Sets

Here's an odd question I came across in my programming - perhaps someone here on the forum will know the answer:

Let's imagine you have a chart that has two data sets on it:

Data Set 1 = a 1 minute bar
Data Set 2 = a 15 minute bar

As part of a trading strategy (not an indicator), you have to calculate a 9 bar moving average based on data set 2. Here's my question: should the "Maximum Bars Back" setting be set to 9, even though during the time required to accumulate sufficient data to calculate a 9 bar moving average based on 15 minute data, there would have to also be 135 1-minute bars (data set 1?)

For some reason, this confuses me - thanks for any ideas!

Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 486 times

### Re: Clarifying "Maximum Bars Back" Setting W/Multiple Data S

You should set "Maximum Bars Back" the following way: first data series should be enough for 9 bars of data2, i.e. 135 bars if the symbol ticks every minute.

Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 215 times

### Re: Clarifying "Maximum Bars Back" Setting W/Multiple Data S

Dave,

What confuses me is this: if I run this setup and set the MaxBarsBack setting to "5", MultiCharts generates an error, saying that the program is trying to go back further than the MaxBarsBack setting. However, if I set it to 9 (assuming the moving average on data set 2 is set to 9), no error happens. Since 9 is less than the 135 bars you recommended in this scenario, does that mean that the historical backtesting results generated with a MaxBarsBack setting of 9 are wrong or incomplete?

Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 486 times