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 rdtdale, Today, 01:02 PM
|
0 responses
1 view
0 likes
|
Last Post
by rdtdale
Today, 01:02 PM
|
||
Started by alifarahani, Today, 09:40 AM
|
3 responses
15 views
0 likes
|
Last Post Today, 12:47 PM | ||
Started by RookieTrader, Today, 09:37 AM
|
4 responses
18 views
0 likes
|
Last Post
by RookieTrader
Today, 12:46 PM
|
||
Started by PaulMohn, Today, 12:36 PM
|
0 responses
5 views
0 likes
|
Last Post
by PaulMohn
Today, 12:36 PM
|
||
Started by love2code2trade, 04-17-2024, 01:45 PM
|
4 responses
40 views
0 likes
|
Last Post Yesterday, 10:31 PM |
Comment