PDA

View Full Version : Invalid Cast from DateTime to Double


aksamyo
10-24-2009, 07:38 PM
Attached is a simple code that creates an "Invalid Cast from DateTime to Double" error in the Log. It will compile clean but if you backtest the code with any NYSE stock, you will get that error in the log.

Once that error appears, it will continue to display that error even after you fix the source of the error. By changing "Category" to "GridCategory" it should have fixed the problem, but the error continues to appear during backtesting.

Since using "Category" instead of "GridCategory" does not cause syntax error during compilation, many people will get this log error if they copy the source code from 6.5.

NinjaTrader_Dierk
10-25-2009, 03:36 AM
Various issues:
a) You should replace any occurance of "Category" by "GridCategory" (I believe this is stated in the code breaking changes docs you should have at hand)
b) "DateTime" parameters are not supported.

aksamyo
10-25-2009, 06:12 AM
I have been using DateTime as parameter in 6.5 ever since i joined; and it works fine and without an error in the log. It works fine in 7.0 too except this time there is an error in the Log.

The error happens after the completion of the backtest. After testing an instrument list, the error also happens when moving from one instrument to another in the Strategy Analyzer result list.

NinjaTrader_Dierk
10-25-2009, 08:27 AM
It may have worked with NT6.5. However it was not supported (see strategy wizard). I suggest amending your strategy so you would not need to use a DateTime parameter.