// 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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
156 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
138 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment