![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#16 |
|
Junior Member
|
That WORKED and now it saves in Templates.
|
|
|
|
|
|
#17 |
|
Junior Member
|
The following code is not plotting dots as I would like.
It is supposed to plot a dot when the FATL line crosses above the SATL line. FATL and SATL are DataSeries from added Plots in the Initialize section. Add(new Plot(Color.Gray, PlotStyle.Line, "FATL")); Values[0] plots the line Add(new Plot(Color.Gray, PlotStyle.Line, "SATL")); Values[2] Add(new Plot(Color.Gray, PlotStyle.Dot, "FATLDots"));Values[4] plots dots on the line FATL and FATLDots are SET to the same values. if (CrossAbove(FATL,SATL,1)== true) { Plots[4].Pen.Color = crossUpColor; Plots[4].Pen.Width = fatColorWidth; } else Plots[4].Pen.Color = Color.Transparent; Print(Time[0].ToString()+" FATL="+ FATL[0]+" SATL="+SATL); Print(Time[0].ToString()+" If FAT Xover SAT, bool="+CrossAbove(FATL,SATL,1)); The Print statements verify that the 'if' statement is giving correct T and F readings, However, when the code is as shown above, NO dots print (ie thay are all transparent). If I "// out" the else statement with } // else Plots[4].Pen.Color = Color.Transparent; then dots appear on EVERY bar. I must be missing something . Is there an easy fix? |
|
|
|
|
|
#18 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
magnumdbl, for changing plot colors dynamically, please use NT7's PlotColors method in your code -
http://www.ninjatrader.com/support/h...plotcolors.htm
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#19 |
|
Junior Member
|
Thanks,
I rewrote it using PlotColors[4][0] = Color.FromArgb(defaultColorOpacity,crossUpColor); because I serialized my colors. Since I borrowed that piece of code, I'm not sure if I have to put in Opacity for a Serialized color or if that was just something that the other developer needed. Can anyone tell me? |
|
|
|
|
|
#20 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
Believe you would need that here, as the opacity is a component of the from ARGB derived color you create for your script.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#21 | |
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
Quote:
Thanks! |
|
|
|
|
|
|
#22 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
The following 2 users say thank you to koganam for this post: |
|
|
|
#23 | |
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
Quote:
|
|
|
|
|
|
|
#24 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
Style, do you have the [XmlIgnore()] for your Color properties added as well, to signify you do custom serialization for those?
I also believe your public struct will need custom serialization...
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#25 | ||
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
Quote:
Quote:
Thanks for your help! |
||
|
|
|
|
|
#26 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
Yes Style, the coloring inputs should be fine, this is not what breaks it I think - the problem area is the public struct I feel, something we could also not support in our wrapper generation in NinjaScript. If you recode this area to use an enum instead you should be fine.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#27 | |
|
Senior Member
|
Quote:
It seems that the problem may be in your declaration of your DataSeries as public. If you want to access DataSeries outside of the class, you should define the access using a Property referring to a private backing store, not declare the DataSeries as public access in the code.
Last edited by koganam; 07-20-2012 at 06:29 AM.
Reason: Corrected language to use proper programming lingo
|
|
|
|
|
|
The following user says thank you to koganam for this post: |
|
|
|
#28 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
Thanks koganam, I missed those public DataSeries without an associated property...that's it.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#29 |
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
|
|
|
|
![]() |
| Tags |
| indicator, serializing, serializing indicators |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| XML Serializing error | mtthwbrnd | Strategy Development | 6 | 02-15-2010 11:41 AM |
| What does SERIALIZING INDICATORS mean? | simpletrades | Indicator Development | 5 | 08-24-2009 07:31 AM |