![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
Hi!
I serialize a public Color in an indicator for can choose in parameters. Its ok, but when i call the indicator properties from conditions builder of strategies wizard the color shows as a string in quotes: For ex: 'Color [DodgerBlue]' and i need to select other color, and change to DodgerBlue If i dont change the strategy compilation launch an error. Its possible to avoid this issue? more better, its possible to avoid all unnecessary parameters in condition builder? THank you My code: Declaring colors: private Color longsignalcolor = Color.DodgerBlue; private Color shortsignalcolor = Color.Magenta; Into properties: //Color shortsignalcolor [Description("Color for short signal arrow")] [GridCategory("Parameters")] public Color ShortSignalColor{ get { return shortsignalcolor; } set { shortsignalcolor = value; } } // Serialize our Color object [Browsable(false)] public string ShortSignalColorSerialize{ get { return NinjaTrader.Gui.Design.SerializableColor.ToString( ShortSignalColor); } set { ShortSignalColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); } } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
marynja,
Please see the following for more information on how to fix that, basically you are missing a piece of XML code which is outlined at the link below. http://www.ninjatrader.com/support/f...ead.php?t=4977
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#3 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
Thanks Adam. i am using the [XmlIgnore()] before Color declaration but dont work.
If i write [XmlIgnore()] before Serialize instead of the Color declaration (as in your example), the problem its the same but the value now show as this: 'Color [Empty]' Some idea? Thanks again |
|
|
|
|
|
#4 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
I instaling the example indicator and call into Condition Builder.
Please, look the image and how the wizard tak a string value for color. If i finish the wizard launch an error on generating the strategy.
Last edited by marynja; 08-24-2012 at 08:44 AM.
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,200
Thanks: 137
Thanked 183 times in 182 posts
|
Hello marynja,
You could receive an error for two reasons using the SampleColorInput. 1. SampleColorInput does not contain a Plot() which is going to be needed since you are comparing it to a value. So you may receive the following error: "'System.Drawing.Color' is a 'type' but is used like a 'variable'" 2. When you are choosing a color(s) you would want to use the "Web" tab to be able to select a color for your strategy. See attached image. Let us know if we can be of further assistance.
JC
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
I kown JC, and thanks.
If i select a web color, then the strategy compile correctly. But maybe i dont explain well. I dont understan why i need to correct this error all the times when i use my indicator in the strategy wizard. When i declare the color is a web color. I know that isnt a plot(), and i dont need in my strategy, is for it i want to hidde into Condition Builder. Its possible to hidde this useless params? or its possible the initial color value be correct as same as i select a web color? Thanks again
Last edited by marynja; 08-25-2012 at 02:15 AM.
|
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,200
Thanks: 137
Thanked 183 times in 182 posts
|
Hello marynja,
This is because the Strategy Wizard was not designed to handle color inputs. If you do not want to have it as a select able parameter you may want to create another indicator that does not need to take a color as a parameter that needs to be passed to it. Happy to be of further assistance.
JC
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_JC for this post: |
|
|
|
#8 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
All right JC, thank you for it.
I pray to NT developers to fix this bug for new versions. Thank you, happy day. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| condition builder help | jtrotter33 | Strategy Development | 7 | 12-06-2011 08:42 AM |
| Cant serialize error | gg80108 | Indicator Development | 1 | 12-02-2010 08:30 AM |
| Serialize error | monpere | Indicator Development | 5 | 06-23-2008 07:35 PM |
| price data ERROR dialog box in condition builder | Bob10 | Miscellaneous Support | 4 | 01-29-2008 06:17 PM |
| Condition Builder - Time Comparison Error | davidfw1866 | Strategy Development | 4 | 10-30-2007 07:16 AM |