Hi,
I consistently get the error 'NaN', i.e., 'No simulation results' on any IS and OOS intervals after the first interval when simulating WFO. The strategy is a simple dip strategy like that in the public dip buyer folder. This error occurs regardless of what number of intervals or % of OOS being used in the simulation settings. Genetic Algorithm is being used and the optimization metric is the 'Recovery Factor'. Any suggestion or help on what might be the cause of the error is appreciated. Thanks.
Size:
Color:
Below is an image showing the error with WFO mentioned in the above post.
Size:
Color:
This is expected as there are 0 trades in each of the intervals. WFO Efficiency can not be determined, hence the NaN (not a number). In general, Genetic Algorithm works well in WFO.
At any rate, we need more details to reproduce:
1. Strategy or sample code used. If using a un-modified public Strategy, the name is sufficient.
2. Single symbol or Multi-symbol mode, Position Sizing, and Data Loading settings
3. Symbol(s) and Data provider
4. WFO Optimizer settings, Genetic method settings
Size:
Color:
Thanks Eugene. Below are more info on the strategy and settings.
1.
CODE:
Please log in to see this code.
2. Single position mode, Fixed Dollars position sizing, Data range from 1995 to present
3. Over 3000 symbols from Fidelity
4. # of WF intervals: 4, OOS %: 10, WF Window Type: Sliding, Basic Scorecard, Optimizing metric: Highest Recovery Factor
Genetic Method (default settings): Metric to Optimize: Net Profit, Population count: 100, Generation count: 20, Selection method: Roulette Wheel Selection, Crossover method: WL Crosser 1, Mutation method: Simple Mutation, Mutation probability: 0.05
I just noticed that within Genetic Settings, there is a setting for the "Metric to Optimize" and this default to "Net Profit" which is differed from the Optimizing Metric on the WFO main menu which is set to Recovery Factor. Will this be a problem?
Thank you.
Size:
Color:
I just re-simulate with the metric Net Profit (it takes +20hrs) being optimized in main WFO window (same as that defaulted) in the Genetic Settings and still getting the same error as shown in the picture on post #1. So conflict settings in the main WFO window and that in the Genetic window does not cause this error. It is puzzling that there is no trades take place during sub sequence In Sample and OOS after the first one. If anyone has any suggestion, please let me know now. Thanks.
Size:
Color:
QUOTE:
I just noticed that within Genetic Settings, there is a setting for the "Metric to Optimize" and this default to "Net Profit" which is differed from the Optimizing Metric on the WFO main menu which is set to Recovery Factor. Will this be a problem?
No. There is no conflict between the WFO metric to optimize and optimization method. They serve different tasks: the chosen optimizer's (GA) method is applied to each Walk Forward interval while the WFO method is used "on top" of that.
I just ran your code with all the other settings over a Dow 30 portfolio and the WFO+GA combo worked perfectly.
There can be a pretty valid reason: your dip buyer did not produce any trades on that DataSet. Like no symbol has had a 8% to 15% decline in a day
and its volume exceeded 100K shares. If it's out of question, then I believe the problem is rooted in your huge DataSet. Either the task it too
demanding for your RAM, or Genetic Optimizer encountered invalid data and could not proceed further. Hence the zero-trade scenario. Look for empty symbols, symbols not updated in years etc. and
exclude them from your DataSet.
Size:
Color:
Thanks Eugene for the simulations, and clarifications on the optimization metrics. I have manually went through the simulations over the same In Samples and Out Samples as shown in the WFO results window and got valid results (significant numbers of trades took places that meet the dip and volume requirements.)
I have not done a filtering such as removing non-active symbols from the data set, however, during WFO simulations, I do get errors such as 'index was out of range' and something like 'not enough data for mathematical calculations' and I don't believe these are serious enough to break the simulation - maybe I am wrong on this.
Like you have suggested, I will work on a smaller and clean data set and pay closer attentions to any error messages. I probably also try with different optimization methods. Thanks.
Size:
Color: