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.

EasyLanguage MaxBarsBackAs for the strategies, it’s different. You have to set the parameter by hand.

How to modify the MaxBarsBack for Strategy in Tradestation?

Example.

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.

Tradestation error log for maxbarsback

To increase the MaxBarsBack in TradeStation setting you to have to Right Click on the chart and select “Studies” and “Edit Strategies”

edit strategies in tradestation

In the “Customize Studies & Strategies” choose “Properties for All”. Finally, change the Maximum number of bars study will reference.

The default value is 50 if you are using a 200 moving average you have ti insert “200”.

TradeStation how to increase the maxbarsback value

 

How to modify the MaxBarsBack for Strategy in MultiCharts?

Example.

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”

format signal in multicharts MultiCharts how to increase the maxbarsback value

 

Do you want to learn EasyLanguage & PowerLanguage for TradeStation and MultiCharts? Start here:

 

 

EasyLanguage References.

 

 

Leave a Reply