PlotColors serialization problem - NT7 - NinjaTrader Programming | futures io social day trading
futures io futures trading


PlotColors serialization problem - NT7
Updated: Views / Replies:2,431 / 8
Created: by Al2010 Attachments:4

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

PlotColors serialization problem - NT7

  #1 (permalink)
Trading for Fun
 
Futures Experience: None
Platform: NinjaTrader
 
Posts: 50 since Oct 2010
Thanks: 36 given, 10 received

PlotColors serialization problem - NT7

Hi,
I colored few indicators with PlotColors using Ninja help as an example. Every time I start the Ninja my colored indicators loosing colors, e.g. the rising, falling and neutral plots become transparent and I have to reset the colors in properties of the indicator. I'm not very good at programming in C# and there could be bugs in my code... Ninja provides very poor PlotColors example in online help. There is only one example on how to set static colors.
I'm attaching one of the indicators with call to PlotColors built in that loosing colors at start up. Is there an error in my code? I do not see it.
Thank you very much.

Attached Files
Register to download File Type: cs SMAColorsV7.cs (8.5 KB, 15 views)
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
New Orleans, La (Mardi Gras City)
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Ninjatrader / Optimus Futures / AmpFutures
Favorite Futures: ES / 6E / 6B / CL
 
DavidHP's Avatar
 
Posts: 1,002 since Aug 2009
Thanks: 802 given, 1,367 received



Al2010 View Post
Hi,
I colored few indicators with PlotColors using Ninja help as an example. Every time I start the Ninja my colored indicators loosing colors, e.g. the rising, falling and neutral plots become transparent and I have to reset the colors in properties of the indicator. I'm not very good at programming in C# and there could be bugs in my code... Ninja provides very poor PlotColors example in online help. There is only one example on how to set static colors.
I'm attaching one of the indicators with call to PlotColors built in that loosing colors at start up. Is there an error in my code? I do not see it.
Thank you very much.


You need to serialize the colors:

 
Code
        // Serialize our Color object
        [Browsable(false)]
        public string FallingColorSerialize
        {
            get { return NinjaTrader.Gui.Design.SerializableColor.ToString(fallingColor); }
            set { fallingColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
        }
Add code like this for each Color in the indicator.

Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
Reply With Quote
The following 3 users say Thank You to DavidHP for this post:
 
  #4 (permalink)
Elite Member
Houston,Tx
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,293 received


Al2010 View Post
Hi,
I colored few indicators with PlotColors using Ninja help as an example. Every time I start the Ninja my colored indicators loosing colors, e.g. the rising, falling and neutral plots become transparent and I have to reset the colors in properties of the indicator. I'm not very good at programming in C# and there could be bugs in my code... Ninja provides very poor PlotColors example in online help. There is only one example on how to set static colors.
I'm attaching one of the indicators with call to PlotColors built in that loosing colors at start up. Is there an error in my code? I do not see it.
Thank you very much.

You got close. Fixed it for ya.
Regards,
TMFT

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Attached Files
Register to download File Type: cs SMAColorsV7.cs (10.3 KB, 25 views)
Reply With Quote
The following 3 users say Thank You to ThatManFromTexas for this post:
 
  #5 (permalink)
Trading for Fun
 
Futures Experience: None
Platform: NinjaTrader
 
Posts: 50 since Oct 2010
Thanks: 36 given, 10 received

Thank you very much to all who helped.

Reply With Quote
 
  #6 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


ThatManFromTexas View Post
You got close. Fixed it for ya.
Regards,
TMFT

And now tell me, why you have put this in front of the section for the color serialization:

 
Code
[XmlIgnore()]
It is my understanding - I may be wrong - that this line will prevent the indicator from proper serialization, so if you store the indicator in a template, it might lose its color memory. The XmlIgnore() command should only be used for DataSeries objects that cannot be serialized.

Also proper serialization should make disappear the main plot, which is no longer needed. This is achieved via

 
Code
PlotsConfigurable = false;
But then you need to serialize PlotStyle, DashStyle and LineWidth separately, which I have done. Now the indicator dialogue box only shows the necessary information for the colored plot.

I have further simplified the code, and - to speed the indicator up - created an SMA object, which is initialized in OnStartUp().

Please find my fix below. Not tested for bugs.

Attached Files
Register to download File Type: zip SMAColorsV7.zip (4.2 KB, 66 views)

Last edited by Fat Tails; January 31st, 2011 at 05:14 AM.
Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
  #7 (permalink)
Elite Member
Houston,Tx
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,293 received


Fat Tails View Post
And now tell me, why you have put this in front of the section for the color serialization:

 
Code
[XmlIgnore()]
It is my understanding - I may be wrong - that this line will prevent the indicator from proper serialization, so if you store the indicator in a template, it might lose its color memory. The XmlIgnore() command should only be used for DataSeries objects that cannot be serialized.

Also proper serialization should make disappear the main plot, which is no longer needed. This is achieved via

 
Code
PlotsConfigurable = false;
But then you need to serialize PlotStyle, DashStyle and LineWidth separately, which I have done. Now the indicator dialogue box only shows the necessary information for the colored plot.

I have further simplified the code, and - to speed the indicator up - created an SMA object, which is initialized in OnStartUp().

Please find my fix below. Not tested for bugs.

Because it was in the first indicator I copied from when trying to learn to code and it seemed to work...

See I told ya I wasn't a professional...... and that you write cleaner code than me ... soooo , once again I am right ...

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
The following user says Thank You to ThatManFromTexas for this post:
 
  #8 (permalink)
Elite Member
Daphne
 
Futures Experience: Intermediate
Platform: TradeStation, TOS, Infinity, NT7
Broker/Data: As above
Favorite Futures: ES, 6E, 6B, 6J
 
Posts: 139 since Apr 2010
Thanks: 217 given, 80 received

Serialization Error on this one?


ThatManFromTexas View Post
Because it was in the first indicator I copied from when trying to learn to code and it seemed to work...

See I told ya I wasn't a professional...... and that you write cleaner code than me ... soooo , once again I am right ...

Just got this error from NT7 on ADXVMA_Sharky_Paint > I went to save my NT workspace and got this > 2011-04-14_1212 - GregHohman's library

Attached Files
Register to download File Type: zip ADXVMA_sharky_paintbar.zip (3.6 KB, 18 views)
Reply With Quote
 
  #9 (permalink)
Trading Apprentice
houston texas/us
 
Futures Experience: None
Platform: metatrader
Favorite Futures: gold
 
Posts: 25 since Dec 2014
Thanks: 6 given, 2 received

Can we use the SMAColorsV7's PlotColors as strategy trigger?

like
if (SMAColorsV7.PlotColors[0][0] == Color.Red)
EnterShort();



Fat Tails View Post
And now tell me, why you have put this in front of the section for the color serialization:

 
Code
[XmlIgnore()]
It is my understanding - I may be wrong - that this line will prevent the indicator from proper serialization, so if you store the indicator in a template, it might lose its color memory. The XmlIgnore() command should only be used for DataSeries objects that cannot be serialized.

Also proper serialization should make disappear the main plot, which is no longer needed. This is achieved via

 
Code
PlotsConfigurable = false;
But then you need to serialize PlotStyle, DashStyle and LineWidth separately, which I have done. Now the indicator dialogue box only shows the necessary information for the colored plot.

I have further simplified the code, and - to speed the indicator up - created an SMA object, which is initialized in OnStartUp().

Please find my fix below. Not tested for bugs.


Reply With Quote

Reply



futures io > > > > > PlotColors serialization problem - NT7

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Heiken Ashi Problem in NT7 here max-td NinjaTrader 10 January 13th, 2011 02:06 PM
PlotColors Code for NT7 jharthun NinjaTrader 13 November 16th, 2010 08:59 PM
NT7 Problem after Computer Crash britkid99 NinjaTrader 13 August 23rd, 2010 06:35 PM
NT7 Install problem spx_tdr NinjaTrader 7 July 8th, 2010 01:41 PM
could be a problem websouth Off-Topic 11 February 1st, 2010 02:04 PM


All times are GMT -4. The time now is 05:06 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.13 seconds with 20 queries on phoenix via your IP 54.90.92.204