Problematic.cs
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Problematic Indicator
Collapse
X
-
Problematic Indicator
I have attached extracted relevant portions of a problematic indicator that I converted from NT7 to NT8 ... I call the indicator "Problematic". The indicator successfully compiles, but it does not plot the Drawing objects (Lines, Rays, and Texts) when I load it onto a chart. Why are the Drawing objects not plotting or showing up ?
Problematic.csTags: None
-
The file you provided doesn't compile and is missing a bunch of code, so it's not of much use. Check your ninjascript output log and the log files as a starter.
Comment
-
The provided file contains ONLY extracted relevant portions of the indicator ... it is not expected to compile. It is the Draw.Line, Draw.Ray and Draw.Text that seem to have issues.Originally posted by NicholasJoannette View PostThe file you provided doesn't compile and is missing a bunch of code, so it's not of much use. Check your ninjascript output log and the log files as a starter.
Comment
-
That doesn't do what he's suggesting to do. UsingOriginally posted by omololu View PostYes, I have tried "if(CurrentBar < 10) return;" but it didn't work.will just return if the current bar being calculated in OnBarUpdate is within the 10 most recent bars. What nkhoi was suggesting was that you check there are sufficient bars on the chart. Something likeCode:if (CurrentBar < 10) return;
NT8 is not like NT7 - if you didn't know about this basic difference above, then it's likely that the issue is originating in the other parts of the code that you deemed irrelevant.Code:ChartBars.Bars.Count > 10
These Draw functions on their own work well. There is likely an issue with the arguments in your calls. If you converted from NT7 to NT8, it is likely a problem with the CurrentBar-PeakIndex[a] or CurrentBar-TroughIndex[DnCount] arguments. Just a guess though - good luck.Originally posted by omololu View PostThe provided file contains ONLY extracted relevant portions of the indicator ... it is not expected to compile. It is the Draw.Line, Draw.Ray and Draw.Text that seem to have issues.
Code:Draw.Line(this,"BD"+Var, CurrentBar - PeakIndex[a], Peak[a], CurrentBar - TroughIndex[DnCount], Trough[DnCount], BullishSetup);
Comment
-
Thanks for your comments.Originally posted by NicholasJoannette View Post
That doesn't do what he's suggesting to do. Usingwill just return if the current bar being calculated in OnBarUpdate is within the 10 most recent bars. What nkhoi was suggesting was that you check there are sufficient bars on the chart. Something likeCode:if (CurrentBar < 10) return;
NT8 is not like NT7 - if you didn't know about this basic difference above, then it's likely that the issue is originating in the other parts of the code that you deemed irrelevant.Code:ChartBars.Bars.Count > 10
These Draw functions on their own work well. There is likely an issue with the arguments in your calls. If you converted from NT7 to NT8, it is likely a problem with the CurrentBar-PeakIndex[a] or CurrentBar-TroughIndex[DnCount] arguments. Just a guess though - good luck.
Code:Draw.Line(this,"BD"+Var, CurrentBar - PeakIndex[a], Peak[a], CurrentBar - TroughIndex[DnCount], Trough[DnCount], BullishSetup);
So, how do I use "ChartBars.Bars.Count > 10" ?
Comment
-
Hi, thanks for posting.
If you are getting a bars ago indexing error then there are not enough bars on the chart when the command is executed. I agree with Nicholas "it is likely a problem with the CurrentBar-PeakIndex[a] or CurrentBar-TroughIndex[DnCount] arguments" without the full code it's hard to tell. You can use Visual Studio to break when the exception occurs and that wil show you what line is causing the problem:
Kind regards,
-ChrisL
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
653 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment