Thanks for any help
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
Indicator Draw Dots Disapear
Collapse
X
-
Indicator Draw Dots Disapear
I have and indicator saved in a chart template and when I load the chart the draw dots do not show up, it resets the color to empty and I have to go in and manually change the colors back each time I load a chart... why is this happening? I need the indicator and it's maddening...
Thanks for any helpTags: None
-
I think the problem in code maybe here? The Color.Empty lines?
DrawDot(CurrentBar.ToString(), 0, currDotValue, currDotColor);
DrawText("dot"+CurrentBar.ToString(), true, dotText, 0, currDotValue, yPixels, currDotColor, pfont,
StringAlignment.Center, Color.Empty, Color.Empty, 10) ;
-
Originally posted by tshirtdeal View PostI think the problem in code maybe here? The Color.Empty lines?
DrawDot(CurrentBar.ToString(), 0, currDotValue, currDotColor);
DrawText("dot"+CurrentBar.ToString(), true, dotText, 0, currDotValue, yPixels, currDotColor, pfont,
StringAlignment.Center, Color.Empty, Color.Empty, 10) ;
In that case you have to serialize the color, in order for it to be saved with the template. Do a forum search for "serialize color", with or without the quotes, and you should find out how to do so.
Comment
-
Thanks for the help...
There are no errors in the log... Do I simply add the serialization as a code snippet?
Thanks!
R.T.
Comment
-
If there are issues with serialization, there will be errors in the log tab of the control center. I would first isolate one problem to solve at a time with one line of code.
From the first post there are essentially two issues with your two lines of code:
Dots don't display
Color preferences don't save in a template.
Use only one of those draw statements at a time until you know which is contributing to what problem. Please let us know if you would like assistance once you've narrowed it down to a specific line of code with a specific problem.Ryan M.NinjaTrader Customer Service
Comment
-
Okay, i changed this part of the code :
{
currDotValue = Low[1];
currDotColor = SupportColor;
To....
{
currDotValue = Low[1];
currDotColor = Color.Red;
and now it saves the color in chart templates and works, but I have to go into the code whenever I want to change the color, no biggie but perhaps you see an easy complete fix such as creating a default "SupportColor" in the script?
Thanks for the help,
R.T.
Comment
-
Yeah, for custom color inputs use this link here as a guide:
It's fairly straightforward. You have to setup the properties section just like the sample for the serialization.
Variables:
Declare currDotColor in variables region and assign an initial value.
Code:private color currDotColor = Color.Red;
Link the lower case color to an Uppercase one that's displayed in your indicator parameters.
Code:[XmlIgnore()] [Description("Color for painted region")] [GridCategory("Parameters")] public Color CurrDotColor { get { return currDotColor ; } set { currDotColor = value; } }
Code:[Browsable(false)] public string PaintColorSerialize { get { return NinjaTrader.Gui.Design.SerializableColor.ToString(currDotColor); } set { currDotColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); } }
Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by proptradingshop, 03-21-2024, 09:50 AM
|
5 responses
25 views
0 likes
|
Last Post Today, 05:17 AM | ||
Started by MaupinFinche, Today, 05:08 AM
|
0 responses
2 views
0 likes
|
Last Post
by MaupinFinche
Today, 05:08 AM
|
||
Started by Enkidu, Yesterday, 06:40 AM
|
9 responses
35 views
0 likes
|
Last Post
by Enkidu
Yesterday, 01:11 PM
|
||
Started by Mestor, 03-10-2023, 01:50 AM
|
12 responses
307 views
0 likes
|
Last Post
by z.franck
Today, 04:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
32 responses
268 views
0 likes
|
Last Post
by f.saeidi
Yesterday, 06:49 AM
|
Comment