Wolfie -
I'm doing this quickly before heading off somewhere, but let me see if I can point in a direction that may help you (and hopefully one or two others). An answer to your specific issue might depend on some details that were omitted, but let me take a SWAG.
One thing that trips some people up is that an AFL is executed multiple time in different contexts. For example, a let's say that you do a custom backtest on SPY from 1/1/2000 - present. It will be executed twice -
1. With the ticker SPY over the full date range of the available bars for the ticker with a stocknum of 0 for a single ticker (or 0 thru N-1 for a watchlist).
2. With the ticker ~~~EQUITY over the From/To date range specified in the AA and a stocknum of 0 for the custom backtester pass.
So, if you have info that has been derived from the SPY pass that is outside of the info passed to the backtester (signals, prices, stops, etc.), then you have to get it to the backtester pass that is done with ~~EQUITY. This is usually done with ATC's or static arrays. I suspect that your variable, conzone, might be defined in some conditional logic that is not executed in the ~~~EQUITY pass.
BTW, as an aside, one of the things that I suggest in seminars that I've done on AB is to make sure that you understand all of the passes of the AFL that are done. I usually distribute a "generic AFL" that puts out info to the debug window to highlight the different info.
-- BruceR
--- In amibroker@xxxxxxxxx ps.com, "wolfie125" <lurama125@x ..> wrote:
>
> Hi
>
> I am backtesting a system with the normal backtester no problems. I want to add some position sizing details, so need to use the custom backtester.
>
> Currently it uses a library by calling #include_once at the start. One of the functions in that library references different timeframes and works well currently.
>
> The moment i add
>
> SetOption("UseCusto mBacktestProc" , True );
>
>
> at the start of my code and obviously even with the rest of custom backtester code or without, it seems that this library function becomes a problem.
>
> it usually has a return value called conzone. Now the code the piece of code -> return conzone <- in the library file generates error 29 variable conzone used without having been initialized.
>
> Any ideas of what could have caused this will REALLY be appreciated
>