I'm trying to write some information to a file each time an optimization iteration is run in Strategy Analyzer. For example, let's say I have a strategy with 1 parameter Param_A that I want to optimize. When I run an optimization with Param_A set from 30 to 150 in increments of 10, I want to write to a file each time the strategy is finished, so I can see certain results of each iteration. I should have 13 lines of data in this particular test. However, I'm seeing unexpected behavior in that all of the parameter values are not hitting the file write code.
I have pared this down to as minimum of code as I can to demonstrate this. I have commented out most of my actual strategy code, including the file write process, and just left a Print statement to show the strange behavior. In my strategy, I am using the following code:
else if (State == State.Terminated) { Print("Terminated using params " + DisplayParameters); }
Terminated using params 150 (SmaPeriod) Terminated using params 40 (SmaPeriod) Terminated using params 50 (SmaPeriod) Terminated using params 60 (SmaPeriod) Terminated using params 70 (SmaPeriod) Terminated using params 80 (SmaPeriod) Terminated using params 90 (SmaPeriod) Terminated using params 100 (SmaPeriod) Terminated using params 110 (SmaPeriod) Terminated using params 120 (SmaPeriod) Terminated using params 130 (SmaPeriod) Terminated using params 140 (SmaPeriod) Terminated using params 60 (SmaPeriod) Terminated using params 80 (SmaPeriod) Terminated using params 60 (SmaPeriod) Terminated using params 80 (SmaPeriod) Terminated using params 10 (SmaPeriod)
Terminated using params 30 (SmaPeriod) Terminated using params 10 (SmaPeriod)
Can anyone help shed light on this behavior or if I'm doing something wrong?
Thank you!
Paul

. I was testing again last night with the same strategy writing to files and it consistently wrote every value, from 30 to 150. I cannot get it to replicate what it was doing. I had tried restarting NinjaTrader 8 at the time but I believe my laptop may have fully rebooted since it was not writing all values. I didn't think to reboot my entire machine, but whatever the reason it seems to be working as expected now.
Comment