Error 046 debugging help

Posted By: DdlV

Error 046 debugging help - 06/09/15 16:09

Hi jcl. I'm getting Error 046 and would appreciate some debugging clarifications/suggestions:

a) The manual reports this error as "Error 046: LookBack exceeded" but I am experiencing "Error 046: IDX LookBack exceeded by <n> bars". Does the addition of "IDX" to the message provide any more information?

b) The error is popping up _between_ runs, as determined by printf's at the very start and very end of the run function. There is no tmf involved. Any suggestions how to track down this error given that it's getting triggered within the Zorro code that I can't see?

c) The popup provides Abort, Retry, and Ignore buttons. The progress bar has gone ~80%. Abort produces the summary stats in the window (Profit, #Trades, AR, etc.) but no chart. Is that correct? Shouldn't Abort just stop everything then & there? Retry and Ignore produce an Error 030, do not print the summary, do plot a chart, and in the log is a final trade entry message that does not appear if Abort is pressed. Do these differences provide any clues?

Thanks.
Posted By: jcl

Re: Error 046 debugging help - 06/11/15 11:12

I believe "IDX" means that a function that takes an index, such as price() or day(), exceeds the lookback. And this not in the first run but somewhere else, so you're modifying the offending index somewhere in your script. Hope this helps.

Normally you need not debug it, but just increase LookBack.

What happens after "Abort" depends on your script. If it has collected some trades, then you'll see that in the exit message.
Posted By: DdlV

Re: Error 046 debugging help - 06/11/15 12:39

Thanks jcl. Increasing LookBack did resolve the issue, but I believe I had a misunderstanding as follows.

It seems the price() functions are implemented as series of length LookBack? In other words, my strategy was not attempting to look earlier than the 1st LookBack bar. It was at a later point in time attempting to get price(n), with n>LookBack. This price(n) is a price that the strategy has already encountered after lookback, so I expected it to be available.

The manual does not say the offset for the price() functions needs to be <=LookBack, but this appears to be the case.

I had assumed the price() functions could retrieve all available price data in the History folder, but this appears not to be the case.

Thanks.
Posted By: jcl

Re: Error 046 debugging help - 06/11/15 13:49

All looks into the past must be <= LookBack at any time, because that is the very purpose of the LookBack variable.

Sure, you're right that in the backtest it would not matter because you have access to the whole price curve. But I suppose you'd run into a problem when you tried to trade that live.
Posted By: DdlV

Re: Error 046 debugging help - 06/11/15 14:59

Thanks jcl.

To clarify, my issue was that the backtest does _not_ have access to the whole price curve. At any given bar, the backtest only has access to the past LookBack prices.

An example with arbitrary numbers:

LookBack=100. At Bar=4327, strategy attempts price(231). Fail. Even though the strategy has actually experienced and processed this old bar. Zorro just hasn't saved this data because 231>100.

Now that I understand it makes sense, because this way the strategy functions the same in both Test and Trade. It just wasn't obvious initially since all the History is there for the price() function to use in Test. I think explicitly adding to the price functions manual page that offset must be <=LookBack might help someone else in the future.

Thanks.
© 2024 lite-C Forums