PDA

View Full Version : NT MultiColor Plot Approach


NinjaTrader_Ray
10-08-2009, 02:36 PM
With NinjaTrader 7, you no longer have to have multiple plots of different colors in order to simulate having a single multi-color plot. The attached reference sample demonstrates the new multi-color plot concept for NT7. Comments are included in the script.

roonius
10-08-2009, 07:47 PM
This feature does not work if plotstyle is set to block or triangle

NinjaTrader_Ray
10-09-2009, 08:09 AM
This feature does not work if plotstyle is set to block or triangle

Thanks for reporting.

sefstrat
10-10-2009, 01:54 AM
With .Net 3.5 at your disposal it would be so easy to create an extension method on DataSeries to do this without the need for nested indices..

There is absolutely no reason that you can't do

Upper.PlotColor[0] = (Rising(Middle)) ? Color.Black : Color.Blue;

(in the case that Upper is a dataseries without associated plot object, just use the NullObject pattern to act upon a static dummy Plot)

That is IMO much cleaner..

aslane
11-02-2009, 10:53 PM
This works and is better than 6.5, but it is still rather clumsy, as you have to know your plot index to set the color correctly. Having the color be associated with the Plot would make things simple and obvious.

eDanny
11-03-2009, 08:06 AM
I think this is MUCH better than in 6.5. Nice to be able to get rid of the extra plots data series that were needed for every color change.

roonius
11-03-2009, 10:03 AM
With .Net 3.5 at your disposal it would be so easy to create an extension method on DataSeries to do this without the need for nested indices..

There is absolutely no reason that you can't do

Upper.PlotColor[0] = (Rising(Middle)) ? Color.Black : Color.Blue;

(in the case that Upper is a dataseries without associated plot object, just use the NullObject pattern to act upon a static dummy Plot)

That is IMO much cleaner..

"Upper" might not necessarily be a plot, it could be simple DataSeries without Plot associated with it, so Upper.PlotColor[0] will not be so easy to implement even with extension methods.

PlotColors[0][0] works perfectly for me. Thanks NT staff.

sefstrat
11-03-2009, 12:35 PM
"Upper" might not necessarily be a plot, it could be simple DataSeries without Plot associated with it, so Upper.PlotColor[0] will not be so easy to implement even with extension methods.

PlotColors[0][0] works perfectly for me. Thanks NT staff.

roonius, I noted that situation in my previous post.. it can be handled quite easily using the NullObject design pattern.

In other words, if using extension methods and this is a DataSeries without a plot, simply do nothing. Or an alternative way to implement it is to have all freshly instantiated DataSeries assigned a singleton or static 'dummy' plot which is never really used, ie NullPlot.

ClayB1
11-05-2009, 01:20 PM
MultiColor Plot no longer works as expected in NT Beta 4. The entire plot now changes color, not just the segments.

eDanny
11-05-2009, 01:29 PM
Just installed this myself and noticed the same thing. Also with scripts that haven't been converted to the new multicolor plot method and still use the multiple plots joined technique, the different colored plots join to their next segments.

NinjaTrader_Bertrand
11-05-2009, 01:53 PM
Thanks for reporting guys, noticed the same, too here, we'll look into.

ClayB1
11-05-2009, 03:04 PM
Are we looking at a quick fix for this, or will it have to wait a couple of weeks until the next beta release?

NinjaTrader_Ray
11-05-2009, 03:09 PM
You will have to wait. Usually we are releasing a new beta update once per week, this latest took a little longer than normal.

aslane
11-06-2009, 03:12 PM
Above, I said this was kind of clumsy, but after using it today, I think it is fine. The main issue I had was that the color series is not associated with the plot name, so you have to remember which plot index is which. This is easily gotten around though with a simple enum though if you care.

laocoon
11-10-2009, 07:56 AM
Please provide a link to download Beta 3 for those who (like me) downloaded Beta 4 and were unaware of this issue. I use various indicators with the Multi Plot feature and now find myself unable to trade because I can't downgrade anymore (the Beta 3 link in the mail announcing Beta 3 availability downloads Beta 4 now).

Thanks

NinjaTrader_Josh
11-10-2009, 09:51 AM
laocoon,

The issue has been resolved in the next beta. For actual trading please use 6.5. I would not recommend using a beta to trade live as you may run into unexpected scenarios while you are in the middle of a trade.

uprz23
11-16-2009, 10:03 AM
laocoon,

The issue has been resolved in the next beta. For actual trading please use 6.5. I would not recommend using a beta to trade live as you may run into unexpected scenarios while you are in the middle of a trade.


Could you guys also make sure that PlotStyle.Line changes color correctly? I only can get the PlotStyle.Dot to change color on Beta 4.

Thanks.

NinjaTrader_Josh
11-16-2009, 11:02 AM
uprz23,

Multicolor plots does not work properly in B4. Please try again in B5.

ClayB1
11-18-2009, 11:02 AM
It has been 2 weeks since last beta release. When do you anticipate releasing the next beta with a fix for the multi-color plot issue?

NinjaTrader_Dierk
11-18-2009, 11:08 AM
We likely will issue a new beta next week. We still needed to iron out a couple of issues before.

Ricam
12-02-2009, 12:55 PM
Post #1 in this thread (NT MultiColor Plot Approach) links to sample code for multi-color plotting in NT7. This does now seem to work in NT7 Beta 5.

However, would greatly appreciate if you could update this sample code to show how to use colors that can be user-selected as parameters, rather than hard coded into the Ninjascript.

Thanks!

Ricam
12-02-2009, 02:39 PM
Just to clarify, I did not mean to imply that the multi color plots do not work. They do work fine.

However, in the sample code that I referred to, the plot color is hard coded into the Ninjascript:

PlotColors[0][0] = Color.Blue;

I would like to see an example of how the color can instead be parameterized to be user selectable. Should be simple but my programming experience is very limited.

Thanks.

NinjaTrader_Josh
12-02-2009, 02:41 PM
Ricam,

Pardon my misread earlier. To create user definable parameters for colors please see this tip: http://www.ninjatrader-support2.com/vb/showthread.php?t=4977

Ricam
12-02-2009, 03:04 PM
Thanks for the info, Josh. That is exactly what I was looking for.

maxima
12-23-2009, 12:48 AM
an excellent addition to NT! thanks!

Light
01-28-2010, 02:49 AM
Guys, I haven't tested this exhaustively, but in my use of PlotColors so far, if an indicator's default settings are set by right-clicking on the "Indicators" window while a plot's color is not "Transparent," PlotColors changes will be overridden by the new default color, making them useless. For example, right-clicking on MyIndicator's settings and choosing "Set Default for MyIndicator" while its plot color is Orange will make the entire plot orange -- PlotColor changes from orange to any other color will not appear.

This is confusing because PlotColors has priority over the hard-coded initial color in the Plot() command. If this isn't changed, users should be warned to choose "Transparent" for Plots with PlotColors commands before setting indicator defaults. However, it seems to me it would be best if PlotColors also had priority over the "Set Default..." color. It would certainly prevent confusion.

Is this behavior intentional?

Thank you for your help,

Light

P.S. It appears this behavior isn't consistent. My description above holds for a MACD plot. But for the "D" line on a Stochastic, PlotColors are overridden by Transparent instead of by "Orange". Hence the plot disappears, despite the use of (non-Transparent) PlotColors commands.

NinjaTrader_Josh
01-28-2010, 08:36 AM
Light,

Unfortunately I was unable to reproduce on my end. Please provide a sample indicator and exact steps you are using to reproduce. Thank you.

Light
01-28-2010, 03:42 PM
Thanks Josh. I've been trying to repeat it, but am not seeing it now -- even on exactly the same NinjaScript files I saw it last night. Hmmm.

I'm going to stop looking. If it's this hard to reproduce, then it can't matter much. But if I see it again, I'll take closer notes.

Thanks again for your help.

Best wishes,

Light

P.S. Spoke too soon... it's back again -- if I can get time, I'll try to document it...

Light
01-28-2010, 07:10 PM
Josh, I am now confident that the problem originated from NOT serializing my color choice parameters in the properties section of my indicators. Without serialization, my indicator color preferences were removed upon by right-clicking the parameters window and selecting "Set Default...". (The cells for them were turned entirely blank -- no colors or text in the parameter section showing their labels.)

However, once I put in serialization commands for the color parameters, the same sequence of actions left my color preferences in place, and consequently the PlotColors command continued to perform as it should.

The lesson appears to be that it is especially important to serialize color parameters! ;-) My bad... However, I would encourage NT to put a warning about this in bold in the help files for NT7.

Thanks again for responding to my post. I hope my oversight it didn't cost you much time.

Best wishes,

Light

mpe66
02-03-2010, 04:19 PM
This doesn't work when I change input series to an indicator in beta8. On a price series it works fine.

Mpe

NinjaTrader_Josh
02-03-2010, 04:22 PM
Mpe,

Can you please be more descriptive as to what exactly doesn't work? Serializations? What are you seeing instead?

mpe66
02-03-2010, 04:30 PM
It disappears and plots nothing. I have been getting the same problem with other multi color plot indicators too, when I run them on indicators.

Mpe

NinjaTrader_Josh
02-03-2010, 04:42 PM
Mpe,

Please check your Control Center logs for runtime errors. Thank you.

mpe66
02-03-2010, 04:49 PM
I get a message saying "Error on calling 'OnBarUpdate' method for indicator 'SampleMultiColoredPlot' on bar 0"

Mpe

NinjaTrader_Bertrand
02-03-2010, 04:52 PM
I could reproduce mpe66, we're checking into.

laredo
02-05-2010, 08:17 AM
May I qualify for a beta version,please?

NinjaTrader_Josh
02-05-2010, 09:25 AM
laredo,

Please send a note to sales [at] ninjatrader [dot] com and they should be able to square you away. Thanks.

higler
02-05-2010, 11:15 AM
When I plot an indicator line on a chart (ex. EMA) in NT 7(B8) it doesn't show while crossing the body of a candlestick (its like the plot line is passing behind the candlestick). I would like to be able to see the plot crossing the body of the candlestick.

I imagine there's a way to do this in NT7 but I can't find it. NT6.5 appears to do this by default but I can't figure out how to see my plots crossing the body of a candlestick in in NT7(B8). Thanks.

NinjaTrader_Josh
02-05-2010, 11:30 AM
higler,

Select your series and use the mouse scroll wheel to adjust the z-ordering to your liking.

higler
02-05-2010, 11:48 AM
Thaks, Josh.

maxima
02-14-2010, 03:53 PM
erm... may be I am not very bright... I cant figure out how to access main data series from indicator...

If I want to color price candle to Blue from within an indicator how do I do it ?

Thanks!

P.S. I need to do barsAgo not current bar only.

laredo
02-14-2010, 03:59 PM
This is in N7 obviously and not 6.5,other wise I could tell you.

maxima
02-14-2010, 04:01 PM
Ignore that.. The answer is:

BarColorSeries[i] = Color.Blue;

godiamond
04-20-2010, 08:14 AM
Hi ,
I was just trying to use your sample of multicolour indicator: SampleColorInput.zip (http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=1554&d=1208248260)

I just changed SMA to CCI. On the picture there is combination of ordinary CCI line and multicolour CCI(according to your code) bars.
As you can see there are some errors.

Can you please help?
Radek
file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot.png

NinjaTrader_Brett
04-20-2010, 08:41 AM
Radek,

I noticed that you posted the wrong sample code. Your interested in the sample code located at the front of this thread. SampleMultiColorPlot. If I understand you correctly you are trying to color the CCI bars based on if the bar was an up bar or a down bar, is this correct?

SampleMultiColoredPlot.zip (http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=7243&d=1255030561)

I look forward to assisting you further.

godiamond
04-20-2010, 08:50 AM
Hi Brett,
yes you are correct in both. And sorry for the mistake. I would like to have it drawn in real time as each tick appears so the colour might change during time segment, but as you can see on pdf file, it is not working correctly
Radek

NinjaTrader_Brett
04-20-2010, 08:54 AM
Hello,

We do not normally write code, however as part of my NinjaScript training for NinjaTrader 7 I will code this indicator for you later today and post it here for you.



I look forward to assisting you further.

godiamond
04-20-2010, 08:58 AM
Hi Brett,
I really appreciate that. Thank you. Just one question. Should not it work if I just changed SMA to CCI in your original code? Probably not if it does not :)
Stupid questin

NinjaTrader_Brett
04-20-2010, 09:01 AM
No Problem.

I havnt looked into the code yet however I think there are other changes that need to be done to the logic also.

NinjaTrader_Brett
04-20-2010, 03:44 PM
godiamond,

Attached is the indicator below. If you take a look at the source code the new NinjaTrader 7 method if very straight forward on multicolor plots.

Let me know if you have any questions.

Ricam
04-20-2010, 05:19 PM
Brett, could you please add the code that allow users to set the rising and falling colors, which requires: declaring the colors, getting them from the UI, and serializing them. Just setting them to arbitrary hard coded values is not optimum.

Most people who are writing indicators are still using the NT6.5 technique of switching between different colored plots. It's time for everybody to move on to the next level.

godiamond
04-20-2010, 07:10 PM
Hi Brett,
thank you for your help. This is not exactly what I was looking for. I need green bar if CCI is higher(raisin) than previous one and red if CCI is lower(going down) than previous one. Not higher or lower than 0.
Radek

NinjaTrader_Brett
04-21-2010, 09:12 AM
Please see version 2 of this indicator. I have changed so that it changes color based on if the current CCI value is greater then the previous one it turns green or lower it turns red. Also I have added customizable color option as the suggestion from another user.

Let me know if you have any questions on how this works.

Ricam
04-21-2010, 10:17 AM
Very good example of multi-color plotting, great new feature of NT7! thanks.

godiamond
04-22-2010, 07:57 AM
Hi Brett,
Yes that's exactly it. Thank you very much

maxima
04-24-2010, 08:30 AM
Moderator, could you please split the godiamond part of this thread to somewhere else and also lock this one.

this sticky thread should be short and informative for just those who need quick facts on multi color plots. not twitter-like ping-pong with someone who is really bored.

thank you

NinjaTrader_ChristopherJ
04-24-2010, 01:52 PM
Moderator, could you please split the godiamond part of this thread to somewhere else and also lock this one.

this sticky thread should be short and informative for just those who need quick facts on multi color plots. not twitter-like ping-pong with someone who is really bored.

thank you


I will forward your request to the moderator.

cls71
05-09-2010, 03:38 AM
Hello,
I am watching than the Set method doesn´t work with ColorSeries:


PlotColors[n].Set( 0, Color.Green ); // it doesn´t work !!!
PlotColors[n][0] = Color.Green; // it works fine


Is there any special reason for this behaviour which is different from other series like DataSeries, BoolSeries, ... ?

Thanks very much

NinjaTrader_Austin
05-09-2010, 03:13 PM
cls71, my quick guess is that the PlotColors base definition does not contain a .Set() method to work with. If you really need to use .Set(), please reply back and we can send it along as a suggestion.

cls71
05-10-2010, 06:36 AM
If you really need to use .Set(), please reply back and we can send it along as a suggestion.

Yes, please. Thank you.

NinjaTrader_Josh
05-10-2010, 02:54 PM
cls71,

I guess I am not quite sure what the requirement for .Set is. If you want to set the color for different bars you can change the second []'s index.

PlotColors[0][1] for example for the previous bar instead of the current bar.

Can you please clarify? Thank you.

cls71
05-10-2010, 11:40 PM
cls71,

I guess I am not quite sure what the requirement for .Set is. If you want to set the color for different bars you can change the second []'s index.

PlotColors[0][1] for example for the previous bar instead of the current bar.

Can you please clarify? Thank you.

Josh,

I do not understand why it works the second[]'s index but does not the .Set method. Both should work equally, isn't it ?
(With other series like DataSeries, BoolSeries, IntSeries, etc, the .Set method works fine).

Thanks

NinjaTrader_Josh
05-11-2010, 09:24 AM
cls71,

No, there are underlying differences and reasons under the hood. Please use the documented technique of using the second [] index for barsAgo.

jamesaq
06-06-2010, 05:56 PM
It would be nice if multi-color features were built into every indicator by default for at least two color changing options: 1. increasing/decreasing value. 2. great than or less than zero. Just throwing the idea out there for a much later future incarnation, not this rev.

NinjaTrader_Brett
06-06-2010, 06:23 PM
Hello,

Thank you for that suggestion. I will send this to the development team.

Let me know if I can be of further assistance.

mpe66
09-06-2010, 11:11 AM
The SampleMultiColorPlotMA sometimes in realtime plots both the rising and falling color. When I hit F5 it is corrected. Is there a way to fix this?

Mpe

eDanny
09-07-2010, 08:21 AM
This type of indicator works perfectly in NT6.5 but for NT7 you must modify the code so where a condition ceases to exist you can Reset() the plot that should not be plotting. Alternatively you can do a more radical rewrite and use the NT7 single plot/color change method which will free up some memory.

Dan

mpe66
09-07-2010, 08:27 AM
This type of indicator works perfectly in NT6.5 but for NT7 you must modify the code so where a condition ceases to exist you can Reset() the plot that should no be plotting. Alternatively you can do a more radical rewrite and use the NT7 single plot/color change method which will free up some memory.

Dan

I thought this was created for NT7? Do you know if anyone has created an EMA single plot? If not, I guess I'll give it a go.

Mpe

NinjaTrader_Brett
09-07-2010, 08:36 AM
mpe66,

Thanks Dan for the assist, Dan is correct. This indicator needs to be modified for NinjaTrader 7 and the new multicolor plot approach. featured in this thread.

If you need assistance with making these modification if you are not a programmer you can contact a NinjaScript consultant to assist with this.


NinjaScript Consultants:
http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm



Let me know if I can be of further assistance.