Thank you
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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...
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
-
Hi @NinjaTrader_ChelseaB
Most of links from your previous message no work, please could you update ti? I am interest in these:
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
Regards.
Comment
-
Hi @NinjaTrader_ChelseaB
Many thanks, now that is working,
Another question. Is there any example to get results grid in excel of the optimization by coding instead use the example below?
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
Regards.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tim-c, Today, 02:10 PM
|
1 response
6 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
50 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
10 responses
399 views
1 like
|
Last Post
by beobast
Today, 02:35 PM
|
||
Started by lorem, Yesterday, 09:18 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:29 PM |
Comment