Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Keep the default color
Collapse
X
-
Keep the default color
Hello, I have an indicator that works correctly. The problem is that when I change the color when restarting ninjatrader it leaves me the default color ... how could I do it to keep the last color and or the one that comes by default? Thanks a lot.Tags: None
-
Hello punkiy2111,
Thank you for the question.
When working with NinjaTrader, saving the Workspace should also save the color and state that your charts and indicators are in.- To save the Workspace, go to the Control Center > Workspaces > save
If you are changing the color of your indicator and then saving the Workspace, the next time you open NinjaTrader the indicator should still be that same color.
If the color of the indicator is not being saved, there may be something that needs to be modified within the NinjaScript.
Did you create this indicator yourself or did you get it from a 3rd party developer somewhere?
If you made this NinjaScript yourself, please provide more information on your NinjaScript.
If you got the indicator from another developer, please reach out to them and let them know the colors are not being saved and ask what needs to be done to save the colors.Clayton G.NinjaTrader Customer Service
-
It is its own indicator,
I send you the information you request
public class MyIndicator: Indicator
{
......
private Brush colorV1 = Brushes.Bisque;
----------------------------------------------------------
protected override void OnBarUpdate()
...........
Draw.Line(this, @"Inf", true, BarrAtras, Inferior, BarrDel, Inferior, colorV1, DashStyleHelper.Dash, 1);
---------------------------------------------------------
#region Properties
[NinjaScriptProperty]
[XmlIgnore()]
[Display(Name = "Color line", Description = "Color 1", GroupName = "Parameters", Order = 5)]
public Brush cV1
{
get{return colorV1;}
set{colorV1 = value;}
}
Thanks.
Comment
-
Hello punkiy2111,
Thank you for your reply.
It doesn't look like you're correctly serializing your brush input so that it can be saved in the workspace template. I suspect if you look at your log tab in your Control Center after you close and reopen the workspace you'll see a message about "could not be serialized".
If you would like a brush to become a public UI property, meaning the brush can be set up and defined by a user during configuration, it is important to be able to save the user's brush selection in order to restore that brush either from a workspace or from a template file at a later time. Saving a custom defined user input is done through a concept of Serialization which writes the object and its value to a .xml file. This process normally works fine for a simple user defined value type (such as a double or an int) but for more complex types such as Brushes, the object itself cannot be serialized directly to the .xml file and will result in errors upon saving the indicator or strategy to a workspace or template file.
I'd advise taking a look at the following pages of our help guide:
For example, for your brush, you've currently got this:
Code:[NinjaScriptProperty] [XmlIgnore()] [Display(Name = "Color line", Description = "Color 1", GroupName = "Parameters", Order = 5)] public Brush cV1 { get{return colorV1;} set{colorV1 = value;} }
Code:[XmlIgnore()] [Display(Name = "Color line", Description = "Color 1", GroupName = "Parameters", Order = 5)] public Brush cV1 { get; set; } [Browsable(false)] public string cV1Serialize { get { return Serialize.BrushToString(cV1); } set { cV1 = Serialize.StringToBrush(value); } }
Kate W.NinjaTrader Customer Service
- Likes 1
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by LawrenHom, Today, 10:45 PM
|
0 responses
3 views
0 likes
|
Last Post
by LawrenHom
Today, 10:45 PM
|
||
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
7 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
||
Started by pkefal, 04-11-2024, 07:39 AM
|
11 responses
37 views
0 likes
|
Last Post
by jeronymite
Today, 09:37 PM
|
||
Started by bill2023, Yesterday, 08:51 AM
|
8 responses
44 views
0 likes
|
Last Post
by bill2023
Today, 09:27 PM
|
Comment