Where is this described, and are there others I should know about or be able to find as parts of Ninja Language capabilities.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
IsLastBarOnChart() and others ?
Collapse
X
-
IsLastBarOnChart() and others ?
I am relatively new to Ninja and I spend a lot of time in the manual / doc. I am familiar with EasyLanguage and to a lesser extent C# with it's methods/ properties/ classes, etc. So, my point is, I am familiar in searching for things. I was not able to find IsLastBarOnChart description using both the alphabetical listing as well as the search. Search did find it being used in an example.
Where is this described, and are there others I should know about or be able to find as parts of Ninja Language capabilities.Tags: None
-
Hello joromero,
Thank you for the question.
In regards to the IsLastBarOnChart, you would not see this as it is undocumented as it is not supported but it is usable.
Alternatively you can access the current bar information by doing the following.
If you are trying to make the script wait until it is at the last bar of the chat and then start calculating you could use the statement below:
This would check if the current bar that is being processed is the last bar, if not skip the code after the return statement.Code:if(CurrentBar < Count - 1) return;
Here is the documentation on Count
Another check is the historical check, this allows you to only execute after a new tick is received.
So if you have this enabled on an indicator or strategy and apply it to a chart, it will do nothing past this line of code until a new tick is received.
Here is the documentation on HistoricalCode:if(Historical) return;
Please let me know if I may be of additional assistance.Last edited by NinjaTrader_Jesse; 07-07-2014, 08:06 AM.
-
hello Jesse,
How to draw text on last bar only after chart is completley load.
For example if I use F5 to refresh chart with strategy , text is drawing on each bar
(Chart period is 1 second)
So I would like strart drawing text in real time only.
if (CurrentBar > (Bars.Count - 2))
Draw.Text(this, CurrentBar.ToString() + ( Close[0]).ToString() , "X", 0, Close[0]+0.05, Brushes.Black);
(doesn't work)
thank you
Comment
-
Hello oceanis400,
If you want to only draw one object, the most simple way is to use a non-unique tag:
You would not need to use a condition with this if you just wanted this on the last closed bar, or building bar depending on the Calculate setting. Calling the same tag name will remove the object from its current location and update its positionCode:Draw.Text(this,[B] "MyNonUniqueTag"[/B] , "X", 0, Close[0]+0.05, Brushes.Black);
Please let me know if I may be of further assistance.
Comment
-
Hello Jesse,
No , I want to draw or plot only when last bar is load and display on chart.
I haven't find way to do it.
Text is drawing on all chart on every bar loaded. But I want to start drawing text in realtime only. (on each bar period 1s)
sincerely
Comment
-
-
-
Hello oceanis400,
Thank you for the post.
In this case, it looks as I had responded with NT7 syntax as we are in the NT7 forums. For NT8 questions please ensure to post in the NT8 forums going forward. I will move this to the NT8 forums.
For converting syntax from NT7 to NT8 you can use the code-breaking changes guide to find differences (select all from the dropdown and control + F Historical): https://ninjatrader.com/support/help...ng_changes.htm
For Historical, this is replaced with the State object and State system.
I look forward to being of further assistance.Code:if(State == State.Realtime) { }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment