// In state.setdefaults
TextColor = Brushes.Black;
// In properties
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "Text Color", Description = "Color of text", Order = 2, GroupName = "Text")]
public Brush TextColor
{ get; set; }
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Cant overwrite default properties when saving indicator template
Collapse
X
-
Cant overwrite default properties when saving indicator template
I have an indicator with a property defining text color that gets drawn onto the chart. However whenever I change the color in the UI and click "Save as default"(or any named template) it just defaults to black. How can I get it to actually save and overwrite the defaults for a user?
Code:Tags: None
-
Hello sakura1337,
Thank you for your post.
In properties, have you included a code snippet to serialize the brush? Serialization is necessary for NinjaTrader to use the brush input throughout the program.
[Browsable(false)]
public string TextColorSerialize
{
get { return Serialize.BrushToString(TextColor); }
set { TextColor = Serialize.StringToBrush(value); }
}
Please also check out this Help Guide page on User Definable Color Inputs, which includes an example SampleBrushInput you can use as a reference. Last edited by NinjaTrader_Gaby; 08-10-2023, 07:18 AM.
- Likes 1
-
-
NinjaTrader_Gaby
How would we approach this concept for text font options?
Code:[NinjaScriptProperty] [XmlIgnore] [Display(Name = "Font, size, type, style", Description = "Select font, style, size to display on chart", GroupName = "Text", Order = 1)] public Gui.Tools.SimpleFont TextFont { get; set; }
Comment
-
It seems when I save to template the font changes are not accounted for? I have tried reloading NT and re-compiling the script.Originally posted by NinjaTrader_Gaby View PostSince you are using the SimpleFont class, NinjaTrader will serialize these automatically.
Code:public NinjaTrader.Gui.Tools.SimpleFont TextFont { get; set; } if (State == State.SetDefaults) { TextFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 14); }
Code:if (State == State.SetDefaults) { TextFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 14); } //props [NinjaScriptProperty] [XmlIgnore] [Display(Name = "Font, size, type, style", Description = "Select font, style, size to display on chart", GroupName = "Text", Order = 1)] public NinjaTrader.Gui.Tools.SimpleFont TextFont { get; set; }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
557 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment