protected override void OnBarUpdate()
{
if(CurrentBar<85)
{
return;
}
else
{
if((Close[0]>EMA(50)[0])&&
(ToTime(Time[0])<= 140000)&&
(Close[0]>Open[0])&&
(Volume[0]>=(EMA(Volume,10)[1]))&&
(Close[0]>(MAX(High,10)[1]))&&
(Slope(EMA(50),11,1)<0)&&
(CrossAbove(EMA(10),EMA(20),20))&&
(CountIf(delegate {return Close[0]>EMA(20)[0];},10)>4)&&
(CountIf(delegate {return (SMA(10)[0]<EMA(20)[0])&&(EMA(20)[0]<EMA(50)[0]);},30)>9)&&
(CountIf(delegate {return Low[0]>EMA(50)[0];},10)<3)&&
(!(Math.Abs((Slope(EMA(20),7,0)-Slope(EMA(50),7,0))/Slope(EMA(50),10,0))<.05)))
{
Plot0.Set(1);
}
else
{
Plot0.Set(0);
}
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Custom indicator not returning expected values
Collapse
X
-
Custom indicator not returning expected values
Hi... I wrote a custom indicator that I want to use to trigger alerts from Market Analyzer. I have it coded to return 1 if true, 0 if false. As it is now, the column in MA is just showing the last price, not 0 or 1. The on bar update method is below, and I attached a screen shot of the MA settings. Any help would be appreciated..
Code:Tags: None
-
Thanks much. I'm just curious though, help me understand... I get that it's 0 based, that being the case, wouldn't it just need to be 86 for on bar close? Also, why does on bar open need a different number? Thanks again..
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
27 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
117 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
69 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
226 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
414 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|

Comment