Dot3[i] = minDistanceC; //RED DOTS TO DEBUG
Dot3[Bars.GetBar(cTime)] = minDistanceC;
Dot4[i] = minDistanceD; //ORANGE DOTS TO DEBUG
Dot4[Bars.GetBar(dTime)] = minDistanceD;
DateTime timecheck1 = new DateTime(2022, 05, 26, 12, 00, 00);
DateTime timecheck2 = new DateTime(2022, 05, 26, 12, 44, 00);
if(Time[i] > timecheck1 && Time[i] < timecheck2)
{
Print("Bar Index: "+Bars.GetBar(cTime)+" Marker: "+minDistanceC);
Print("Plot Red dot at: "+Dot3[Bars.GetBar(cTime)]);
Print("Bar Index: "+Bars.GetBar(dTime)+" Marker: "+minDistanceD);
Print("Plot Orange dot at: "+Dot4[Bars.GetBar(dTime)]);
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plot Bug?
Collapse
X
-
Plot Bug?
I'm trying to convert an indicator from Metatrader. Can anyone explain why I'm not getting dots to plot when I use Bars.GetBar() as index but when I use the "i" from the loop as index it shows. The Logs however tells me there should be a dot showing??
Code:
Tags: None
-
Hello PMitchum,
I'm not seeing any loop in your code. Where is "i" defined?
Time[0] would be the most recent bar. "i" would need to be equal to or greater than 0 and equal to or less than CurrentBar to be a valid barsAgo index.
If you have an absolute index, subtract it from CurrentBar to get a barsAgo index. CurrentBar - barNumber = barsAgoChelsea B.NinjaTrader Customer Service
-
How is the loop relevant here? The print statement in his code tells you everything you need to know if you look and compare it with the picture. I've also seen this happen before so you can put a +1 to this bug.
PMitchum have you tried Draw.Dot instead of using the plot dots?Last edited by Borgen; 05-30-2022, 01:08 AM.
Comment
-
Borgen I can verify that it works if I use Draw.Dot (see Yellow dot in picture), but that doesn't really surprise me since the green zigzag is drawn with the same type of values for Time.
The loop index has no significant meaning here what so ever, so that is why I didn't include it in the code sample. I isolated the range drawing the zigzag for debugging and drew the red dot on the last index. Which is where I also used Draw.Dot to verify all the values that have been set. I mentioned in another post how I was having some strange errors from the Plot values and this just tells me I was right all along.
The problem here is about how the AddPlot.values are being drawn. The values are clearly set there, logged and verified to work with other drawing methods. If this isn't considered a bug by Ninjatrader then I don't know what is...
Comment
-
Hello PMitchum,
Bars.GetBar() returns an absolute index, while we use barsAgo references in Series and Plots.
Have you tried the suggestion to convert the absolute index to a barsAgo reference that would then be used inside the square brackets of the plot?
I.E.
Dot4[CurrentBar - Bars.GetBar(dTime)]
Comment
-
PMitchum This solved it for me at least. Thanks Jim!Originally posted by NinjaTrader_Jim View PostHello PMitchum,
Bars.GetBar() returns an absolute index, while we use barsAgo references in Series and Plots.
Have you tried the suggestion to convert the absolute index to a barsAgo reference that would then be used inside the square brackets of the plot?
I.E.
Dot4[CurrentBar - Bars.GetBar(dTime)]
I get why the OP would be confused about this though since it worked with the Draw method. Especially also if he is coming from Metatrader where this is not the norm for drawing things on the chart.
So if you insert Bars.GetBar(dTime) (which returns an INT) in the plot series and Bars.GetBar(dTime) = 589, wouldn't the Dot show up on Bars Ago 589 then?
Comment
-
Hello PMitchum,
The "i" isn't defined. So we would not be able to confirm if this is a BarsAgo value or an absolute index, or what value "i" has been assigned.
Your inquiry was: " Can anyone explain why I'm not getting dots to plot when I use Bars.GetBar() as index but when I use the "i" from the loop as index it shows".
The loop would tell us what is assigned to "i" and how this would be different than using CurrentBar - Bars.GetBar() for an absolute bar value.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment