Example: MACD parameters 12, 24 ,9. These parameters I want to save. I know I can go through manually and create a script, but I have 20 plus indicators to harvest parameters.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
List of Parameters
Collapse
X
-
List of Parameters
Is there a way to know how many ninjascript parameters are created in a custom indicator. What I want to do is create my own template and save my own ninjatrader indicator template. I want to scroll through my parameters and create an array for export.
Example: MACD parameters 12, 24 ,9. These parameters I want to save. I know I can go through manually and create a script, but I have 20 plus indicators to harvest parameters.Tags: None
-
Thank you .
I got most of the stuff to work but am having an issue in color.
This is what I have.
This is the first thing I tested
// ################################### my parameters ######################
private Brush eBox1Color = Brushes.Khaki;
[XmlIgnore()]
// [NinjaScriptProperty]
[Display(Name = "Box 1 Color", Description = "", GroupName = "Box 1", Order =1)]
public Brush Box1Color
{
get { return eBox1Color; }
set { eBox1Color = value; }
}
// Serialize Color object
[Browsable(false)]
public string Box1ColorSerialize
{
get { return Serialize.BrushToString(eBox1Color); }
set { eBox1Color = Serialize.StringToBrush(value); }
}
// ################################### my parameters ######################
############# my failed test code #########################################
eBox1Color = (SolidColorBrush)new BrushConverter().ConvertFromString(sMyString);
// ############################ test 2 failed ####################################
var converter = new System.Windows.Media.BrushConverter();
var brush = (Brush)converter.ConvertFromString(sMyString]);
eBox1Color = brush;
//############################## test 3 a function I made that failed ###################################
eBox1Color = FindColor(sMyString);
public Brush FindColor(string sColor)
{
Brush asd = Brushes.AliceBlue;;
asd = Serialize.StringToBrush(sColor) ;
return asd;
//############################## test 4 a function I made that is successful ###################################
eBox1Color = FindColor(sMyString);
public Brush FindColor(string sColor)
{
Brush asd = Brushes.AliceBlue;;
if( sColor == "#FFFFA500") // just testing my script color
asd = Brushes.Purple;
return asd;
}
How do I load my saved color into the
private Brush eBox1Color parameter?
I don't want to write 100 if statements for each color.
Comment
-
Hello ballboy11,
Thank you for your reply.
I wanted to check, is the question on how to serialize the color property or are you trying to make this automated to accommodate multiple brushes? It looks like you may be trying to convert a hex code into a brush, is that the question?
We have some information about working with brushes in the following link as well: https://ninjatrader.com/support/help...definedbrushes
I look forward to being of further assistance.
Comment
-
Hello ballboy11,
Thank you for your reply.
When you save to a file are you serializing your class or doing something else?
If you are serializing the class, you should be able to use the format of having a brush property and using a second property with BrushToString/StringToBrush used. If that was not working for you, I would need more specific details about the errors seen or what specifically happened in that test. If you are doing something else with the brush to save it, you can still make use of the conversion methods.
For example:
Will produce an output of:Code:Print(Serialize.BrushToString(Brushes.Red));
As long as this is the string you give to the opposite method it will create the brush:<SolidColorBrush xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">#FFFF0000</SolidColorBrush>
I look forward to being of further assistance.Code:System.Windows.Media.Brush r = Serialize.StringToBrush("<SolidColorBrush xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">#FFFF0000</SolidColorBrush>"); Print(r.ToString());
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
605 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
351 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment