A couple quick questions...
I have an Indicator that does not use any bar lengths as input parameters, and looks back only 2 bars in the actual coding, but on a simple minute bar chart loaded, the Indicator does not start calculating until Bar 61. No strategies/signals are loaded on the chart.
1. What influences when MC will start up the calculations of an Indicator?
2. Do I have any programmatic control or user input controls available to force MC to start the Indicator calculations on a specific bar (in this case, on Bar 3 rather than Bar 61)?
I know that a simply solution would be to load more data on the chart, to allow for the delay in Indicator calculation start up, but the data that is driving the chart is coming from a historical ASCII Mapped dataset with no data feed associated with it, and as such, there is no more earlier data available in this particular case.
Many thanks! Much appreciate any input that can be provided.
Starting Bar for Indicator Calculations
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Starting Bar for Indicator Calculations
Hello eegroup,
All studies based on past data use a certain number of bars for their calculations. The number of bars is called Maximum number of bars a study will reference, or Maximum Bars Back, and can be found in the settings of an indicator or signal:
• MaxBarsBack is the amount of bars that would be used for initial script calculation, to get the initial value of functions, variables. This amount of bars would be skipped, so you will see a first signal on maxbarsback+1 bar (for ex, may vary depending on the strategy).
• For signals - the minimum MaxBarsBack is the largest MaxBarsBack required by all signals applied to the chart. For ex. you have data1=1 min, data2=1 day. If an Average in your code references data2 with Length=10, then the required MaxBarsBack value is 10. 10 days of data will be skipped on both series. If your code does not reference additional data series then bars of data1 will be skipped only.
• For indicators - the minimum MaxBarsBack is the largest look back (Length) required for calculation in this indicator.
• Chart data range should be higher than MaxBarsBack value.
• If your MaxBarsBack value is not enough the study would not be calculated and will show an error message.
• If your MaxBarsBack is too high (more than the amount of bars on your chart) then the study will be waiting for the required amount of bars. On the chart you can see "Strategy calculating" message in such case or "Calculating" for an indicator.
You can learn more about MaxBarsBack auto detect from this post.
All studies based on past data use a certain number of bars for their calculations. The number of bars is called Maximum number of bars a study will reference, or Maximum Bars Back, and can be found in the settings of an indicator or signal:
• MaxBarsBack is the amount of bars that would be used for initial script calculation, to get the initial value of functions, variables. This amount of bars would be skipped, so you will see a first signal on maxbarsback+1 bar (for ex, may vary depending on the strategy).
• For signals - the minimum MaxBarsBack is the largest MaxBarsBack required by all signals applied to the chart. For ex. you have data1=1 min, data2=1 day. If an Average in your code references data2 with Length=10, then the required MaxBarsBack value is 10. 10 days of data will be skipped on both series. If your code does not reference additional data series then bars of data1 will be skipped only.
• For indicators - the minimum MaxBarsBack is the largest look back (Length) required for calculation in this indicator.
• Chart data range should be higher than MaxBarsBack value.
• If your MaxBarsBack value is not enough the study would not be calculated and will show an error message.
• If your MaxBarsBack is too high (more than the amount of bars on your chart) then the study will be waiting for the required amount of bars. On the chart you can see "Strategy calculating" message in such case or "Calculating" for an indicator.
You can learn more about MaxBarsBack auto detect from this post.