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
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
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.JesseNinjaTrader Customer Service
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:
Code:Print(Serialize.BrushToString(Brushes.Red));
<SolidColorBrush xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">#FFFF0000</SolidColorBrush>
Code:System.Windows.Media.Brush r = Serialize.StringToBrush("<SolidColorBrush xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">#FFFF0000</SolidColorBrush>"); Print(r.ToString());
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by jpeep, 08-16-2020, 08:31 AM
|
17 responses
502 views
0 likes
|
Last Post
by notenufftime
Today, 08:46 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
15 responses
124 views
0 likes
|
Last Post
by ETFVoyageur
Today, 08:46 PM
|
||
Started by esmall, Today, 07:14 PM
|
0 responses
9 views
0 likes
|
Last Post
by esmall
Today, 07:14 PM
|
||
Started by Option Whisperer, 05-09-2024, 07:58 PM
|
6 responses
26 views
0 likes
|
Last Post Today, 06:52 PM | ||
Started by rayyyu12, Today, 05:38 PM
|
0 responses
12 views
0 likes
|
Last Post
by rayyyu12
Today, 05:38 PM
|
Comment