ATR is not working during backtest  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Sylpha
Posts: 29
Joined: 14 Apr 2015
Has thanked: 1 time

ATR is not working during backtest

Postby Sylpha » 27 Apr 2015

I tried to implement a strategy as attached.

When I use my own version of ATR (Jxxxxx_ATR) and run the backtest, MC.NET will throw error saying "Tried to Reference more bars (1) than allowed by MaxBarBackSetting. Please increase the MaxBarBackSetting".

However when I change the MaxBarBackSetting (say 30), the error message still persist and become "...more bars (30) than...". Then I have no way to fix it.

If I use MC.NET's own ATR in the strategy then it will flow buffer overflow instead which is very strange to me.

It is working fine if I use the ATR version downloaded here: viewtopic.php?f=20&t=45847 in my strategy.

MC.NET's ATR and my own custom ATR is completely fine when work as Indicator, so I don't know why they can't be used in strategy. Does anyone know what's going on here??
Attachments
Problem_Strategy.pln
(4.45 KiB) Downloaded 1067 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ATR is not working during backtest

Postby Henry MultiСharts » 29 Apr 2015

Hello Sylpha,

In your Jxxxxx_ATR study you have explicitly specified ExecInfo.MaxBarsBack = 1;

Sylpha
Posts: 29
Joined: 14 Apr 2015
Has thanked: 1 time

Re: ATR is not working during backtest

Postby Sylpha » 29 Apr 2015

Hello Sylpha,

In your Jxxxxx_ATR study you have explicitly specified ExecInfo.MaxBarsBack = 1;


I tried to hardcode the MaxBarsBack in the strategy to match with my custom atr, no luck.

Also I tried to use MC.NET's atr but it throws buffer overflow exception. I need someone to explain why these two issues happen. Please advise.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ATR is not working during backtest

Postby Henry MultiСharts » 01 May 2015

You just need to comment the ExecInfo.MaxBarsBack = 1; in the indicator code.

Sylpha
Posts: 29
Joined: 14 Apr 2015
Has thanked: 1 time

Re: ATR is not working during backtest  [SOLVED]

Postby Sylpha » 01 May 2015

I tried to comment the maxbarsback in the custom ATR but still the same problem. Honestly I don't know why. The problem seems come from the maxbarbacks of the strategy.

The maxbarbacks of the Strategy needs to inline with the indicator. Resolved now.


Return to “MultiCharts .NET”