![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Certified NinjaScript Consultant
|
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]);
}
Is there a straighforward way to accommodate dynamic color modificationstoa line plotstyle without the need to mind the gap? Regards, Whitmark |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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]); }
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Certified NinjaScript Consultant
|
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 |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|