protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "CIndy1"));
Add(new Line(Color.FromKnownColor(KnownColor.Lavender), 0.0, "Line"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar<(2*periodMax)) return;
double[] AMDMR = new double[periodMax-periodMin+1];
double sum = 0;
for (int i=1;i<periodMax-PeriodMin+1;i++)
{
AMDMR[i]=Math.Abs(Momentum(Input,i)[0]/(MAX(High,i)[0]-MIN(Low,i)[0]));
sum=sum+AMDMR[i]/(periodMax-periodMin);
Print("AMDMR["+(i+periodMin)+"]="+AMDMR[i]);
Print(sum);
}
Print(sum);
CIndy1.Set(sum);
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
trouble with indicator error
Collapse
X
-
trouble with indicator error
log says there is an overflow with the plot method
Code:Tags: None
-
the problem seems to only pertain to the sum bit
it went away when i added other code
or set the indicator to close[0]
i had print() in there from the start it always printed fine, but the plot would only show on the first few days of the chart then disappear when you scrolled to the right.
once it disappeared you had to reload the scripts on the chart (after you scrolled left) for them to show again.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
35 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
12 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
18 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
20 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment