In this EasyLanguage & PowerLanguage Tutorial, we’ll talk about the MaxBarsBack. This tutorial can also be studied by PowerLanguage & MultiCharts users.
EasyLanguage uses the bars to calculates the indicators and strategies. When you attach an indicator in a chart, EasyLanguage requires a certain number of historical bars.
EasyLanguage & PowerLanguage Tutorial: MaxBarsBack
The MaxBarsBack is a setting that establishes how many bars the program will need to analyze.
For example, if you’re using a 200-periods Moving Average, the indicator will have to analyze at least 200 bars back.
The indicators work without further settings. Moving average needs at least 200 bars to start working, so the indicator will begin drawing on the chart only after 200 candles.
As for the strategies, it’s different. You have to set the parameter by hand.
How to modify the MaxBarsBack for Strategy in Tradestation?
You have a strategy with a filter that uses a 200-Period Moving Average to calculate the trend.
If you add the strategy to the chart, TradeStation stops the strategy and send this message error:
Elsystem.MaxBarsException: Tried to reference back more bars than allowed by the current MaxBarsBack setting. Please increase the MaxBarsBack setting.
Remember that the strategy status became off after you changed the MaxBarsValue, you have to reactivate your strategy.
To increase the MaxBarsBack in TradeStation setting you to have to Right Click on the chart and select “Studies” and “Edit Strategies”
In the “Customize Studies & Strategies” choose “Properties for All”. Finally, change the Maximum number of bars the study will reference.
The default value is 50 if you are using a 200 moving average you have ti insert “200”.
How to modify the MaxBarsBack for Strategy in MultiCharts?
You have a PowerLanguage strategy (signal in MultiCharts) with an Average True Range calculated in the last 100 candles.
You add the strategy to the chart and MultiCharts send you this message error: Tried to reference back more bars (100) than allowed by the current MaxBarsBack setting.
Please increase the MaxBarsBack setting. Multicharts also changes the status of the strategy to off.
To increase the MaxBarsBack in MultiCharts setting you to have to Right Click on the chart and select “Studies” and “Edit Strategies”