Not a number (Nan), was: Error (-nan (ind), - 1. # IO) when optimizing

Good afternoon, first thing, sorry for my English.
I have been optimizing a strategy for a while where I enter the position when I have a symbol with an uptrend and volatile. (I do traiding day)
To do this I created a watchlist of the sp500, imported from other software that I have (tradestation), for this I passed it to an ascii and then I imported it to amibroker. at most 20 years in some symbols. less years in others. and save it in "data" in amibroker
I have coded an exit by levels of atr, in which at the close of the market, if it has not touched my stop, I update my stop. (Note that I work with Rmultiple of van tharp) so my code is focused on measuring my return in this unit of measurement.
That said, I've been doing optimizations for a month without any problem, I usually put some variables and it is true that the computer usually spends many hours doing many operations and getting many results (customized by me) (expectance in R, return of the operation, etc. ).
Well, for a couple of days I have been getting some strange errors, I have not modified anything. I show you the error.
I don't know if it has to do with something related to memory, cache, or similar.
in the photo there is only one line because I stopped it. but it comes out a lot like that
also say that the backtes go well, and that I have passed the sp100 and it seems to be going well. but I change the filter to sp500 and it gives those errors.
thank you

fallo opt

That is not AmiBroker error.

It is your formula error. Nan means "Not a Number". In your code that calculates custom metrics you are doing invalid operation such as:

  • dividing by zero
  • square root from negative number
  • logarithm from negative number

See: https://forum.amibroker.com/search?q=Nan

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.