"maximum number of bars study will reference"

Questions about MultiCharts and user contributed studies.
gary1288
Posts: 16
Joined: 11 Jan 2023

"maximum number of bars study will reference"

Postby gary1288 » 05 Apr 2023

I have a complex strategy.
the main chart, data1 is 1 minute. mnqh3 100 days. ( mnqH3 is expired now, but I think it should be ok use this symbol)
data2 = 3 minutes. mnqh3 100 days
data3 = 1 minute. mnqh3 100 days
the strategy code has some functions which run on data2, data3.

The "maximum number of bars study will reference“” are bigger than I thought.
I change it to 20000, MC still show error message. " tried to reference back more bars(20001) than allowed by the current MaxBarsBack setting. please increase the MaxBarsBack Setting.

I change the "maximum number of bars study will reference“ to 25000 ( for 1 minute, it will be about 20 days ) , it is ok now.
It seems that MC has some limitations for complex functions.
Also I found the trading Period is only "1 month, 21 days " , the historical signals is starting from 2023-01-26 , but the data range is 100 days.
I found an article, https://www.multicharts.com/trading-sof ... ripts_Work
I will read this.

User avatar
ABC
Posts: 721
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 409 times
Contact:

Re: "maximum number of bars study will reference"

Postby ABC » 05 Apr 2023

gary1288,

the large max bars back number is limiting your range of data. Keep in mind that the max bars back setting must be fulfilled for all datastreams i.e. your settings will skip the first 25000 3 minute bars.
Multicharts just re-acts to what your "code demands in terms of max bars back". If the requirements are that high, it usually makes sense to track down the code parts causing the problem and to find better ways i.e. using methods with less impact on the max bars back to accomplish the same.

Regards,

ABC

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "maximum number of bars study will reference"

Postby TJ » 05 Apr 2023

I have a complex strategy.
the main chart, data1 is 1 minute. mnqh3 100 days. ( mnqH3 is expired now, but I think it should be ok use this symbol)
data2 = 3 minutes. mnqh3 100 days
data3 = 1 minute. mnqh3 100 days
the strategy code has some functions which run on data2, data3.

The "maximum number of bars study will reference“” are bigger than I thought.
I change it to 20000, MC still show error message. " tried to reference back more bars(20001) than allowed by the current MaxBarsBack setting. please increase the MaxBarsBack Setting.

I change the "maximum number of bars study will reference“ to 25000 ( for 1 minute, it will be about 20 days ) , it is ok now.
It seems that MC has some limitations for complex functions.
Also I found the trading Period is only "1 month, 21 days " , the historical signals is starting from 2023-01-26 , but the data range is 100 days.
I found an article, https://www.multicharts.com/trading-sof ... ripts_Work
I will read this.

You have misunderstood the meaning of MaxBarsBack.

MaxBarsBack is the MINIMUM number of bars needed to calculate your study.

eg. if you have a 20 period moving average, the minimum number of bars needed to calculate this study is 20, therefore the MaxBarsBack is 20. (or 21, if you need the result for the next bar).

gary1288
Posts: 16
Joined: 11 Jan 2023

Re: "maximum number of bars study will reference"

Postby gary1288 » 05 Apr 2023

Thanks.
I don't think my code needs 25000 bars before I can do the math. There is some logic I don't know, not mentioned in the documents.
I am sure if I use the same code in an indicator, I don't need 500 bars because I have an indicator with the same code/logic. I set the MaxBarsBack = 500, The indicator works fine.

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: "maximum number of bars study will reference"

Postby TJ » 05 Apr 2023

For most situations, you should set it to Auto.


Return to “MultiCharts”