NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-29-2007, 03:21 AM   #1
whitmark
Certified NinjaScript Consultant
 
Join Date: Nov 2005
Location: Virginia, USA
Posts: 441
Thanks: 0
Thanked 12 times in 7 posts
Send a message via Skype™ to whitmark
Post imported post

I am trying to plot an indicator with acontinuous line that changes toan upcolor when the currentindicator value is above the previousindicator valueand conversely for the down color. So I haveadded two plots and use the plot values in a dataseries toset the two plots as follows:

Code:
// Determine Color forPlotLine 
if (Plot_Value[0] >= Plot_Value[1]) 
{
 Plot_Line_Up.Set(Plot_Value[0]); 
} 
else if (Plot_Value[0] < Plot_Value[1]) 
{
 Plot_Line_Dn.Set(Plot_Value[0]); 
}
However, when I examine the plots on the chart, I see the colors change but there is agap in the line plot where the plot changes color.I see there is aBarColor and BackColor methods for this purpose but anything forplots?
Is there a straighforward way to accommodate dynamic color modificationstoa line plotstyle without the need to mind the gap?


Regards,

Whitmark


whitmark is offline  
Reply With Quote
Old 03-29-2007, 04:20 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Post imported post

This should give you what you want. There may be some intersects where lines overlap. Also, you can use the Rising() and Falling() methods.

if (Rising(Plot_Value))
// Do something

Ray






// Determine Color forPlotLine
if (Plot_Value[0] >= Plot_Value[1])
{
Plot_Line_Up.Set(1, Plot_Value[1]);
Plot_Line_Up.Set(Plot_Value[0]);
}
else if (Plot_Value[0] < Plot_Value[1])
{
Plot_Line_Dn.Set(1, Plot_Value[1]);
Plot_Line_Dn.Set(Plot_Value[0]);
}

NinjaTrader_Ray is offline  
Reply With Quote
Old 03-29-2007, 06:03 AM   #3
whitmark
Certified NinjaScript Consultant
 
Join Date: Nov 2005
Location: Virginia, USA
Posts: 441
Thanks: 0
Thanked 12 times in 7 posts
Send a message via Skype™ to whitmark
Post imported post

Thanks Ray, that worked well.

Regarding the overlaps, is there a way to code the plots tocustomize 1) their layering on the chart and 2) the sequence they appear in the indicator dialog box?

Regards,

Whitmark
whitmark is offline  
Reply With Quote
Old 03-29-2007, 06:25 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Post imported post

You are welcome.

We do not have layering support at this time. I believe that plots lists in the Indicator dialog are alphabetically ordered. I will check this and report back if this is not the case.

Ray
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:17 AM.