Max Bars Back & 2 Instruments  [SOLVED]

Questions about MultiCharts and user contributed studies.
Posts: 71
Joined: Nov 23 2015
Has thanked: 22 times
Been thanked: 8 times

Sep 09 2018

I have a chart with 2 data streams; Data1 is a 5000 tick chart, and Data2 is a daily chart. Data2 is used for a filter, while buy/sell signals are generated on Data1. My question is: Which data stream does Max Bars Back apply to? It seems to apply to different streams under different circumstances. I would expect it to apply to the primary data stream, Data1.

But this does not seem to be the case. Say Max Bars Back is set to 50. When a strategy is applied to Data1, no trades are generated for 50 days - so it is operating on Data2, the daily stream. I reset the Max Bars Back to 5, thinking 5 days would be plenty on the 5000 tick stream. The maximum bars I need on the 5000 tick data is 20, which is much less than 5 days.

Then I run an optimization, and I get an error saying Max Bars back is not set high enough. So the optimization process obviously applies Max Bars Back to Data1.

In the case of two data streams, shouldn't the application of Max Bars Back be consistently applied to one data stream or the other?

User avatar
Posts: 726
Joined: Dec 16 2006
Has thanked: 125 times
Been thanked: 412 times

Sep 10 2018


it applies to both data streams. In other words you should see no trades until the max bars back are sufficient for the highest time frame you are using in your code and you will run into the error message when any of the length inputs in your code that require a look back (even if it's only applied to the shortest time frame) of more bars that set up as max bars in the properties.