Thank you
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Accessing the Optimization Context
Collapse
X
-
Accessing the Optimization Context
Is it possible to access the Optimization Context from within an Optimizing Strategy. I need to record some metadata related to the optimization, I was hoping to stick this in the notes field, or alternatively capture a known ID from the optimization context that would let me reference data that I could store externally.
Thank youTags: None
-
Hello kevinenergy,
You can save the results grids, which would be the easiest way.
On the results grid you want to save, right-click select > Export...
https://ninjatrader.com/support/help...data_grids.htm
You can also save the parameters and performance metrics information by writing these to file. You might choose to make copies of existing scripts and add in the writing to file part.
Below are links to the help guide on these scripts.
https://ninjatrader.com/support/help...ce_metrics.htm
https://ninjatrader.com/support/help...ric_values.htm
https://ninjatrader.com/support/help...ness_value.htm
And a link to an example that demonstrates using StreamWriter to write to file.
https://ninjatrader.com/support/help...o_write_to.htm
For an instance ID you might create a public variable within the strategy and assign this a guuid in State.DataLoaded.
https://ninjatrader.com/support/foru...288#post726288
Then access that property from the strategy object provided to the OnCalculatePerformanceValue() method of the optimization fitness.
Attached is an example OptimizationFitness that calls values from a custom PerformanceMetric and also uses the strategy object.Chelsea B.NinjaTrader Customer Service
-
Hey Chelsea, thanks for pointing me in the right direction and for the example files and links. I was able to figure out how to do what I needed using these! Much appreciated!
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by franco12364, Today, 11:27 AM
|
1 response
9 views
0 likes
|
Last Post
|
||
Started by YevhenShynkarenko, Today, 11:48 AM
|
3 responses
18 views
0 likes
|
Last Post
![]() |
||
Started by NinjaTrader_ChrisL, Today, 11:21 AM
|
0 responses
21 views
0 likes
|
Last Post
|
||
Started by lunardiplomacy, Today, 08:09 AM
|
3 responses
11 views
0 likes
|
Last Post
|
||
Started by Derjan, Today, 09:40 AM
|
1 response
7 views
0 likes
|
Last Post
|
Comment