[NinjaScriptProperty]
[TypeConverter(typeof(StrategyStringConverter))] // Converts the found ATM template file names to string values
[PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] // Create the combo box on the property grid
[Display(ResourceType = typeof(Custom.Resource), Name = "Add Signal", GroupName = "Entries 1", Order = 0)]
public string Signal1
{ get; set; }​
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Make string Ninjascript Property Optimizable
Collapse
X
-
Make string Ninjascript Property Optimizable
I have the following code below :
This creates a list of strings selectable but I cannot optimize it. When I select the Optimize Backtest type, it doesn't let me try a range.Code:Tags: None
-
Hello JakeOfSpades,
Thank you for your inquiry.
Are you using an enum to create a list of selectable strings in the Optimizer?
Please see the sample script linked below, which demonstrates using TypeConverter and using an enum. These values are selectable in the Optimizer.
https://ninjatrader.com/support/help...r_to_custo.htm
If you have any other questions, please let me know.
-
Can't use enums as some of the strings have spaces and special symbols. Any ways to optimize a list of strings?Originally posted by NinjaTrader_Gaby View PostHello JakeOfSpades,
Thank you for your inquiry.
Are you using an enum to create a list of selectable strings in the Optimizer?
Please see the sample script linked below, which demonstrates using TypeConverter and using an enum. These values are selectable in the Optimizer.
https://ninjatrader.com/support/help...r_to_custo.htm
If you have any other questions, please let me know.
Comment
-
Hello,
Unfortunately no, there is no way to optimize a list of strings.
A custom type converter is needed, which will not function in the strategy analyzer.
A TypeConverter used on an input in a NinjaScript Strategy will be disabled when the strategy is selected in the Strategy Analyzer.
While the strategy can still be backtested or optimized, the TypeConverter behavior, such as hiding or disabling inputs will not have effect on any public variables using the [NinjaScriptProperty] attribute.
This is due a limitation with the property grid and how the analyzer displays the [NinjaScriptProperty] marked properties of the strategy.
A suggested work around, is to add an extra bool property for the purpose of controlling if other properties are used within the logic of the script.
This property would not be optimized and would have the single purpose of controlling the use of the properties.
Comment
-
I figured it out, I had to use enums and the Display Name Attribute for my custom text. Thanks.Originally posted by NinjaTrader_Gaby View PostHello,
Unfortunately no, there is no way to optimize a list of strings.
A custom type converter is needed, which will not function in the strategy analyzer.
A TypeConverter used on an input in a NinjaScript Strategy will be disabled when the strategy is selected in the Strategy Analyzer.
While the strategy can still be backtested or optimized, the TypeConverter behavior, such as hiding or disabling inputs will not have effect on any public variables using the [NinjaScriptProperty] attribute.
This is due a limitation with the property grid and how the analyzer displays the [NinjaScriptProperty] marked properties of the strategy.
A suggested work around, is to add an extra bool property for the purpose of controlling if other properties are used within the logic of the script.
This property would not be optimized and would have the single purpose of controlling the use of the properties.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment