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??
ATR is not working during backtest [SOLVED]
ATR is not working during backtest
- Attachments
-
- Problem_Strategy.pln
- (4.45 KiB) Downloaded 1067 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: ATR is not working during backtest
Hello Sylpha,
In your Jxxxxx_ATR study you have explicitly specified ExecInfo.MaxBarsBack = 1;
In your Jxxxxx_ATR study you have explicitly specified ExecInfo.MaxBarsBack = 1;
Re: ATR is not working during backtest
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.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: ATR is not working during backtest
You just need to comment the ExecInfo.MaxBarsBack = 1; in the indicator code.
Re: ATR is not working during backtest [SOLVED]
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.
The maxbarbacks of the Strategy needs to inline with the indicator. Resolved now.