Best
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Indicator on ZeroLine
Collapse
X
-
Indicator on ZeroLine
Can you please tell me how I plot Close>SMA and Close<SMA on ZeroLine with diferente colors?
BestTags: None
-
RitaPacheco, you would need to custom code an oscillator for this purpose (the close substracted from the SMA value) and then set then colors according to the relation to the 0 value -
http://www.ninjatrader-support.com/H...verview18.html (tutorial 5 would be closest here for how to start)
-
Sorry I don't want an oscilate with values up and down to zero line.
I want only the zero line with 2 colors: one for close>SMA and other for close<SMA
I think what you told me to do is a colored line for up and other for down, isn't it? Like Tutorial no.5
Best
Comment
-
I can not to do this indicator to have above/below SMA with 2 diferent colors on ZeroLine. It densn't work yet Where do I put the 2 formulas: SMA - Close<>0 , I put them on protected override void OnBarUpdate() and put the plot after each formula. I have defenided on protected override void Initialize() Plot:
Plots[0].Min = 0;
Plots[1].Max = 0;;
I already understand that Above and Below plot are setting to zero as Above.Set (0)
Thanks
protected override void OnBarUpdate()
{
// Are there enough bars
if (CurrentBar < Period) return;
//find Close above SMA
if(SMA(period)[0]- Close[0]>0);
// Set the plot values
AboveZero.Set(0);
//find Close below SMA
if(SMA(period)[0]- Close[0]>0);
BelowZero.Set(0);
}
Comment
-
Sorry Bertrand
In fact the two if statements ware exactly the same, even so changed them it doesn't work. only show 1 color on Zero Line the Below color (2nd on order) there is samethig wrong.
Thanks
protected override void OnBarUpdate()
{
// Are there enough bars
if (CurrentBar < Period) return;
if(SMA(period)[0]- Close[0]>0);
// Set the plot values
AboveZero.Set(0);
if(SMA(period)[0]- Close[0]<0);
// Set the plot values
BelowZero.Set(0);
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
155 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
137 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment